Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys/auto_init: add auto_init_leds, drop LED init code from boards #17584

Merged
merged 7 commits into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions boards/6lowpan-clicker/clicker.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ extern void dummy(void);

void board_init(void)
{
/* Turn off all LED's */
gpio_init(LED1_PIN, GPIO_OUT);
gpio_init(LED2_PIN, GPIO_OUT);
LED1_OFF;
LED2_OFF;

/* Stop the linker from throwing away the PIC32 config register settings */
dummy();
}
63 changes: 63 additions & 0 deletions boards/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,66 @@ config MODULE_BOARD
depends on TEST_KCONFIG
help
Module which holds all board-specific files.

config MODULE_AUTO_INIT_LEDS
bool
default y
depends on TEST_KCONFIG
help
Enable auto initalization of board leds

config MODULE_AUTO_INIT_LED0
bool
default y
depends on TEST_KCONFIG
help
Enable auto initalization of LED0 if present

config MODULE_AUTO_INIT_LED1
bool
default y
depends on TEST_KCONFIG
help
Enable auto initalization of LED1 if present

config MODULE_AUTO_INIT_LED2
bool
default y
depends on TEST_KCONFIG
help
Enable auto initalization of LED2 if present

config MODULE_AUTO_INIT_LED3
bool
default y
depends on TEST_KCONFIG
help
Enable auto initalization of LED3 if present

config MODULE_AUTO_INIT_LED4
bool
default y
depends on TEST_KCONFIG
help
Enable auto initalization of LED4 if present

config MODULE_AUTO_INIT_LED5
bool
default y
depends on TEST_KCONFIG
help
Enable auto initalization of LED5 if present

config MODULE_AUTO_INIT_LED6
bool
default y
depends on TEST_KCONFIG
help
Enable auto initalization of LED6 if present

config MODULE_AUTO_INIT_LED7
bool
default y
depends on TEST_KCONFIG
help
Enable auto initalization of LED7 if present
3 changes: 0 additions & 3 deletions boards/acd52832/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,4 @@

void board_init(void)
{
/* initialize the boards LEDs */
gpio_init(LED0_PIN, GPIO_OUT);
gpio_set(LED0_PIN);
}
3 changes: 0 additions & 3 deletions boards/adafruit-clue/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@

void board_init(void)
{
/* initialize the boards LEDs */
gpio_init(LED0_PIN, GPIO_OUT); /* Red LED */

/* initialize the screen backlight, turn it off by default */
gpio_init(BACKLIGHT_PIN, GPIO_OUT);
gpio_clear(BACKLIGHT_PIN);
Expand Down
3 changes: 0 additions & 3 deletions boards/adafruit-itsybitsy-m4/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,4 @@ mtd_dev_t *mtd0 = (mtd_dev_t *)&samd51_nor_dev;

void board_init(void)
{
/* initialize the on-board LED */
gpio_init(LED0_PIN, GPIO_OUT);
LED0_OFF;
}
3 changes: 0 additions & 3 deletions boards/adafruit-itsybitsy-nrf52/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,4 @@

void board_init(void)
{
/* initialize the board's single LED */
gpio_init(LED0_PIN, GPIO_OUT);
gpio_set(LED0_PIN);
}
4 changes: 0 additions & 4 deletions boards/alientek-pandora/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,4 @@

void board_init(void)
{
/* initialize LEDs */
gpio_init(LED0_PIN, GPIO_OUT);
gpio_init(LED1_PIN, GPIO_OUT);
gpio_init(LED2_PIN, GPIO_OUT);
}
4 changes: 0 additions & 4 deletions boards/arduino-leonardo/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
*/

#include "board.h"
#include "cpu.h"

void led_init(void);

void board_init(void)
{
led_init();
}
34 changes: 0 additions & 34 deletions boards/arduino-leonardo/led_init.c

This file was deleted.

10 changes: 0 additions & 10 deletions boards/arduino-nano-33-ble/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,4 @@

void board_init(void)
{
/* initialize the boards LEDs */
gpio_init(LED0_PIN, GPIO_OUT); /* Orange LED */
gpio_init(LED1_PIN, GPIO_OUT); /* Red LED */
gpio_set(LED1_PIN);
gpio_init(LED2_PIN, GPIO_OUT); /* Green LED */
gpio_set(LED2_PIN);
gpio_init(LED3_PIN, GPIO_OUT); /* Blue LED */
gpio_set(LED3_PIN);
gpio_init(LED4_PIN, GPIO_OUT); /* PWR LED */
gpio_clear(LED4_PIN);
}
2 changes: 0 additions & 2 deletions boards/arduino-nano-33-iot/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,4 @@

void board_init(void)
{
/* initialize the on-board "Yellow" LED */
gpio_init(LED0_PIN, GPIO_OUT);
}
27 changes: 0 additions & 27 deletions boards/atmega256rfr2-xpro/led_init.c

This file was deleted.

2 changes: 1 addition & 1 deletion boards/avr-rss2/led_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ void led_init(void)
/* Ports Pins as Output */
LED_PORT_DDR |= LED1_MASK | LED0_MASK;
/* All LEDs OFF */
LED_PORT |= (LED1_MASK | LED0_MASK);
LED_PORT |= LED1_MASK | LED0_MASK;
}
3 changes: 3 additions & 0 deletions boards/b-l072z-lrwan1/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ config BOARD_B_L072Z_LRWAN1

select HAVE_SAUL_GPIO

config MODULE_PERIPH_INIT_LED0
default n if MODULE_PERIPH_SPI

source "$(RIOTBOARD)/common/stm32/Kconfig"
5 changes: 5 additions & 0 deletions boards/b-l072z-lrwan1/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ endif
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif

