Cosmetics

This commit is contained in:
Bertrand Songis
2019-05-27 18:43:46 +02:00
parent 64ff78b598
commit 2aacfd2cca
6 changed files with 50 additions and 15 deletions
+22 -3
View File
@@ -23,41 +23,60 @@
void ledInit()
{
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = LED_GREEN_GPIO_PIN;
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;
#if defined(LED_GREEN_GPIO)
GPIO_InitStructure.GPIO_Pin = LED_GREEN_GPIO_PIN;
GPIO_Init(LED_GREEN_GPIO, &GPIO_InitStructure);
#endif
#if defined(LED_RED_GPIO)
GPIO_InitStructure.GPIO_Pin = LED_RED_GPIO_PIN;
GPIO_Init(LED_RED_GPIO, &GPIO_InitStructure);
#endif
#if defined(LED_BLUE_GPIO)
GPIO_InitStructure.GPIO_Pin = LED_BLUE_GPIO_PIN;
GPIO_Init(LED_BLUE_GPIO, &GPIO_InitStructure);
#endif
}
void ledOff()
{
#if defined(LED_RED_GPIO)
GPIO_LED_GPIO_OFF(LED_RED_GPIO, LED_RED_GPIO_PIN);
#endif
#if defined(LED_BLUE_GPIO)
GPIO_LED_GPIO_OFF(LED_BLUE_GPIO, LED_BLUE_GPIO_PIN);
#endif
#if defined(LED_GREEN_GPIO)
GPIO_LED_GPIO_OFF(LED_GREEN_GPIO, LED_GREEN_GPIO_PIN);
#endif
}
void ledRed()
{
#if defined(LED_RED_GPIO)
ledOff();
GPIO_LED_GPIO_ON(LED_RED_GPIO, LED_RED_GPIO_PIN);
#endif
}
void ledGreen()
{
#if defined(LED_GREEN_GPIO)
ledOff();
GPIO_LED_GPIO_ON(LED_GREEN_GPIO, LED_GREEN_GPIO_PIN);
#endif
}
void ledBlue()
{
#if defined(LED_BLUE_GPIO)
ledOff();
GPIO_LED_GPIO_ON(LED_BLUE_GPIO, LED_BLUE_GPIO_PIN);
#endif
}