Closed CezaryGapinski closed 7 years ago
I had to make some further changes... The main reason is that if examples should stay simple, they really need the number of LEDs as a preprocessor constant. Otherwise we enter the land of complex code with uninitialized storage and placement new, which is probably not the best thing to use in simple examples.
That's why I've implemented following changes:
DISTORTOS_BOARD_LD2_LED_ENABLE
, which depend of apropriate GPIO port, but the macro is always either 1
or 0
. Easy to generate with your script.DISTORTOS_BOARD_TOTAL_LEDS
which is just defined to be a sum of all previously defined DISTORTOS_BOARD_..._LED_ENABLE
macros. Also easy for your script (* - see the paragraph at the end).DISTORTOS_BOARD_..._LED_ENABLE
- there's no need to repeat the more complex GPIO condition.I hope you're OK with that. The crack between the generator of boards and Kconfig is pretty wide...
#define DISTORTOS_BOARD_TOTAL_LEDS (DISTORTOS_BOARD_LD3_LED_ENABLE + DISTORTOS_BOARD_LD4_LED_ENABLE + \
DISTORTOS_BOARD_LD5_LED_ENABLE + DISTORTOS_BOARD_LD6_LED_ENABLE)
But if that's not convenient for your script this can be changed to:
/// total number of LEDs on the board
#define DISTORTOS_BOARD_TOTAL_LEDS (DISTORTOS_BOARD_LD3_LED_ENABLE + DISTORTOS_BOARD_LD4_LED_ENABLE + \
DISTORTOS_BOARD_LD5_LED_ENABLE + DISTORTOS_BOARD_LD6_LED_ENABLE + 0)
(note the 0
at the end, which would allow you to generate each token as <name> +
)
or even to sth like this:
/// total number of LEDs on the board
#define DISTORTOS_BOARD_TOTAL_LEDS ( \
DISTORTOS_BOARD_LD3_LED_ENABLE + \
DISTORTOS_BOARD_LD4_LED_ENABLE + \
DISTORTOS_BOARD_LD5_LED_ENABLE + \
DISTORTOS_BOARD_LD6_LED_ENABLE + \
0)
(which would allow you to generate one token per line, always in the form \t\t<name> + \
)
Merged with a couple of fixes:
buttons.hpp
andleds.hpp
CONFIG_BOARD_LEDS_ENABLE
condition. Without the removed table with pin identifiers, these are not needed when LEDs are disabled.