Introduce T-pro and function switches handling

This commit is contained in:
3djc
2021-12-17 17:07:48 +01:00
committed by Raphael Coeffic
parent 69dafd13c0
commit d31482c18b
63 changed files with 1324 additions and 70 deletions
+24
View File
@@ -43,8 +43,32 @@ void ledInit()
GPIO_InitStructure.GPIO_Pin = LED_BLUE_GPIO_PIN;
GPIO_Init(LED_BLUE_GPIO, &GPIO_InitStructure);
#endif
#if defined(FUNCTION_SWITCHES)
RCC_AHB1PeriphClockCmd(FS_RCC_AHB1Periph, ENABLE);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Pin = FSLED_GPIO_PIN_1 | FSLED_GPIO_PIN_2 | FSLED_GPIO_PIN_3 | FSLED_GPIO_PIN_4 | FSLED_GPIO_PIN_5 | FSLED_GPIO_PIN_6;
GPIO_Init(FSLED_GPIO, &GPIO_InitStructure);
#endif
}
#if defined(FUNCTION_SWITCHES)
constexpr uint32_t fsLeds[] = {FSLED_GPIO_PIN_1, FSLED_GPIO_PIN_2, FSLED_GPIO_PIN_3, FSLED_GPIO_PIN_4, FSLED_GPIO_PIN_5, FSLED_GPIO_PIN_6};
void fsLedOff(uint8_t index)
{
GPIO_FSLED_GPIO_OFF(FSLED_GPIO, fsLeds[index]);
}
void fsLedOn(uint8_t index)
{
GPIO_FSLED_GPIO_ON(FSLED_GPIO, fsLeds[index]);
}
#endif
void ledOff()
{
#if defined(LED_RED_GPIO)