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 "stm32f1xx.h"
#include "stm32f1xx_hal_gpio.h"
#include "../led.h"
Include dependency graph for stm32f1xx/led.cpp:

Go to the source code of this file.

Macros

#define LED_PORT   GPIOA

Functions

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

Macro Definition Documentation

◆ LED_PORT

#define LED_PORT   GPIOA

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

Function Documentation

◆ Led_GetPin()

uint16_t Led_GetPin ( Led::Id led)
static

Definition at line 31 of file stm32f1xx/led.cpp.

32{
33 switch (led)
34 {
35 case Led::RED: return GPIO_PIN_MASK; // unavailable on NUCLEO-F103RB board
36 case Led::GREEN: return GPIO_PIN_5;
37 case Led::BLUE: return GPIO_PIN_MASK; // unavailable on NUCLEO-F103RB board
38 default:
39 return GPIO_PIN_MASK;
40 }
41}
static constexpr Id GREEN
Definition led.h:34
static constexpr Id RED
Definition led.h:36
static constexpr Id BLUE
Definition led.h:37

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

◆ Led_InitGpio()

void Led_InitGpio ( int32_t pin)
static

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

20{
21 __HAL_RCC_GPIOA_CLK_ENABLE();
22
23 GPIO_InitTypeDef gpio = {};
24 gpio.Mode = GPIO_MODE_OUTPUT_PP;
25 gpio.Pin = pin;
26 gpio.Pull = GPIO_PULLUP;
27 gpio.Speed = GPIO_SPEED_FREQ_HIGH;
28 HAL_GPIO_Init(LED_PORT, &gpio);
29}
#define LED_PORT

References LED_PORT.