ifneq (,$(filter periph_spi,$(USEMODULE)))
# The LED pin is also used for SPI
DISABLE_MODULE += periph_init_led0
endif
10 changes: 0 additions & 10 deletions boards/b-l072z-lrwan1/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,4 @@ void board_init(void)
gpio_init(RADIO_TCXO_VCC_PIN, GPIO_OUT);
gpio_set(RADIO_TCXO_VCC_PIN);
#endif

#ifdef AUTO_INIT_LED0
/* The LED pin is also used for SPI, so we enable it
only if explicitly wanted by the user */
gpio_init(LED0_PIN, GPIO_OUT);
#endif

gpio_init(LED1_PIN, GPIO_OUT);
gpio_init(LED2_PIN, GPIO_OUT);
gpio_init(LED3_PIN, GPIO_OUT);
}
2 changes: 1 addition & 1 deletion boards/b-l072z-lrwan1/include/gpio_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern "C" {
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
#ifdef AUTO_INIT_LED0
#ifdef MODULE_PERIPH_INIT_LED0
{
.name = "LD2(red)",
.pin = LED0_PIN,
Expand Down
3 changes: 3 additions & 0 deletions boards/b-l475e-iot01a/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ config BOARD_B_L475E_IOT01A
select HAVE_LPS22HB
select HAVE_LSM6DSL

config MODULE_PERIPH_INIT_LED0
default n if MODULE_PERIPH_SPI

source "$(RIOTBOARD)/common/stm32/Kconfig"
5 changes: 5 additions & 0 deletions boards/b-l475e-iot01a/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += lps22hb
USEMODULE += lsm6dsl
endif

ifneq (,$(filter periph_spi,$(USEMODULE)))
# The LED pin is also used for SPI
DISABLE_MODULE += periph_init_led0
endif
5 changes: 0 additions & 5 deletions boards/b-l475e-iot01a/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,4 @@

void board_init(void)
{
#ifdef AUTO_INIT_LED0
/* The LED pin is also used for SPI, so we enable it
only if explicitly wanted by the user */
gpio_init(LED0_PIN, GPIO_OUT);
#endif
}
2 changes: 1 addition & 1 deletion boards/b-l475e-iot01a/include/gpio_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern "C" {
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
#ifdef AUTO_INIT_LED0
#ifdef MODULE_PERIPH_INIT_LED0
/* The LED pin is also used for SPI, so we enable it
only if explicitly wanted by the user */
{
Expand Down
3 changes: 3 additions & 0 deletions boards/b-u585i-iot02a/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ config BOARD_B_U585I_IOT02A
select HAVE_HTS221
select HAVE_LPS22HH

config MODULE_PERIPH_INIT_LED0
default n if MODULE_PERIPH_SPI

source "$(RIOTBOARD)/common/stm32/Kconfig"
5 changes: 5 additions & 0 deletions boards/b-u585i-iot02a/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += hts221
USEMODULE += lps22hh
endif

ifneq (,$(filter periph_spi,$(USEMODULE)))
# The LED pin is also used for SPI
DISABLE_MODULE += periph_init_led0
endif
7 changes: 0 additions & 7 deletions boards/b-u585i-iot02a/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,4 @@

void board_init(void)
{
#ifdef AUTO_INIT_LED0
/* The LED pin is also used for SPI, so we enable it
only if explicitly wanted by the user */
gpio_init(LED0_PIN, GPIO_OUT);
#endif
gpio_init(LED1_PIN, GPIO_OUT);
gpio_init(LED2_PIN, GPIO_OUT);
}
2 changes: 1 addition & 1 deletion boards/b-u585i-iot02a/include/gpio_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern "C" {
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
#ifdef AUTO_INIT_LED0
#ifdef MODULE_PERIPH_INIT_LED0
/* The LED pin is also used for SPI, so we enable it
only if explicitly wanted by the user */
{
Expand Down
2 changes: 0 additions & 2 deletions boards/bastwan/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

void board_init(void)
{
/* initialize the boards LED */
gpio_init(LED0_PIN, GPIO_OUT);

#ifdef TX_SWITCH_PWR_PIN
/* Enables pwr to the Antenna switch circuit */
Expand Down
2 changes: 0 additions & 2 deletions boards/bluepill-stm32f030c8/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,4 @@

void board_init(void)
{
gpio_init(LED0_PIN, GPIO_OUT);
LED0_OFF;
}
2 changes: 0 additions & 2 deletions boards/cc1312-launchpad/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,4 @@

void board_init(void)
{
gpio_init(LED0_PIN, GPIO_OUT);
gpio_init(LED1_PIN, GPIO_OUT);
}
2 changes: 0 additions & 2 deletions boards/cc1350-launchpad/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,4 @@

void board_init(void)
{
gpio_init(LED0_PIN, GPIO_OUT);
gpio_init(LED1_PIN, GPIO_OUT);
}
2 changes: 0 additions & 2 deletions boards/cc1352-launchpad/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,4 @@

void board_init(void)
{
gpio_init(LED0_PIN, GPIO_OUT);
gpio_init(LED1_PIN, GPIO_OUT);
}
2 changes: 0 additions & 2 deletions boards/cc1352p-launchpad/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,4 @@

void board_init(void)
{
gpio_init(LED0_PIN, GPIO_OUT);
gpio_init(LED1_PIN, GPIO_OUT);
}
5 changes: 0 additions & 5 deletions boards/cc2538dk/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,4 @@
*/
void board_init(void)
{
/* initialize the boards LEDs */
gpio_init(LED0_PIN, GPIO_OUT);
gpio_init(LED1_PIN, GPIO_OUT);
gpio_init(LED2_PIN, GPIO_OUT);
gpio_init(LED3_PIN, GPIO_OUT);
}
Loading