SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
led.cpp File Reference
#include <assert.h>
#include "stm32f4xx.h"
#include "stm32f4xx_hal_gpio.h"
#include "../led.h"
Include dependency graph for stm32f4xx/led.cpp:

Go to the source code of this file.

Macros

#define LED_PORT   GPIOD

Functions

static void Led_InitGpio (int32_t pin)
static int32_t Led_GetPin (Led::Id led)

Macro Definition Documentation

◆ LED_PORT

#define LED_PORT   GPIOD

Definition at line 17 of file stm32f4xx/led.cpp.

Function Documentation

◆ Led_GetPin()

int32_t Led_GetPin ( Led::Id led)
static

Definition at line 32 of file stm32f4xx/led.cpp.

33{
34 // STM32F407G-DISC1 LEDs are on PD12-PD15
35 switch (led)
36 {
37 case Led::GREEN: return GPIO_PIN_12;
38 case Led::ORANGE: return GPIO_PIN_13;
39 case Led::RED: return GPIO_PIN_14;
40 case Led::BLUE: return GPIO_PIN_15;
41 default:
42 return GPIO_PIN_MASK;
43 }
44}
static constexpr Id GREEN
Definition led.h:34
static constexpr Id RED
Definition led.h:36
static constexpr Id ORANGE
Definition led.h:35
static constexpr Id BLUE
Definition led.h:37

References bsp::Led::BLUE, bsp::Led::GREEN, bsp::Led::ORANGE, and bsp::Led::RED.

◆ Led_InitGpio()

void Led_InitGpio ( int32_t pin)
static

Definition at line 19 of file stm32f4xx/led.cpp.

20{
21 __HAL_RCC_GPIOD_CLK_ENABLE();
22
23 GPIO_InitTypeDef gpio = {};
24 gpio.Mode = GPIO_MODE_OUTPUT_PP;
25 gpio.Pin = pin;
26 gpio.Pull = GPIO_NOPULL;
27 gpio.Speed = GPIO_SPEED_FREQ_LOW;
28 gpio.Alternate = 0;
29 HAL_GPIO_Init(LED_PORT, &gpio);
30}
#define LED_PORT

References LED_PORT.