Skip to content

Commit

Permalink
drivers/leds: Make initialization conditional on presence, not pin
Browse files Browse the repository at this point in the history
The LEDx_PIN may still be defined (eg. on the particle-mesh family
because it is used to configure the PWM pins); the IS_PRESENT macro
performs the stricter check ov testing for an _ON function.
  • Loading branch information
chrysn committed Aug 25, 2024
1 parent 1f40313 commit 94745c4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions drivers/periph_common/init_leds.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @}
*/

#include "board.h"
#include "led.h"
#include "periph/gpio.h"
#include "kernel_defines.h"

Expand All @@ -35,28 +35,28 @@ void led_init(void)
return;
}

#ifdef LED0_PIN
#ifdef LED0_IS_PRESENT
LED_INIT(0);
#endif
#ifdef LED1_PIN
#ifdef LED1_IS_PRESENT
LED_INIT(1);
#endif
#ifdef LED2_PIN
#ifdef LED2_IS_PRESENT
LED_INIT(2);
#endif
#ifdef LED3_PIN
#ifdef LED3_IS_PRESENT
LED_INIT(3);
#endif
#ifdef LED4_PIN
#ifdef LED4_IS_PRESENT
LED_INIT(4);
#endif
#ifdef LED5_PIN
#ifdef LED5_IS_PRESENT
LED_INIT(5);
#endif
#ifdef LED6_PIN
#ifdef LED6_IS_PRESENT
LED_INIT(6);
#endif
#ifdef LED7_PIN
#ifdef LED7_IS_PRESENT
LED_INIT(7);
#endif
}

0 comments on commit 94745c4

Please sign in to comment.