From 982598a1997fca56aa24abcc7c3e129b37730a16 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 28 Jan 2022 11:18:41 +0100 Subject: [PATCH 1/7] drivers/periph_common: add periph_init_leds to init all on-board LEDs --- dist/tools/doccheck/exclude_patterns | 2 +- drivers/periph_common/Kconfig | 1 + drivers/periph_common/Kconfig.leds | 69 ++++++++++++++++++++++++++++ drivers/periph_common/init.c | 6 +++ drivers/periph_common/init_leds.c | 62 +++++++++++++++++++++++++ sys/auto_init/leds/Makefile | 3 ++ 6 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 drivers/periph_common/Kconfig.leds create mode 100644 drivers/periph_common/init_leds.c create mode 100644 sys/auto_init/leds/Makefile diff --git a/dist/tools/doccheck/exclude_patterns b/dist/tools/doccheck/exclude_patterns index bd2ff2310f83..b8625f3b27a9 100644 --- a/dist/tools/doccheck/exclude_patterns +++ b/dist/tools/doccheck/exclude_patterns @@ -1327,7 +1327,7 @@ boards/common/nucleo144/include/arduino_pinmap\.h:[0-9]+: warning: Member ARDUIN boards/common/nucleo144/include/arduino_pinmap\.h:[0-9]+: warning: Member ARDUINO_PIN_A4 \(macro definition\) of file arduino_pinmap\.h is not documented\. boards/common/nucleo144/include/arduino_pinmap\.h:[0-9]+: warning: Member ARDUINO_PIN_A5 \(macro definition\) of file arduino_pinmap\.h is not documented\. boards/common/nucleo144/include/arduino_pinmap\.h:[0-9]+: warning: end of file with unbalanced grouping commands -boards/common/nucleo144/include/board\.h:[0-9]+: warning: Member AUTO_INIT_LED0 \(macro definition\) of group boards_common_nucleo144 is not documented\. +boards/common/nucleo144/include/board\.h:[0-9]+: warning: Member PERIPH_INIT_LED0 \(macro definition\) of group boards_common_nucleo144 is not documented\. boards/common/nucleo144/include/board\.h:[0-9]+: warning: Member BTN0_MODE \(macro definition\) of group boards_common_nucleo144 is not documented\. boards/common/nucleo144/include/board\.h:[0-9]+: warning: Member BTN0_PIN \(macro definition\) of group boards_common_nucleo144 is not documented\. boards/common/nucleo144/include/board\.h:[0-9]+: warning: Member LED0_MASK \(macro definition\) of group boards_common_nucleo144 is not documented\. diff --git a/drivers/periph_common/Kconfig b/drivers/periph_common/Kconfig index 903b93440e66..2947f5c5b00a 100644 --- a/drivers/periph_common/Kconfig +++ b/drivers/periph_common/Kconfig @@ -115,6 +115,7 @@ config MODULE_PERIPH_INIT_QDEC default y if MODULE_PERIPH_INIT depends on MODULE_PERIPH_QDEC +rsource "Kconfig.leds" rsource "Kconfig.rtc" config MODULE_PERIPH_RTT diff --git a/drivers/periph_common/Kconfig.leds b/drivers/periph_common/Kconfig.leds new file mode 100644 index 000000000000..d779573ef9c6 --- /dev/null +++ b/drivers/periph_common/Kconfig.leds @@ -0,0 +1,69 @@ +# Copyright (c) 2022 Inria +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# + +config MODULE_PERIPH_INIT_LEDS + bool + default y + depends on TEST_KCONFIG + help + Enable auto initialization of board leds + +config MODULE_PERIPH_INIT_LED0 + bool + default y + depends on MODULE_PERIPH_INIT_LEDS + help + Enable auto initialization of LED0 if present + +config MODULE_PERIPH_INIT_LED1 + bool + default y + depends on MODULE_PERIPH_INIT_LEDS + help + Enable auto initialization of LED1 if present + +config MODULE_PERIPH_INIT_LED2 + bool + default y + depends on MODULE_PERIPH_INIT_LEDS + help + Enable auto initialization of LED2 if present + +config MODULE_PERIPH_INIT_LED3 + bool + default y + depends on MODULE_PERIPH_INIT_LEDS + help + Enable auto initialization of LED3 if present + +config MODULE_PERIPH_INIT_LED4 + bool + default y + depends on MODULE_PERIPH_INIT_LEDS + help + Enable auto initialization of LED4 if present + +config MODULE_PERIPH_INIT_LED5 + bool + default y + depends on MODULE_PERIPH_INIT_LEDS + help + Enable auto initialization of LED5 if present + +config MODULE_PERIPH_INIT_LED6 + bool + default y + depends on MODULE_PERIPH_INIT_LEDS + help + Enable auto initialization of LED6 if present + +config MODULE_PERIPH_INIT_LED7 + bool + default y + depends on MODULE_PERIPH_INIT_LEDS + help + Enable auto initialization of LED7 if present diff --git a/drivers/periph_common/init.c b/drivers/periph_common/init.c index 5d328ab22e43..8fbd394f304e 100644 --- a/drivers/periph_common/init.c +++ b/drivers/periph_common/init.c @@ -22,6 +22,7 @@ #define USB_H_USER_IS_RIOT_INTERNAL +#include "kernel_defines.h" #include "periph_cpu.h" #ifdef MODULE_PERIPH_INIT @@ -54,6 +55,11 @@ void periph_init(void) { #ifdef MODULE_PERIPH_INIT + /* initialize leds */ + if (IS_USED(MODULE_PERIPH_INIT_LEDS)) { + extern void led_init(void); + led_init(); + } /* initialize configured I2C devices */ #ifdef MODULE_PERIPH_INIT_I2C for (unsigned i = 0; i < I2C_NUMOF; i++) { diff --git a/drivers/periph_common/init_leds.c b/drivers/periph_common/init_leds.c new file mode 100644 index 000000000000..88688e54db40 --- /dev/null +++ b/drivers/periph_common/init_leds.c @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2022 ML!PA Consulting GmbH + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup drivers_periph_init + * @{ + * + * @file + * @brief Init on board LEDs + * + * @author Benjamin Valentin + * @} + */ + +#include "board.h" +#include "periph/gpio.h" +#include "kernel_defines.h" + +#define LED_INIT(x) do { \ + if (IS_ACTIVE(MODULE_PERIPH_INIT_LED##x)) { \ + gpio_init(LED##x##_PIN, GPIO_OUT); \ + LED##x##_OFF; \ + } \ + } while (0) + +__attribute__ ((weak)) +void led_init(void) +{ + if (!IS_USED(MODULE_PERIPH_GPIO)) { + return; + } + +#ifdef LED0_PIN + LED_INIT(0); +#endif +#ifdef LED1_PIN + LED_INIT(1); +#endif +#ifdef LED2_PIN + LED_INIT(2); +#endif +#ifdef LED3_PIN + LED_INIT(3); +#endif +#ifdef LED4_PIN + LED_INIT(4); +#endif +#ifdef LED5_PIN + LED_INIT(5); +#endif +#ifdef LED6_PIN + LED_INIT(6); +#endif +#ifdef LED7_PIN + LED_INIT(7); +#endif +} diff --git a/sys/auto_init/leds/Makefile b/sys/auto_init/leds/Makefile new file mode 100644 index 000000000000..5d0aa8a123b0 --- /dev/null +++ b/sys/auto_init/leds/Makefile @@ -0,0 +1,3 @@ +MODULE = periph_init_leds + +include $(RIOTMAKE)/auto_init.inc.mk From cd6aea3549a5330ca98e6133d1d55761f0c22cf8 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 28 Jan 2022 11:19:20 +0100 Subject: [PATCH 2/7] makefiles: make periph_init_leds a default module --- makefiles/dependency_resolution.inc.mk | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/makefiles/dependency_resolution.inc.mk b/makefiles/dependency_resolution.inc.mk index e0db0f771ce7..9e4e704b9ce4 100644 --- a/makefiles/dependency_resolution.inc.mk +++ b/makefiles/dependency_resolution.inc.mk @@ -37,6 +37,16 @@ ifneq ($(OLD_STATE),$(NEW_STATE)) else # Include late allowing them to have been disabled during dependency resolution DEFAULT_MODULE += auto_init periph_init + DEFAULT_MODULE += periph_init_leds + DEFAULT_MODULE += periph_init_led0 + DEFAULT_MODULE += periph_init_led1 + DEFAULT_MODULE += periph_init_led2 + DEFAULT_MODULE += periph_init_led3 + DEFAULT_MODULE += periph_init_led4 + DEFAULT_MODULE += periph_init_led5 + DEFAULT_MODULE += periph_init_led6 + DEFAULT_MODULE += periph_init_led7 + USEMODULE += $(filter-out $(DISABLE_MODULE),auto_init periph_init) # If module auto_init is not used, silently disable all of its submodules From 468ea89953a29cb229937ff4eb60c0b33c4dbeae Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 28 Jan 2022 13:28:20 +0100 Subject: [PATCH 3/7] boards: drop LED init This is handled by periph_init_leds now --- boards/6lowpan-clicker/clicker.c | 6 -- boards/Kconfig | 63 +++++++++++++++++++ boards/acd52832/board.c | 3 - boards/adafruit-clue/board.c | 3 - boards/adafruit-itsybitsy-m4/board.c | 3 - boards/adafruit-itsybitsy-nrf52/board.c | 3 - boards/alientek-pandora/board.c | 4 -- boards/arduino-leonardo/board.c | 4 -- boards/arduino-leonardo/led_init.c | 34 ---------- boards/arduino-nano-33-ble/board.c | 10 --- boards/arduino-nano-33-iot/board.c | 2 - boards/atmega256rfr2-xpro/led_init.c | 27 -------- boards/avr-rss2/led_init.c | 29 --------- boards/b-l072z-lrwan1/Kconfig | 3 + boards/b-l072z-lrwan1/Makefile.dep | 5 ++ boards/b-l072z-lrwan1/board.c | 10 --- boards/b-l072z-lrwan1/include/gpio_params.h | 2 +- boards/b-l475e-iot01a/Kconfig | 3 + boards/b-l475e-iot01a/Makefile.dep | 5 ++ boards/b-l475e-iot01a/board.c | 5 -- boards/b-l475e-iot01a/include/gpio_params.h | 2 +- boards/b-u585i-iot02a/Kconfig | 3 + boards/b-u585i-iot02a/Makefile.dep | 5 ++ boards/b-u585i-iot02a/board.c | 7 --- boards/b-u585i-iot02a/include/gpio_params.h | 2 +- boards/bastwan/board.c | 2 - boards/bluepill-stm32f030c8/board.c | 2 - boards/cc1312-launchpad/board.c | 2 - boards/cc1350-launchpad/board.c | 2 - boards/cc1352-launchpad/board.c | 2 - boards/cc1352p-launchpad/board.c | 2 - boards/cc2538dk/board.c | 5 -- boards/cc2650-launchpad/board.c | 2 - boards/cc2650stk/board.c | 2 - boards/common/arduino-atmega/led_init.c | 34 ---------- boards/common/arduino-due/board.c | 2 - boards/common/arduino-mkr/board.c | 2 - boards/common/arduino-zero/board.c | 2 - boards/common/atmega/board.c | 7 --- boards/common/atxmega/board.c | 11 ---- boards/common/blxxxpill/board.c | 1 - boards/common/e104-bt50xxa-tb/board.c | 4 -- boards/common/esp32/board_common.c | 12 ---- boards/common/esp8266/board_common.c | 12 ---- boards/common/iotlab/board_init.c | 7 --- boards/common/kw41z/board.c | 25 -------- boards/common/nrf52xxxdk/board.c | 4 -- .../common/nucleo/board_common_nucleo_init.c | 20 ------ boards/common/nucleo/include/board_nucleo.h | 5 -- boards/common/nucleo144/include/board.h | 5 -- boards/common/nucleo32/Kconfig | 3 + boards/common/nucleo32/Makefile.dep | 6 ++ boards/common/nucleo32/include/gpio_params.h | 4 +- boards/common/nucleo64/Kconfig | 3 + boards/common/nucleo64/Makefile.dep | 6 ++ boards/common/nucleo64/include/gpio_params.h | 2 +- boards/common/particle-mesh/board.c | 9 --- boards/common/saml1x/board.c | 16 ----- boards/common/silabs/board_common.c | 4 -- boards/common/sodaq/board.c | 3 - boards/common/weact-f4x1cx/board.c | 2 - boards/dwm1001/board.c | 9 --- boards/e180-zg120b-tb/board.c | 4 -- boards/ek-lm4f120xl/board.c | 16 ----- boards/f4vi1/board.c | 4 -- boards/feather-m0/board.c | 2 - boards/feather-nrf52840/board.c | 6 -- boards/firefly/board.c | 5 -- boards/frdm-k22f/board.c | 7 --- boards/frdm-k64f/board.c | 9 --- boards/frdm-kl43z/board.c | 5 -- boards/hamilton/board.c | 3 - boards/hifive1/board.c | 9 --- boards/hifive1b/board.c | 9 --- boards/ikea-tradfri/board.c | 6 -- boards/limifrog-v1/board.c | 2 - boards/lobaro-lorabox/board.c | 1 - boards/lora-e5-dev/board.c | 6 -- boards/lora-e5-dev/include/board.h | 9 --- boards/lora-e5-dev/include/gpio_params.h | 2 - boards/maple-mini/board.c | 2 - boards/mbed_lpc1768/board.c | 18 ------ boards/mcb2388/board_init.c | 4 -- boards/mega-xplained/led_init.c | 38 ----------- boards/msba2/board_init.c | 6 -- boards/msbiot/board.c | 4 -- boards/mulle/board.c | 4 -- boards/native/board_init.c | 3 - boards/nrf51dk/board.c | 11 ---- boards/nrf51dongle/board.c | 4 -- boards/nrf52832-mdk/board.c | 7 --- boards/nrf52840-mdk-dongle/board.c | 7 --- boards/nrf52840-mdk/board.c | 7 --- boards/nrf52840dongle/board.c | 10 --- boards/nrf6310/board.c | 1 - boards/nrf9160dk/board.c | 8 --- boards/nucleo-f030r8/Makefile.dep | 2 +- boards/nucleo-f031k6/Makefile.dep | 2 +- boards/nucleo-f042k6/Makefile.dep | 2 +- boards/nucleo-f070rb/Makefile.dep | 2 +- boards/nucleo-f072rb/Makefile.dep | 2 +- boards/nucleo-f091rc/Makefile.dep | 2 +- boards/nucleo-f103rb/Makefile.dep | 2 +- boards/nucleo-f302r8/Makefile.dep | 2 +- boards/nucleo-f303k8/Makefile.dep | 2 +- boards/nucleo-f303re/Makefile.dep | 2 +- boards/nucleo-f334r8/Makefile.dep | 2 +- boards/nucleo-f401re/Makefile.dep | 2 +- boards/nucleo-f410rb/Makefile.dep | 2 +- boards/nucleo-f411re/Makefile.dep | 2 +- boards/nucleo-f446re/Makefile.dep | 2 +- boards/nucleo-g070rb/Makefile.dep | 2 +- boards/nucleo-g071rb/Makefile.dep | 2 +- boards/nucleo-g431rb/Makefile.dep | 3 +- boards/nucleo-g474re/Makefile.dep | 3 +- boards/nucleo-l011k4/Makefile.dep | 2 +- boards/nucleo-l031k6/Makefile.dep | 2 +- boards/nucleo-l053r8/Makefile.dep | 2 +- boards/nucleo-l073rz/Makefile.dep | 2 +- boards/nucleo-l152re/Makefile.dep | 2 +- boards/nucleo-l412kb/Makefile.dep | 2 +- boards/nucleo-l432kc/Makefile.dep | 2 +- boards/nucleo-l433rc/Makefile.dep | 3 +- boards/nucleo-l452re/Makefile.dep | 2 +- boards/nucleo-l476rg/Makefile.dep | 2 +- boards/nucleo-wl55jc/Makefile.dep | 3 +- boards/nucleo-wl55jc/board.c | 3 - boards/nucleo-wl55jc/include/board.h | 9 --- boards/nucleo-wl55jc/include/gpio_params.h | 2 - boards/nz32-sc151/board.c | 2 - boards/olimexino-stm32/board.c | 3 - boards/omote/board.c | 16 ----- boards/opencm904/board.c | 3 - boards/openlabs-kw41z-mini/board.c | 3 - boards/openmote-b/board.c | 5 -- boards/openmote-cc2538/board.c | 5 -- boards/p-l496g-cell02/board.c | 3 - boards/p-nucleo-wb55/include/board.h | 6 -- boards/p-nucleo-wb55/include/gpio_params.h | 2 - boards/pba-d-01-kw2x/board.c | 9 --- boards/phynode-kw41z/board.c | 17 ----- boards/pic32-wifire/wifire.c | 8 --- boards/pyboard/board.c | 2 - boards/qn9080dk/board.c | 3 - boards/remote-pa/board.c | 4 -- boards/remote-reva/board.c | 5 -- boards/remote-revb/board.c | 4 -- boards/rpi-pico/board.c | 1 - boards/samd10-xmini/board.c | 2 - boards/samd20-xpro/board.c | 3 - boards/samd21-xpro/board.c | 3 - boards/same54-xpro/board.c | 5 -- boards/saml21-xpro/board.c | 17 ----- boards/samr21-xpro/board.c | 3 - boards/samr30-xpro/board.c | 16 ----- boards/samr34-xpro/board.c | 16 ----- boards/seeeduino_arch-pro/board.c | 18 ------ boards/seeeduino_xiao/board.c | 7 --- boards/sensebox_samd21/board.c | 4 -- boards/serpente/board.c | 7 --- boards/sodaq-one/board.c | 7 --- boards/sodaq-sara-aff/Kconfig | 3 + boards/sodaq-sara-aff/Makefile.dep | 5 ++ boards/sodaq-sara-aff/board.c | 15 ----- boards/sodaq-sara-sff/board.c | 3 - boards/spark-core/board.c | 9 --- boards/stm32f030f4-demo/board.c | 2 - boards/stm32f0discovery/board.c | 3 - boards/stm32f3discovery/board.c | 9 --- boards/stm32f429i-disc1/board.c | 3 - boards/stm32f469i-disco/board.c | 4 -- boards/stm32f4discovery/board.c | 5 -- boards/stm32f723e-disco/Kconfig | 3 + boards/stm32f723e-disco/Makefile.dep | 5 ++ boards/stm32f723e-disco/board.c | 7 --- boards/stm32f723e-disco/include/gpio_params.h | 2 +- boards/stm32f769i-disco/board.c | 5 -- boards/stm32g0316-disco/board.c | 2 - boards/stm32l0538-disco/board.c | 3 - boards/stm32l476g-disco/board.c | 3 - boards/teensy31/board.c | 3 - boards/ublox-c030-u201/board.c | 3 - boards/waspmote-pro/board.c | 20 ------ tests/leds/Makefile | 2 +- 184 files changed, 163 insertions(+), 966 deletions(-) delete mode 100644 boards/arduino-leonardo/led_init.c delete mode 100644 boards/atmega256rfr2-xpro/led_init.c delete mode 100644 boards/avr-rss2/led_init.c delete mode 100644 boards/common/arduino-atmega/led_init.c create mode 100644 boards/common/nucleo32/Makefile.dep create mode 100644 boards/common/nucleo64/Makefile.dep delete mode 100644 boards/mega-xplained/led_init.c diff --git a/boards/6lowpan-clicker/clicker.c b/boards/6lowpan-clicker/clicker.c index c2840436f75a..d755360f8b13 100644 --- a/boards/6lowpan-clicker/clicker.c +++ b/boards/6lowpan-clicker/clicker.c @@ -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(); } diff --git a/boards/Kconfig b/boards/Kconfig index 14933a9d9956..3e178bd50b28 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -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 diff --git a/boards/acd52832/board.c b/boards/acd52832/board.c index fc2fa5292396..0f720c68e4c3 100644 --- a/boards/acd52832/board.c +++ b/boards/acd52832/board.c @@ -23,7 +23,4 @@ void board_init(void) { - /* initialize the boards LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_set(LED0_PIN); } diff --git a/boards/adafruit-clue/board.c b/boards/adafruit-clue/board.c index 5aee8576099d..f1f46993ba2d 100644 --- a/boards/adafruit-clue/board.c +++ b/boards/adafruit-clue/board.c @@ -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); diff --git a/boards/adafruit-itsybitsy-m4/board.c b/boards/adafruit-itsybitsy-m4/board.c index c163ed97cbac..e135d12b642f 100644 --- a/boards/adafruit-itsybitsy-m4/board.c +++ b/boards/adafruit-itsybitsy-m4/board.c @@ -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; } diff --git a/boards/adafruit-itsybitsy-nrf52/board.c b/boards/adafruit-itsybitsy-nrf52/board.c index 8820ac4a4c51..eb55cf822d35 100644 --- a/boards/adafruit-itsybitsy-nrf52/board.c +++ b/boards/adafruit-itsybitsy-nrf52/board.c @@ -24,7 +24,4 @@ void board_init(void) { - /* initialize the board's single LED */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_set(LED0_PIN); } diff --git a/boards/alientek-pandora/board.c b/boards/alientek-pandora/board.c index c727475297b0..a71107ac7eb8 100644 --- a/boards/alientek-pandora/board.c +++ b/boards/alientek-pandora/board.c @@ -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); } diff --git a/boards/arduino-leonardo/board.c b/boards/arduino-leonardo/board.c index 6310110e97f2..9d54cc4864d4 100644 --- a/boards/arduino-leonardo/board.c +++ b/boards/arduino-leonardo/board.c @@ -19,11 +19,7 @@ */ #include "board.h" -#include "cpu.h" - -void led_init(void); void board_init(void) { - led_init(); } diff --git a/boards/arduino-leonardo/led_init.c b/boards/arduino-leonardo/led_init.c deleted file mode 100644 index 07c764b4d674..000000000000 --- a/boards/arduino-leonardo/led_init.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2017 Thomas Perrot - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup boards_arduino-leonardo - * @{ - * - * @file - * @brief Board specific led initialization for Arduino Leonardo - * - * @author Thomas Perrot - * - * @} - */ - -#include "board.h" -#include "cpu.h" -#include "periph/gpio.h" - -void led_init(void) -{ - /* initialize the on-board LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - LED0_OFF; - gpio_init(LED1_PIN, GPIO_OUT); - LED2_OFF; - gpio_init(LED2_PIN, GPIO_OUT); - LED2_OFF; -} diff --git a/boards/arduino-nano-33-ble/board.c b/boards/arduino-nano-33-ble/board.c index 3a1c3f218c1d..867a1f27b795 100644 --- a/boards/arduino-nano-33-ble/board.c +++ b/boards/arduino-nano-33-ble/board.c @@ -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); } diff --git a/boards/arduino-nano-33-iot/board.c b/boards/arduino-nano-33-iot/board.c index f9766e9e9723..6c24a6edd7be 100644 --- a/boards/arduino-nano-33-iot/board.c +++ b/boards/arduino-nano-33-iot/board.c @@ -23,6 +23,4 @@ void board_init(void) { - /* initialize the on-board "Yellow" LED */ - gpio_init(LED0_PIN, GPIO_OUT); } diff --git a/boards/atmega256rfr2-xpro/led_init.c b/boards/atmega256rfr2-xpro/led_init.c deleted file mode 100644 index f68937e951f9..000000000000 --- a/boards/atmega256rfr2-xpro/led_init.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2019 Inria - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup boards_atmega256rfr2-xpro - * @{ - * - * @file - * @brief Board specific implementation for the Atmega256RFR2 Xplained Pro - * - * @author Alexandre Abadie - * - * @} - */ - -#include "board.h" - -void led_init(void) -{ - LED0_ENABLE_PORT; - LED0_OFF; -} diff --git a/boards/avr-rss2/led_init.c b/boards/avr-rss2/led_init.c deleted file mode 100644 index 2ba580a375aa..000000000000 --- a/boards/avr-rss2/led_init.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2019 Robert Olsson - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup boards_avr-rss2 - * @{ - * - * @file - * @brief Board specific LED initialization - * @author Robert Olsson - * - * - * @} - */ - -#include "board.h" - -void led_init(void) -{ - /* Ports Pins as Output */ - LED_PORT_DDR |= LED1_MASK | LED0_MASK; - /* All LEDs OFF */ - LED_PORT |= (LED1_MASK | LED0_MASK); -} diff --git a/boards/b-l072z-lrwan1/Kconfig b/boards/b-l072z-lrwan1/Kconfig index bfd681f74173..6b64eec23a87 100644 --- a/boards/b-l072z-lrwan1/Kconfig +++ b/boards/b-l072z-lrwan1/Kconfig @@ -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" diff --git a/boards/b-l072z-lrwan1/Makefile.dep b/boards/b-l072z-lrwan1/Makefile.dep index 52861764e824..6ed0cbb1b7fe 100644 --- a/boards/b-l072z-lrwan1/Makefile.dep +++ b/boards/b-l072z-lrwan1/Makefile.dep @@ -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 diff --git a/boards/b-l072z-lrwan1/board.c b/boards/b-l072z-lrwan1/board.c index d2b663448f96..277398545fef 100644 --- a/boards/b-l072z-lrwan1/board.c +++ b/boards/b-l072z-lrwan1/board.c @@ -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); } diff --git a/boards/b-l072z-lrwan1/include/gpio_params.h b/boards/b-l072z-lrwan1/include/gpio_params.h index b9439313a7fe..9b9a5d0fc2ef 100644 --- a/boards/b-l072z-lrwan1/include/gpio_params.h +++ b/boards/b-l072z-lrwan1/include/gpio_params.h @@ -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, diff --git a/boards/b-l475e-iot01a/Kconfig b/boards/b-l475e-iot01a/Kconfig index 33bea1a02d51..83b1d863d7fe 100644 --- a/boards/b-l475e-iot01a/Kconfig +++ b/boards/b-l475e-iot01a/Kconfig @@ -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" diff --git a/boards/b-l475e-iot01a/Makefile.dep b/boards/b-l475e-iot01a/Makefile.dep index 3598bb0d617a..0d7a0458d0b4 100644 --- a/boards/b-l475e-iot01a/Makefile.dep +++ b/boards/b-l475e-iot01a/Makefile.dep @@ -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 diff --git a/boards/b-l475e-iot01a/board.c b/boards/b-l475e-iot01a/board.c index e1d8cbd4c78d..ccf524a33589 100644 --- a/boards/b-l475e-iot01a/board.c +++ b/boards/b-l475e-iot01a/board.c @@ -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 } diff --git a/boards/b-l475e-iot01a/include/gpio_params.h b/boards/b-l475e-iot01a/include/gpio_params.h index 0bb84e0dae3b..c8e17a692faa 100644 --- a/boards/b-l475e-iot01a/include/gpio_params.h +++ b/boards/b-l475e-iot01a/include/gpio_params.h @@ -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 */ { diff --git a/boards/b-u585i-iot02a/Kconfig b/boards/b-u585i-iot02a/Kconfig index a270a5971765..96acff4eb3e5 100644 --- a/boards/b-u585i-iot02a/Kconfig +++ b/boards/b-u585i-iot02a/Kconfig @@ -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" diff --git a/boards/b-u585i-iot02a/Makefile.dep b/boards/b-u585i-iot02a/Makefile.dep index c33cb91bbf7b..94ae6570c51c 100644 --- a/boards/b-u585i-iot02a/Makefile.dep +++ b/boards/b-u585i-iot02a/Makefile.dep @@ -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 diff --git a/boards/b-u585i-iot02a/board.c b/boards/b-u585i-iot02a/board.c index 5c1a9cccffdb..a1c749a9a417 100644 --- a/boards/b-u585i-iot02a/board.c +++ b/boards/b-u585i-iot02a/board.c @@ -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); } diff --git a/boards/b-u585i-iot02a/include/gpio_params.h b/boards/b-u585i-iot02a/include/gpio_params.h index d735db9572d3..e68a927c8cf7 100644 --- a/boards/b-u585i-iot02a/include/gpio_params.h +++ b/boards/b-u585i-iot02a/include/gpio_params.h @@ -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 */ { diff --git a/boards/bastwan/board.c b/boards/bastwan/board.c index 4d9612a259d7..d78ddc621638 100644 --- a/boards/bastwan/board.c +++ b/boards/bastwan/board.c @@ -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 */ diff --git a/boards/bluepill-stm32f030c8/board.c b/boards/bluepill-stm32f030c8/board.c index 7577d83776fc..719d7c6a8287 100644 --- a/boards/bluepill-stm32f030c8/board.c +++ b/boards/bluepill-stm32f030c8/board.c @@ -24,6 +24,4 @@ void board_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); - LED0_OFF; } diff --git a/boards/cc1312-launchpad/board.c b/boards/cc1312-launchpad/board.c index bccf57fdf4ae..e6d598a1b4c7 100644 --- a/boards/cc1312-launchpad/board.c +++ b/boards/cc1312-launchpad/board.c @@ -27,6 +27,4 @@ void board_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); } diff --git a/boards/cc1350-launchpad/board.c b/boards/cc1350-launchpad/board.c index ee92ee62fc11..87a0f77cefbb 100644 --- a/boards/cc1350-launchpad/board.c +++ b/boards/cc1350-launchpad/board.c @@ -25,6 +25,4 @@ void board_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); } diff --git a/boards/cc1352-launchpad/board.c b/boards/cc1352-launchpad/board.c index 4b5d26d971e5..33ca6b4a8af8 100644 --- a/boards/cc1352-launchpad/board.c +++ b/boards/cc1352-launchpad/board.c @@ -27,6 +27,4 @@ void board_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); } diff --git a/boards/cc1352p-launchpad/board.c b/boards/cc1352p-launchpad/board.c index 834c091cf0e2..dd736c426fe1 100644 --- a/boards/cc1352p-launchpad/board.c +++ b/boards/cc1352p-launchpad/board.c @@ -25,6 +25,4 @@ void board_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); } diff --git a/boards/cc2538dk/board.c b/boards/cc2538dk/board.c index 48197f35f612..aa7da4e76815 100644 --- a/boards/cc2538dk/board.c +++ b/boards/cc2538dk/board.c @@ -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); } diff --git a/boards/cc2650-launchpad/board.c b/boards/cc2650-launchpad/board.c index 2780df16f408..13190c2f3675 100644 --- a/boards/cc2650-launchpad/board.c +++ b/boards/cc2650-launchpad/board.c @@ -27,6 +27,4 @@ void board_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); } diff --git a/boards/cc2650stk/board.c b/boards/cc2650stk/board.c index 93a3be98f2a8..c62255be08a6 100644 --- a/boards/cc2650stk/board.c +++ b/boards/cc2650stk/board.c @@ -25,6 +25,4 @@ */ void board_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); } diff --git a/boards/common/arduino-atmega/led_init.c b/boards/common/arduino-atmega/led_init.c deleted file mode 100644 index c3a7d4a12cd7..000000000000 --- a/boards/common/arduino-atmega/led_init.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen - * 2015-18 Kaspar Schleiser - * 2016 Laurent Navet - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup boards_common_arduino-atmega - * @{ - * - * @file - * @brief Common led initialization for Arduino Atmega boards - * - * @author Hinnerk van Bruinehsen - * @author Kaspar Schleiser - * @author Laurent Navet - * - * @} - */ - -#include "board.h" -#include "cpu.h" -#include "periph/gpio.h" - -void __attribute__((weak)) led_init(void) -{ - /* initialize the on-board LED */ - gpio_init(LED0_PIN, GPIO_OUT); - LED0_OFF; -} diff --git a/boards/common/arduino-due/board.c b/boards/common/arduino-due/board.c index 703375165ca9..a4127bec7fc4 100644 --- a/boards/common/arduino-due/board.c +++ b/boards/common/arduino-due/board.c @@ -24,6 +24,4 @@ void board_init(void) { - /* initialize the on-board Amber "L" LED @ pin PB27 */ - gpio_init(LED0_PIN, GPIO_OUT); } diff --git a/boards/common/arduino-mkr/board.c b/boards/common/arduino-mkr/board.c index 95e4db5d15a1..8771cba73506 100644 --- a/boards/common/arduino-mkr/board.c +++ b/boards/common/arduino-mkr/board.c @@ -25,6 +25,4 @@ void board_init(void) { - /* initialize the on-board Amber "L" LED */ - gpio_init(LED0_PIN, GPIO_OUT); } diff --git a/boards/common/arduino-zero/board.c b/boards/common/arduino-zero/board.c index aa8375c120a5..f404a0f56eff 100644 --- a/boards/common/arduino-zero/board.c +++ b/boards/common/arduino-zero/board.c @@ -27,6 +27,4 @@ void board_init(void) { - /* initialize the on-board Amber "L" LED on pin PA17 */ - gpio_init(LED0_PIN, GPIO_OUT); } diff --git a/boards/common/atmega/board.c b/boards/common/atmega/board.c index d951a243449a..40f3ce1c7124 100644 --- a/boards/common/atmega/board.c +++ b/boards/common/atmega/board.c @@ -19,14 +19,7 @@ */ #include "board.h" -#include "cpu.h" -#include "periph/gpio.h" - -void led_init(void); void __attribute__((weak)) board_init(void) { -#ifdef LED0_ON - led_init(); -#endif } diff --git a/boards/common/atxmega/board.c b/boards/common/atxmega/board.c index 7d4bdb24e42a..dd639b3d1f51 100644 --- a/boards/common/atxmega/board.c +++ b/boards/common/atxmega/board.c @@ -21,17 +21,6 @@ #include "board.h" #include "cpu.h" -#ifdef LED_PORT -void __attribute__((weak)) led_init(void) -{ - LED_PORT.DIR = LED_PORT_MASK; - LED_PORT.OUT = LED_PORT_MASK; -} -#endif - void __attribute__((weak)) board_init(void) { -#ifdef LED_PORT - led_init(); -#endif } diff --git a/boards/common/blxxxpill/board.c b/boards/common/blxxxpill/board.c index 75a0b2ab58c1..a99258aa6633 100644 --- a/boards/common/blxxxpill/board.c +++ b/boards/common/blxxxpill/board.c @@ -27,5 +27,4 @@ void board_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); } diff --git a/boards/common/e104-bt50xxa-tb/board.c b/boards/common/e104-bt50xxa-tb/board.c index 19e0fb7bdfa9..f77f6e4c7b61 100644 --- a/boards/common/e104-bt50xxa-tb/board.c +++ b/boards/common/e104-bt50xxa-tb/board.c @@ -26,10 +26,6 @@ extern void pm_reboot(void*); void board_init(void) { - /* initialize the boards LEDs */ - LED_PORT->DIRSET = (LED_MASK); - LED_PORT->OUTSET = (LED_MASK); - /* configure software RST button */ #ifdef MODULE_BOARD_SOFTWARE_RESET gpio_init_int(BTN0_PIN, BTN0_MODE, GPIO_FALLING, diff --git a/boards/common/esp32/board_common.c b/boards/common/esp32/board_common.c index 42a05e2e012e..b8955781f40e 100644 --- a/boards/common/esp32/board_common.c +++ b/boards/common/esp32/board_common.c @@ -32,18 +32,6 @@ void board_init_common(void) { - #ifdef LED0_PIN - gpio_init (LED0_PIN, GPIO_OUT); - LED0_OFF; - #endif - #ifdef LED1_PIN - gpio_init (LED1_PIN, GPIO_OUT); - LED1_OFF; - #endif - #ifdef LED2_PIN - gpio_init (LED2_PIN, GPIO_OUT); - LED2_OFF; - #endif } extern void adc_print_config(void); diff --git a/boards/common/esp8266/board_common.c b/boards/common/esp8266/board_common.c index 942262791d10..29591d4e61a3 100644 --- a/boards/common/esp8266/board_common.c +++ b/boards/common/esp8266/board_common.c @@ -29,18 +29,6 @@ extern "C" { void board_init(void) { - #ifdef LED0_PIN - gpio_init (LED0_PIN, GPIO_OUT); - LED0_OFF; - #endif - #ifdef LED1_PIN - gpio_init (LED1_PIN, GPIO_OUT); - LED1_OFF; - #endif - #ifdef LED2_PIN - gpio_init (LED2_PIN, GPIO_OUT); - LED2_OFF; - #endif } extern void adc_print_config(void); diff --git a/boards/common/iotlab/board_init.c b/boards/common/iotlab/board_init.c index 02a48dd9def2..9c07e3e595fc 100644 --- a/boards/common/iotlab/board_init.c +++ b/boards/common/iotlab/board_init.c @@ -23,11 +23,4 @@ void board_init(void) { - /* initialize the boards LEDs and turn them off */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); - gpio_set(LED0_PIN); - gpio_set(LED1_PIN); - gpio_set(LED2_PIN); } diff --git a/boards/common/kw41z/board.c b/boards/common/kw41z/board.c index 493ccd599729..0f882234b831 100644 --- a/boards/common/kw41z/board.c +++ b/boards/common/kw41z/board.c @@ -21,31 +21,6 @@ #include "board.h" #include "periph/gpio.h" -static void led_init(void) -{ - /* initialize and turn off LEDs */ -#ifdef LED0_PIN - gpio_init(LED0_PIN, GPIO_OUT); - LED0_OFF; -#endif -#ifdef LED1_PIN - gpio_init(LED1_PIN, GPIO_OUT); - LED1_OFF; -#endif -#ifdef LED2_PIN - gpio_init(LED2_PIN, GPIO_OUT); - LED2_OFF; -#endif -#ifdef LED3_PIN - gpio_init(LED3_PIN, GPIO_OUT); - LED3_OFF; -#endif -} - void board_init(void) { - /* initialize LEDs, skip for riotboot */ - if (!IS_ACTIVE(RIOTBOOT)) { - led_init(); - } } diff --git a/boards/common/nrf52xxxdk/board.c b/boards/common/nrf52xxxdk/board.c index ea1bd18b19bf..accba4e3d421 100644 --- a/boards/common/nrf52xxxdk/board.c +++ b/boards/common/nrf52xxxdk/board.c @@ -23,8 +23,4 @@ void board_init(void) { - /* initialize the boards LEDs */ - LED_PORT->DIRSET = (LED_MASK); - LED_PORT->OUTSET = (LED_MASK); - } diff --git a/boards/common/nucleo/board_common_nucleo_init.c b/boards/common/nucleo/board_common_nucleo_init.c index 4384ab3f751c..806603326da5 100644 --- a/boards/common/nucleo/board_common_nucleo_init.c +++ b/boards/common/nucleo/board_common_nucleo_init.c @@ -28,25 +28,6 @@ * @} */ -#include "board.h" -#include "board_nucleo.h" -#include "periph/gpio.h" - -void board_common_nucleo_init(void) -{ - /* initialization of on-board LEDs - * NOTE: LED0 must be explicitly enabled as it is also used for SPI_DEV(0) */ -#ifdef AUTO_INIT_LED0 - gpio_init(LED0_PIN, GPIO_OUT); -#endif -#ifdef LED1_PIN - gpio_init(LED1_PIN, GPIO_OUT); -#endif -#ifdef LED2_PIN - gpio_init(LED2_PIN, GPIO_OUT); -#endif -} - /* * Allow overwriting board_init if common implementation doesn't work. * If at link time another implementation of board_init() not marked as weak @@ -54,5 +35,4 @@ void board_common_nucleo_init(void) */ void __attribute__((weak)) board_init(void) { - board_common_nucleo_init(); } diff --git a/boards/common/nucleo/include/board_nucleo.h b/boards/common/nucleo/include/board_nucleo.h index b7e524fe8989..3d59b504bee0 100644 --- a/boards/common/nucleo/include/board_nucleo.h +++ b/boards/common/nucleo/include/board_nucleo.h @@ -55,11 +55,6 @@ extern "C" { #endif /** @} */ -/** - * @brief Common board initialization routine for Nucleo boards - */ -void board_common_nucleo_init(void); - /** * @brief Initialize board specific hardware, including clock, LEDs and std-IO */ diff --git a/boards/common/nucleo144/include/board.h b/boards/common/nucleo144/include/board.h index 0623c181e437..4920fad4ec65 100644 --- a/boards/common/nucleo144/include/board.h +++ b/boards/common/nucleo144/include/board.h @@ -69,11 +69,6 @@ extern "C" { #define LED2_ON (LED2_PORT->BSRR = LED2_MASK) #define LED2_OFF (LED2_PORT->BSRR = (LED2_MASK << 16)) #define LED2_TOGGLE (LED2_PORT->ODR ^= LED2_MASK) - -/* the Nucleo144 boards always use LED0, as there is no dual use of its pin */ -#ifndef AUTO_INIT_LED0 -#define AUTO_INIT_LED0 -#endif /** @} */ /** diff --git a/boards/common/nucleo32/Kconfig b/boards/common/nucleo32/Kconfig index bebcefa25eaa..552ff6615881 100644 --- a/boards/common/nucleo32/Kconfig +++ b/boards/common/nucleo32/Kconfig @@ -12,5 +12,8 @@ config BOARD_COMMON_NUCLEO32 # Clock configuration select BOARD_HAS_LSE if (CPU_FAM_L0 || CPU_FAM_L4) && !BOARD_NUCLEO_L011K4 +config MODULE_PERIPH_INIT_LED0 + default n if MODULE_PERIPH_SPI + source "$(RIOTBOARD)/common/nucleo/Kconfig" source "$(RIOTBOARD)/common/stm32/Kconfig" diff --git a/boards/common/nucleo32/Makefile.dep b/boards/common/nucleo32/Makefile.dep new file mode 100644 index 000000000000..d9bc77f856f5 --- /dev/null +++ b/boards/common/nucleo32/Makefile.dep @@ -0,0 +1,6 @@ +ifneq (,$(filter periph_spi,$(USEMODULE))) + # The LED pin is also used for SPI + DISABLE_MODULE += periph_init_led0 +endif + +include $(RIOTBOARD)/common/nucleo/Makefile.dep diff --git a/boards/common/nucleo32/include/gpio_params.h b/boards/common/nucleo32/include/gpio_params.h index 49c91566f4c0..94f7a59e8171 100644 --- a/boards/common/nucleo32/include/gpio_params.h +++ b/boards/common/nucleo32/include/gpio_params.h @@ -26,7 +26,7 @@ extern "C" { #endif -#ifndef AUTO_INIT_LED0 +#ifndef MODULE_PERIPH_INIT_LED0 #define SAUL_GPIO_NUMOF (0U) #else /** @@ -40,7 +40,7 @@ static const saul_gpio_params_t saul_gpio_params[] = .mode = GPIO_OUT } }; -#endif /* AUTO_INIT_LED0 */ +#endif /* MODULE_PERIPH_INIT_LED0 */ #ifdef __cplusplus } diff --git a/boards/common/nucleo64/Kconfig b/boards/common/nucleo64/Kconfig index 6c26da9faa4e..3b410fb4bd60 100644 --- a/boards/common/nucleo64/Kconfig +++ b/boards/common/nucleo64/Kconfig @@ -13,5 +13,8 @@ config BOARD_COMMON_NUCLEO64 select BOARD_HAS_HSE if !CPU_FAM_G0 && !CPU_FAM_L0 && !CPU_FAM_L1 && !CPU_FAM_L4 select BOARD_HAS_LSE if !BOARD_NUCLEO_L152RE +config MODULE_PERIPH_INIT_LED0 + default n if MODULE_PERIPH_SPI + source "$(RIOTBOARD)/common/nucleo/Kconfig" source "$(RIOTBOARD)/common/stm32/Kconfig" diff --git a/boards/common/nucleo64/Makefile.dep b/boards/common/nucleo64/Makefile.dep new file mode 100644 index 000000000000..d9bc77f856f5 --- /dev/null +++ b/boards/common/nucleo64/Makefile.dep @@ -0,0 +1,6 @@ +ifneq (,$(filter periph_spi,$(USEMODULE))) + # The LED pin is also used for SPI + DISABLE_MODULE += periph_init_led0 +endif + +include $(RIOTBOARD)/common/nucleo/Makefile.dep diff --git a/boards/common/nucleo64/include/gpio_params.h b/boards/common/nucleo64/include/gpio_params.h index 6ccf29549766..b9eb9f32b83c 100644 --- a/boards/common/nucleo64/include/gpio_params.h +++ b/boards/common/nucleo64/include/gpio_params.h @@ -32,7 +32,7 @@ extern "C" { */ static const saul_gpio_params_t saul_gpio_params[] = { -#ifdef AUTO_INIT_LED0 +#ifdef MODULE_PERIPH_INIT_LED0 { .name = "LED(green)", .pin = LED0_PIN, diff --git a/boards/common/particle-mesh/board.c b/boards/common/particle-mesh/board.c index 74270ad36428..2360a264b686 100644 --- a/boards/common/particle-mesh/board.c +++ b/boards/common/particle-mesh/board.c @@ -73,14 +73,6 @@ void post_startup(void) void board_init(void) { - /* initialize the boards LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_set(LED0_PIN); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_set(LED1_PIN); - gpio_init(LED2_PIN, GPIO_OUT); - gpio_set(LED2_PIN); - gpio_init(VCTL1_PIN, GPIO_OUT); #ifdef VCTL2_PIN /* On boards without VCLT2_PIN (Boron), the VCTL2 net is driven by NOT(VCTL1) */ @@ -88,5 +80,4 @@ void board_init(void) #endif board_nrfantenna_select(BOARD_NRFANTENNA_DEFAULT); - } diff --git a/boards/common/saml1x/board.c b/boards/common/saml1x/board.c index cbc978356891..648a95c0e656 100644 --- a/boards/common/saml1x/board.c +++ b/boards/common/saml1x/board.c @@ -19,24 +19,8 @@ * @} */ -#include "cpu.h" #include "board.h" -#include "periph/gpio.h" - -void led_init(void); void board_init(void) { - /* initialize the boards LEDs */ - led_init(); - -} - -/** - * @brief Initialize the boards on-board LED - */ -void led_init(void) -{ - gpio_init(LED0_PIN, GPIO_OUT); - LED0_OFF; } diff --git a/boards/common/silabs/board_common.c b/boards/common/silabs/board_common.c index e1872656454e..cf08f48a1910 100644 --- a/boards/common/silabs/board_common.c +++ b/boards/common/silabs/board_common.c @@ -42,10 +42,6 @@ void board_common_init(void) bc_init(); #endif - /* initialize the LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - /* initialize the push buttons */ gpio_init(PB0_PIN, GPIO_IN); gpio_init(PB1_PIN, GPIO_IN); diff --git a/boards/common/sodaq/board.c b/boards/common/sodaq/board.c index 5a8fce866521..ab3edbde58ab 100644 --- a/boards/common/sodaq/board.c +++ b/boards/common/sodaq/board.c @@ -23,7 +23,4 @@ void board_init(void) { - /* initialize the on-board LED */ - gpio_init(LED0_PIN, GPIO_OUT); - } diff --git a/boards/common/weact-f4x1cx/board.c b/boards/common/weact-f4x1cx/board.c index fc772669e96c..8fcf933f6e82 100644 --- a/boards/common/weact-f4x1cx/board.c +++ b/boards/common/weact-f4x1cx/board.c @@ -56,6 +56,4 @@ mtd_dev_t *mtd0 = (mtd_dev_t *)&weact_nor_dev; void board_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); - LED0_OFF; } diff --git a/boards/dwm1001/board.c b/boards/dwm1001/board.c index dc2c9e5a6dd8..06650002025a 100644 --- a/boards/dwm1001/board.c +++ b/boards/dwm1001/board.c @@ -25,13 +25,4 @@ void board_init(void) { - /* initialize the boards LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_set(LED0_PIN); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_set(LED1_PIN); - gpio_init(LED2_PIN, GPIO_OUT); - gpio_set(LED2_PIN); - gpio_init(LED3_PIN, GPIO_OUT); - gpio_set(LED3_PIN); } diff --git a/boards/e180-zg120b-tb/board.c b/boards/e180-zg120b-tb/board.c index 183c641daa53..4c10238a8325 100644 --- a/boards/e180-zg120b-tb/board.c +++ b/boards/e180-zg120b-tb/board.c @@ -24,10 +24,6 @@ void board_init(void) { #ifndef RIOTBOOT - /* initialize the LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - /* initialize the push buttons */ gpio_init(PB0_PIN, GPIO_IN); gpio_init(PB1_PIN, GPIO_IN); diff --git a/boards/ek-lm4f120xl/board.c b/boards/ek-lm4f120xl/board.c index 9014b1f9c4f8..31b4bd8b1c0a 100644 --- a/boards/ek-lm4f120xl/board.c +++ b/boards/ek-lm4f120xl/board.c @@ -19,23 +19,7 @@ */ #include "board.h" -static void leds_init(void); void board_init(void) { - /* initialize the boards LEDs, this is done for debugging purpose */ - leds_init(); - -} - -/** - * @brief initialize the boards on-boards LEDS. - */ -static void leds_init(void) -{ - /* enable clock for PORTF */ - ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); - - /*configure the pins as general output */ - ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3); } diff --git a/boards/f4vi1/board.c b/boards/f4vi1/board.c index e0dd69a47d19..da9593f1200b 100644 --- a/boards/f4vi1/board.c +++ b/boards/f4vi1/board.c @@ -24,8 +24,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); } diff --git a/boards/feather-m0/board.c b/boards/feather-m0/board.c index 59fabea361b4..8ffc97032728 100644 --- a/boards/feather-m0/board.c +++ b/boards/feather-m0/board.c @@ -24,6 +24,4 @@ void board_init(void) { - /* initialize the on-board red LED on pin PA17 */ - gpio_init(LED0_PIN, GPIO_OUT); } diff --git a/boards/feather-nrf52840/board.c b/boards/feather-nrf52840/board.c index a424d7971a95..80108843f360 100644 --- a/boards/feather-nrf52840/board.c +++ b/boards/feather-nrf52840/board.c @@ -20,12 +20,6 @@ void board_init(void) { - /* initialize the boards LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_clear(LED0_PIN); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_clear(LED1_PIN); - } /** @} */ diff --git a/boards/firefly/board.c b/boards/firefly/board.c index 863e1a562ebc..636f560e1038 100644 --- a/boards/firefly/board.c +++ b/boards/firefly/board.c @@ -26,7 +26,6 @@ static inline void leds_init(void); void board_init(void) { - /* initialize the boards LEDs */ leds_init(); } @@ -38,10 +37,6 @@ void board_init(void) */ static inline void leds_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); - /* Shoot rainbows */ LED_RAINBOW(); } diff --git a/boards/frdm-k22f/board.c b/boards/frdm-k22f/board.c index 4874ed8d181a..26f45187c3a1 100644 --- a/boards/frdm-k22f/board.c +++ b/boards/frdm-k22f/board.c @@ -25,11 +25,4 @@ void board_init(void) { - /* initialize and turn off the on-board RGB-LED */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_set(LED0_PIN); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_set(LED1_PIN); - gpio_init(LED2_PIN, GPIO_OUT); - gpio_set(LED2_PIN); } diff --git a/boards/frdm-k64f/board.c b/boards/frdm-k64f/board.c index 785d0632f52c..a328efc479b6 100644 --- a/boards/frdm-k64f/board.c +++ b/boards/frdm-k64f/board.c @@ -27,13 +27,4 @@ void board_init(void) /* RMII RXCLK pin configuration */ SIM->SCGC5 |= SIM_SCGC5_PORTA_MASK; PORTA->PCR[18] &= ~(PORT_PCR_ISF_MASK | PORT_PCR_MUX(0x07)); - - - /* initialize and turn off the on-board RGB-LED */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); - gpio_set(LED0_PIN); - gpio_set(LED1_PIN); - gpio_set(LED2_PIN); } diff --git a/boards/frdm-kl43z/board.c b/boards/frdm-kl43z/board.c index 253325c953ab..3b6a535a41dc 100644 --- a/boards/frdm-kl43z/board.c +++ b/boards/frdm-kl43z/board.c @@ -23,9 +23,4 @@ void board_init(void) { - /* initialize and turn off the on-board RGB-LED */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_set(LED0_PIN); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_set(LED1_PIN); } diff --git a/boards/hamilton/board.c b/boards/hamilton/board.c index 8b1c4c1d87b6..bd50e0c12559 100644 --- a/boards/hamilton/board.c +++ b/boards/hamilton/board.c @@ -25,7 +25,4 @@ void board_init(void) { - /* initialize the on-board LED */ - gpio_init(LED0_PIN, GPIO_OUT); - } diff --git a/boards/hifive1/board.c b/boards/hifive1/board.c index b738361be533..7a84836d4084 100644 --- a/boards/hifive1/board.c +++ b/boards/hifive1/board.c @@ -24,13 +24,4 @@ void board_init(void) { - /* Configure GPIOs for LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); - - /* Turn all the LEDs off */ - LED0_OFF; - LED1_OFF; - LED2_OFF; } diff --git a/boards/hifive1b/board.c b/boards/hifive1b/board.c index 792485988c9f..c4b97df284b7 100644 --- a/boards/hifive1b/board.c +++ b/boards/hifive1b/board.c @@ -24,13 +24,4 @@ void board_init(void) { - /* Configure GPIOs for LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); - - /* Turn all the LEDs off */ - LED0_OFF; - LED1_OFF; - LED2_OFF; } diff --git a/boards/ikea-tradfri/board.c b/boards/ikea-tradfri/board.c index 2b7df58d599d..42786d08cab2 100644 --- a/boards/ikea-tradfri/board.c +++ b/boards/ikea-tradfri/board.c @@ -55,12 +55,6 @@ mtd_dev_t *mtd0 = (mtd_dev_t *)&ikea_tradfri_nor_dev; void board_init(void) { -#ifndef RIOTBOOT - /* initialize the LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); -#endif - #ifdef MODULE_MTD /* enable NOR flash (only on the ICC-1-A) */ if (gpio_is_valid(IKEA_TRADFRI_NOR_EN)) { diff --git a/boards/limifrog-v1/board.c b/boards/limifrog-v1/board.c index 7bf9cbe4eb5b..65a158d92528 100644 --- a/boards/limifrog-v1/board.c +++ b/boards/limifrog-v1/board.c @@ -23,6 +23,4 @@ void board_init(void) { - /* initialize the boards LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); } diff --git a/boards/lobaro-lorabox/board.c b/boards/lobaro-lorabox/board.c index fb67d1867a3e..e936e3abdf2e 100644 --- a/boards/lobaro-lorabox/board.c +++ b/boards/lobaro-lorabox/board.c @@ -22,6 +22,5 @@ void board_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); gpio_init(EN3V3_PIN, GPIO_OUT); } diff --git a/boards/lora-e5-dev/board.c b/boards/lora-e5-dev/board.c index b3a9421aad4d..1f8e9fbaedc3 100644 --- a/boards/lora-e5-dev/board.c +++ b/boards/lora-e5-dev/board.c @@ -30,12 +30,6 @@ void board_init(void) { - /* initialization of on-board LEDs */ -#ifdef AUTO_INIT_LED0 - gpio_init(LED0_PIN, GPIO_OUT); - LED0_OFF; -#endif - if(IS_ACTIVE(CONFIG_LORA_E5_DEV_ENABLE_3P3V)) { gpio_init(LORA_E5_DEV_3P3V_ENABLE_PIN, GPIO_OUT); gpio_set(LORA_E5_DEV_3P3V_ENABLE_PIN); diff --git a/boards/lora-e5-dev/include/board.h b/boards/lora-e5-dev/include/board.h index 5e18636b6a7b..55f3efd16d64 100644 --- a/boards/lora-e5-dev/include/board.h +++ b/boards/lora-e5-dev/include/board.h @@ -54,15 +54,6 @@ extern void lora_e5_dev_sx126x_set_rf_mode(sx126x_t *dev, sx126x_rf_mode_t rf_mo #define LED0_TOGGLE (LED0_PORT->ODR ^= LED0_MASK) /** @} */ -/** - * @brief Lora-E5-Dev always use LED0, as there is no dual use of its pin - * @{ - */ -#ifndef AUTO_INIT_LED0 -#define AUTO_INIT_LED0 -#endif -/** @} */ - /** * @name User button * @{ diff --git a/boards/lora-e5-dev/include/gpio_params.h b/boards/lora-e5-dev/include/gpio_params.h index 9c579ceb7fdb..de7ff3b933f8 100644 --- a/boards/lora-e5-dev/include/gpio_params.h +++ b/boards/lora-e5-dev/include/gpio_params.h @@ -32,13 +32,11 @@ extern "C" { */ static const saul_gpio_params_t saul_gpio_params[] = { -#ifdef AUTO_INIT_LED0 { .name = "LED(red)", .pin = LED0_PIN, .mode = GPIO_OUT }, -#endif { .name = "Button(B1 Boot)", .pin = BTN0_PIN, diff --git a/boards/maple-mini/board.c b/boards/maple-mini/board.c index d0873d6442d4..64f4bc462ace 100644 --- a/boards/maple-mini/board.c +++ b/boards/maple-mini/board.c @@ -23,6 +23,4 @@ void board_init(void) { - /* initialize the boards LED */ - gpio_init(LED0_PIN, GPIO_OUT); } diff --git a/boards/mbed_lpc1768/board.c b/boards/mbed_lpc1768/board.c index e9a90546cd0e..2b3c67ee8d3b 100644 --- a/boards/mbed_lpc1768/board.c +++ b/boards/mbed_lpc1768/board.c @@ -25,26 +25,8 @@ extern void SystemInit(void); -/** - * @brief Initialize the on-board LEDs. - */ -static void leds_init(void) -{ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); - gpio_init(LED3_PIN, GPIO_OUT); - - LED0_OFF; - LED1_OFF; - LED2_OFF; - LED3_OFF; -} - void board_init(void) { /* initialize core clocks via CMSIS function */ SystemInit(); - /* initialize the boards LEDs */ - leds_init(); } diff --git a/boards/mcb2388/board_init.c b/boards/mcb2388/board_init.c index 77b1a0ca14a3..856ae5899892 100644 --- a/boards/mcb2388/board_init.c +++ b/boards/mcb2388/board_init.c @@ -24,7 +24,6 @@ #include "cpu.h" #include "mtd.h" #include "periph/init.h" -#include "stdio_base.h" #ifdef MODULE_MTD_MCI extern const mtd_desc_t mtd_mci_driver; @@ -34,7 +33,4 @@ mtd_dev_t *mtd0 = &_mtd_mci; void board_init(void) { - /* LEDS */ - FIO2DIR |= LED0_MASK | LED1_MASK | LED2_MASK | LED3_MASK \ - | LED4_MASK | LED5_MASK | LED6_MASK | LED7_MASK; } diff --git a/boards/mega-xplained/led_init.c b/boards/mega-xplained/led_init.c deleted file mode 100644 index a45924cc0854..000000000000 --- a/boards/mega-xplained/led_init.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen - * 2015-18 Kaspar Schleiser - * 2016 Laurent Navet - * 2018 Matthew Blue - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup boards_mega-xplained - * @{ - * - * @file - * @brief Board specific implementation for the Mega Xplained - * - * @author Hinnerk van Bruinehsen - * @author Kaspar Schleiser - * @author Laurent Navet - * @author Matthew Blue - * - * @} - */ - -#include "board.h" - -void led_init(void) -{ - /* LED0,2 currently unsupported due to lack of GPIO_OD support */ - - LED1_ENABLE_PORT; - LED1_OFF; - - LED3_ENABLE_PORT; - LED3_OFF; -} diff --git a/boards/msba2/board_init.c b/boards/msba2/board_init.c index bffbfee3a425..f5c2411e9a4e 100644 --- a/boards/msba2/board_init.c +++ b/boards/msba2/board_init.c @@ -38,10 +38,4 @@ mtd_dev_t *mtd0 = &_mtd_mci; void board_init(void) { - /* LEDS */ - FIO3DIR |= LED0_MASK; - FIO3DIR |= LED1_MASK; - - LED0_OFF; - LED0_OFF; } diff --git a/boards/msbiot/board.c b/boards/msbiot/board.c index 74e925e2a5a3..ed68fcad54e0 100644 --- a/boards/msbiot/board.c +++ b/boards/msbiot/board.c @@ -25,7 +25,6 @@ static void gpios_init(void); void board_init(void) { - /* initialize the boards LEDs */ gpios_init(); } @@ -44,9 +43,6 @@ void board_init(void) */ static void gpios_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); gpio_init(BUTTON0_PIN, GPIO_IN); gpio_init(BUTTON1_PIN, GPIO_IN); } diff --git a/boards/mulle/board.c b/boards/mulle/board.c index e9d5a9e047e3..c1c4d2876e73 100644 --- a/boards/mulle/board.c +++ b/boards/mulle/board.c @@ -93,10 +93,6 @@ void board_init(void) { int status; - /* initialize the boards LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); /* Initialize power control pins */ power_pins_init(); diff --git a/boards/native/board_init.c b/boards/native/board_init.c index a50e5f130c88..6f91c5c515d7 100644 --- a/boards/native/board_init.c +++ b/boards/native/board_init.c @@ -78,8 +78,5 @@ VFS_AUTO_MOUNT(fatfs, VFS_MTD(mtd0_dev), "/nvm", 0); */ void board_init(void) { - LED0_OFF; - LED1_ON; - puts("RIOT native board initialized."); } diff --git a/boards/nrf51dk/board.c b/boards/nrf51dk/board.c index 9afd7dcc73b6..f39d6d3ee9d0 100644 --- a/boards/nrf51dk/board.c +++ b/boards/nrf51dk/board.c @@ -23,20 +23,9 @@ void board_init(void) { - /* initialize the board LEDs, set pins as output and turn LEDs off */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); - gpio_init(LED3_PIN, GPIO_OUT); - gpio_set(LED0_PIN); - gpio_set(LED1_PIN); - gpio_set(LED2_PIN); - gpio_set(LED3_PIN); - /* initialize the board buttons */ gpio_init(BTN0_PIN, BTN0_MODE); gpio_init(BTN1_PIN, BTN1_MODE); gpio_init(BTN2_PIN, BTN2_MODE); gpio_init(BTN3_PIN, BTN3_MODE); - } diff --git a/boards/nrf51dongle/board.c b/boards/nrf51dongle/board.c index bd6ca1debf1e..f391dfc120e3 100644 --- a/boards/nrf51dongle/board.c +++ b/boards/nrf51dongle/board.c @@ -23,9 +23,5 @@ void board_init(void) { - /* initialize the boards LEDs, set pins as output and turn LEDs off */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); } diff --git a/boards/nrf52832-mdk/board.c b/boards/nrf52832-mdk/board.c index 7f0dcdc516b3..dd4aeeed2cab 100644 --- a/boards/nrf52832-mdk/board.c +++ b/boards/nrf52832-mdk/board.c @@ -25,12 +25,5 @@ void board_init(void) { - /* initialize the boards LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_set(LED0_PIN); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_set(LED1_PIN); - gpio_init(LED2_PIN, GPIO_OUT); - gpio_set(LED2_PIN); } diff --git a/boards/nrf52840-mdk-dongle/board.c b/boards/nrf52840-mdk-dongle/board.c index 819eb06d9221..2e133cba0fc1 100644 --- a/boards/nrf52840-mdk-dongle/board.c +++ b/boards/nrf52840-mdk-dongle/board.c @@ -25,12 +25,5 @@ void board_init(void) { - /* initialize the board's RGB LED */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_set(LED0_PIN); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_set(LED1_PIN); - gpio_init(LED2_PIN, GPIO_OUT); - gpio_set(LED2_PIN); } diff --git a/boards/nrf52840-mdk/board.c b/boards/nrf52840-mdk/board.c index 930a08fdaaf2..a089a38d1cd6 100644 --- a/boards/nrf52840-mdk/board.c +++ b/boards/nrf52840-mdk/board.c @@ -25,12 +25,5 @@ void board_init(void) { - /* initialize the boards LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_set(LED0_PIN); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_set(LED1_PIN); - gpio_init(LED2_PIN, GPIO_OUT); - gpio_set(LED2_PIN); } diff --git a/boards/nrf52840dongle/board.c b/boards/nrf52840dongle/board.c index fc12b6507f58..066d6ad877d2 100644 --- a/boards/nrf52840dongle/board.c +++ b/boards/nrf52840dongle/board.c @@ -25,16 +25,6 @@ void board_init(void) { - /* initialize the board's single LED */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_set(LED0_PIN); - /* initialize the board's RGB LED */ - gpio_init(LED1_PIN, GPIO_OUT); - gpio_set(LED1_PIN); - gpio_init(LED2_PIN, GPIO_OUT); - gpio_set(LED2_PIN); - gpio_init(LED3_PIN, GPIO_OUT); - gpio_set(LED3_PIN); } diff --git a/boards/nrf6310/board.c b/boards/nrf6310/board.c index b6023693fd03..3df8edffc87c 100644 --- a/boards/nrf6310/board.c +++ b/boards/nrf6310/board.c @@ -28,5 +28,4 @@ void board_init(void) /* initialize and turn off on-board LEDs */ NRF_GPIO->DIRSET = (LED0_MASK | LED1_MASK | LED2_MASK); NRF_GPIO->OUTSET = (LED0_MASK | LED1_MASK | LED2_MASK); - } diff --git a/boards/nrf9160dk/board.c b/boards/nrf9160dk/board.c index cb6c6d09c79c..3da2963715ff 100644 --- a/boards/nrf9160dk/board.c +++ b/boards/nrf9160dk/board.c @@ -24,14 +24,6 @@ void board_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); - gpio_clear(LED0_PIN); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_clear(LED1_PIN); - gpio_init(LED2_PIN, GPIO_OUT); - gpio_clear(LED2_PIN); - gpio_init(LED3_PIN, GPIO_OUT); - gpio_clear(LED3_PIN); gpio_init(BTN0_PIN, BTN0_MODE); gpio_init(BTN1_PIN, BTN1_MODE); diff --git a/boards/nucleo-f030r8/Makefile.dep b/boards/nucleo-f030r8/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-f030r8/Makefile.dep +++ b/boards/nucleo-f030r8/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-f031k6/Makefile.dep b/boards/nucleo-f031k6/Makefile.dep index 729485827299..8db84f184d45 100644 --- a/boards/nucleo-f031k6/Makefile.dep +++ b/boards/nucleo-f031k6/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo32/Makefile.dep diff --git a/boards/nucleo-f042k6/Makefile.dep b/boards/nucleo-f042k6/Makefile.dep index 729485827299..8db84f184d45 100644 --- a/boards/nucleo-f042k6/Makefile.dep +++ b/boards/nucleo-f042k6/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo32/Makefile.dep diff --git a/boards/nucleo-f070rb/Makefile.dep b/boards/nucleo-f070rb/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-f070rb/Makefile.dep +++ b/boards/nucleo-f070rb/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-f072rb/Makefile.dep b/boards/nucleo-f072rb/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-f072rb/Makefile.dep +++ b/boards/nucleo-f072rb/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-f091rc/Makefile.dep b/boards/nucleo-f091rc/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-f091rc/Makefile.dep +++ b/boards/nucleo-f091rc/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-f103rb/Makefile.dep b/boards/nucleo-f103rb/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-f103rb/Makefile.dep +++ b/boards/nucleo-f103rb/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-f302r8/Makefile.dep b/boards/nucleo-f302r8/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-f302r8/Makefile.dep +++ b/boards/nucleo-f302r8/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-f303k8/Makefile.dep b/boards/nucleo-f303k8/Makefile.dep index 729485827299..8db84f184d45 100644 --- a/boards/nucleo-f303k8/Makefile.dep +++ b/boards/nucleo-f303k8/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo32/Makefile.dep diff --git a/boards/nucleo-f303re/Makefile.dep b/boards/nucleo-f303re/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-f303re/Makefile.dep +++ b/boards/nucleo-f303re/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-f334r8/Makefile.dep b/boards/nucleo-f334r8/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-f334r8/Makefile.dep +++ b/boards/nucleo-f334r8/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-f401re/Makefile.dep b/boards/nucleo-f401re/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-f401re/Makefile.dep +++ b/boards/nucleo-f401re/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-f410rb/Makefile.dep b/boards/nucleo-f410rb/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-f410rb/Makefile.dep +++ b/boards/nucleo-f410rb/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-f411re/Makefile.dep b/boards/nucleo-f411re/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-f411re/Makefile.dep +++ b/boards/nucleo-f411re/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-f446re/Makefile.dep b/boards/nucleo-f446re/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-f446re/Makefile.dep +++ b/boards/nucleo-f446re/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-g070rb/Makefile.dep b/boards/nucleo-g070rb/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-g070rb/Makefile.dep +++ b/boards/nucleo-g070rb/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-g071rb/Makefile.dep b/boards/nucleo-g071rb/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-g071rb/Makefile.dep +++ b/boards/nucleo-g071rb/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-g431rb/Makefile.dep b/boards/nucleo-g431rb/Makefile.dep index 2f80f9d9bb96..d74edbdf58b0 100644 --- a/boards/nucleo-g431rb/Makefile.dep +++ b/boards/nucleo-g431rb/Makefile.dep @@ -1,4 +1,5 @@ ifneq (,$(filter stdio_uart,$(USEMODULE))) FEATURES_REQUIRED += periph_lpuart endif -include $(RIOTBOARD)/common/nucleo/Makefile.dep + +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-g474re/Makefile.dep b/boards/nucleo-g474re/Makefile.dep index 2f80f9d9bb96..d74edbdf58b0 100644 --- a/boards/nucleo-g474re/Makefile.dep +++ b/boards/nucleo-g474re/Makefile.dep @@ -1,4 +1,5 @@ ifneq (,$(filter stdio_uart,$(USEMODULE))) FEATURES_REQUIRED += periph_lpuart endif -include $(RIOTBOARD)/common/nucleo/Makefile.dep + +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-l011k4/Makefile.dep b/boards/nucleo-l011k4/Makefile.dep index cb66ca7c2b86..d912f15ffc30 100644 --- a/boards/nucleo-l011k4/Makefile.dep +++ b/boards/nucleo-l011k4/Makefile.dep @@ -1,4 +1,4 @@ # Use Picolibc to reduce ROM usage FEATURES_REQUIRED += picolibc -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo32/Makefile.dep diff --git a/boards/nucleo-l031k6/Makefile.dep b/boards/nucleo-l031k6/Makefile.dep index 729485827299..8db84f184d45 100644 --- a/boards/nucleo-l031k6/Makefile.dep +++ b/boards/nucleo-l031k6/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo32/Makefile.dep diff --git a/boards/nucleo-l053r8/Makefile.dep b/boards/nucleo-l053r8/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-l053r8/Makefile.dep +++ b/boards/nucleo-l053r8/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-l073rz/Makefile.dep b/boards/nucleo-l073rz/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-l073rz/Makefile.dep +++ b/boards/nucleo-l073rz/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-l152re/Makefile.dep b/boards/nucleo-l152re/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-l152re/Makefile.dep +++ b/boards/nucleo-l152re/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-l412kb/Makefile.dep b/boards/nucleo-l412kb/Makefile.dep index 729485827299..8db84f184d45 100644 --- a/boards/nucleo-l412kb/Makefile.dep +++ b/boards/nucleo-l412kb/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo32/Makefile.dep diff --git a/boards/nucleo-l432kc/Makefile.dep b/boards/nucleo-l432kc/Makefile.dep index 729485827299..8db84f184d45 100644 --- a/boards/nucleo-l432kc/Makefile.dep +++ b/boards/nucleo-l432kc/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo32/Makefile.dep diff --git a/boards/nucleo-l433rc/Makefile.dep b/boards/nucleo-l433rc/Makefile.dep index 2f80f9d9bb96..d74edbdf58b0 100644 --- a/boards/nucleo-l433rc/Makefile.dep +++ b/boards/nucleo-l433rc/Makefile.dep @@ -1,4 +1,5 @@ ifneq (,$(filter stdio_uart,$(USEMODULE))) FEATURES_REQUIRED += periph_lpuart endif -include $(RIOTBOARD)/common/nucleo/Makefile.dep + +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-l452re/Makefile.dep b/boards/nucleo-l452re/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-l452re/Makefile.dep +++ b/boards/nucleo-l452re/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-l476rg/Makefile.dep b/boards/nucleo-l476rg/Makefile.dep index 729485827299..dbfbd3bd2044 100644 --- a/boards/nucleo-l476rg/Makefile.dep +++ b/boards/nucleo-l476rg/Makefile.dep @@ -1 +1 @@ -include $(RIOTBOARD)/common/nucleo/Makefile.dep +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-wl55jc/Makefile.dep b/boards/nucleo-wl55jc/Makefile.dep index cd146179a374..8c23bb7579c1 100644 --- a/boards/nucleo-wl55jc/Makefile.dep +++ b/boards/nucleo-wl55jc/Makefile.dep @@ -7,4 +7,5 @@ endif ifneq (,$(filter sx126x_stm32wl,$(USEMODULE))) USEMODULE += sx126x_rf_switch endif -include $(RIOTBOARD)/common/nucleo/Makefile.dep + +include $(RIOTBOARD)/common/nucleo64/Makefile.dep diff --git a/boards/nucleo-wl55jc/board.c b/boards/nucleo-wl55jc/board.c index 1e3865df0a34..49fe7bd9a574 100644 --- a/boards/nucleo-wl55jc/board.c +++ b/boards/nucleo-wl55jc/board.c @@ -26,9 +26,6 @@ void board_init(void) { - /* initialize the CPU */ - board_common_nucleo_init(); - if (IS_USED(MODULE_SX126X_STM32WL)) { /* Initialize the GPIO control for RF 3-port switch (SP3T) */ gpio_init(FE_CTRL1, GPIO_OUT); diff --git a/boards/nucleo-wl55jc/include/board.h b/boards/nucleo-wl55jc/include/board.h index 503b5adcfbbf..7f20224a1672 100644 --- a/boards/nucleo-wl55jc/include/board.h +++ b/boards/nucleo-wl55jc/include/board.h @@ -70,15 +70,6 @@ extern void nucleo_wl55jc_sx126x_set_rf_mode(sx126x_t *dev, sx126x_rf_mode_t rf_ #define LED2_TOGGLE (LED0_PORT->ODR ^= LED2_MASK) /** @} */ -/** - * @brief Nucleo-wl55jc always use LED0, as there is no dual use of its pin - * @{ - */ -#ifndef AUTO_INIT_LED0 -#define AUTO_INIT_LED0 -#endif -/** @} */ - /** * @name User button * @{ diff --git a/boards/nucleo-wl55jc/include/gpio_params.h b/boards/nucleo-wl55jc/include/gpio_params.h index f464422bb3c7..dd2c080b9a9f 100644 --- a/boards/nucleo-wl55jc/include/gpio_params.h +++ b/boards/nucleo-wl55jc/include/gpio_params.h @@ -33,13 +33,11 @@ extern "C" { */ static const saul_gpio_params_t saul_gpio_params[] = { -#ifdef AUTO_INIT_LED0 { .name = "LED(blue)", .pin = LED0_PIN, .mode = GPIO_OUT }, -#endif { .name = "LED(green)", .pin = LED1_PIN, diff --git a/boards/nz32-sc151/board.c b/boards/nz32-sc151/board.c index 7524880a5bb0..96347ad85acf 100644 --- a/boards/nz32-sc151/board.c +++ b/boards/nz32-sc151/board.c @@ -23,6 +23,4 @@ void board_init(void) { - /* initialize the boards LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); } diff --git a/boards/olimexino-stm32/board.c b/boards/olimexino-stm32/board.c index ae345ae13c6e..57b9eb4e4585 100644 --- a/boards/olimexino-stm32/board.c +++ b/boards/olimexino-stm32/board.c @@ -21,9 +21,6 @@ void board_init(void) { - /* initialize the boards LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); /* initialize the button */ gpio_init(BTN0_PIN, BTN0_MODE); diff --git a/boards/omote/board.c b/boards/omote/board.c index 527f2b882f9f..55e6e5fb9bf6 100644 --- a/boards/omote/board.c +++ b/boards/omote/board.c @@ -18,26 +18,10 @@ #include "board.h" #include "cpu.h" -static inline void leds_init(void); - void board_init(void) { - /* initialize the boards LEDs */ - leds_init(); /* The boot pin must be set to input otherwise it may lock the bootloader */ gpio_init(BOOT_PIN, GPIO_IN); gpio_init(BTN0_PIN, BTN0_MODE); } - -/** - * @brief Initialize the boards on-board LEDs - * - * The LED initialization is hard-coded in this function. As the LEDs are - * soldered onto the board they are fixed to their CPU pins. - */ -static inline void leds_init(void) -{ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); -} diff --git a/boards/opencm904/board.c b/boards/opencm904/board.c index db5e3768db7c..1f003c9a0678 100644 --- a/boards/opencm904/board.c +++ b/boards/opencm904/board.c @@ -24,9 +24,6 @@ void board_init(void) { - /* initialize the board's LED */ - gpio_init(LED0_PIN, GPIO_OUT); - LED0_OFF; /* disable bootloader's USB */ RCC->APB1ENR &= ~RCC_APB1ENR_USBEN; diff --git a/boards/openlabs-kw41z-mini/board.c b/boards/openlabs-kw41z-mini/board.c index a2dc95e8dec0..b0a5bb5e2b2b 100644 --- a/boards/openlabs-kw41z-mini/board.c +++ b/boards/openlabs-kw41z-mini/board.c @@ -24,9 +24,6 @@ void board_init(void) { - /* initialize and turn off LEDs */ - LED0_OFF; - gpio_init(LED0_PIN, GPIO_OUT); /* enable OSCERCLK output on PTB3 */ #if PTB3_OUTPUT_OSCERCLK diff --git a/boards/openmote-b/board.c b/boards/openmote-b/board.c index 1b2ef1a1c996..9550cebef80a 100644 --- a/boards/openmote-b/board.c +++ b/boards/openmote-b/board.c @@ -24,11 +24,6 @@ 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); /* The boot pin must be set to input otherwise it may lock the bootloader */ gpio_init(BOOT_PIN, GPIO_IN); diff --git a/boards/openmote-cc2538/board.c b/boards/openmote-cc2538/board.c index 37e301a07a8c..388f1861799d 100644 --- a/boards/openmote-cc2538/board.c +++ b/boards/openmote-cc2538/board.c @@ -23,10 +23,5 @@ 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); } diff --git a/boards/p-l496g-cell02/board.c b/boards/p-l496g-cell02/board.c index f7f7631a3621..e4dc396e41fa 100644 --- a/boards/p-l496g-cell02/board.c +++ b/boards/p-l496g-cell02/board.c @@ -23,7 +23,4 @@ void board_init(void) { - /* initialize LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); } diff --git a/boards/p-nucleo-wb55/include/board.h b/boards/p-nucleo-wb55/include/board.h index 3a4cb5021b40..e4a7eeb3be95 100644 --- a/boards/p-nucleo-wb55/include/board.h +++ b/boards/p-nucleo-wb55/include/board.h @@ -51,12 +51,6 @@ extern "C" { #define LED2_TOGGLE (LED0_PORT->ODR ^= LED2_MASK) /** @} */ -/* p-nucleo-wb55 always use LED0, as there is no dual use of its pin */ -#ifndef AUTO_INIT_LED0 -#define AUTO_INIT_LED0 -#endif -/** @} */ - /** * @name User button * @{ diff --git a/boards/p-nucleo-wb55/include/gpio_params.h b/boards/p-nucleo-wb55/include/gpio_params.h index 3dece7f8f682..b020a880adee 100644 --- a/boards/p-nucleo-wb55/include/gpio_params.h +++ b/boards/p-nucleo-wb55/include/gpio_params.h @@ -33,13 +33,11 @@ extern "C" { */ static const saul_gpio_params_t saul_gpio_params[] = { -#ifdef AUTO_INIT_LED0 { .name = "LED(blue)", .pin = LED0_PIN, .mode = GPIO_OUT }, -#endif { .name = "LED(green)", .pin = LED1_PIN, diff --git a/boards/pba-d-01-kw2x/board.c b/boards/pba-d-01-kw2x/board.c index ba4241931cda..da6273944d44 100644 --- a/boards/pba-d-01-kw2x/board.c +++ b/boards/pba-d-01-kw2x/board.c @@ -56,14 +56,5 @@ static inline void modem_clock_init(void) void board_init(void) { - /* initialize the on-board LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_set(LED0_PIN); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_set(LED1_PIN); - gpio_init(LED2_PIN, GPIO_OUT); - gpio_set(LED2_PIN); - modem_clock_init(); - } diff --git a/boards/phynode-kw41z/board.c b/boards/phynode-kw41z/board.c index c3fce2b7c4f9..f13d75a4c838 100644 --- a/boards/phynode-kw41z/board.c +++ b/boards/phynode-kw41z/board.c @@ -25,23 +25,6 @@ void board_init(void) { - /* initialize and turn off LEDs */ -#ifdef LED0_PIN - gpio_init(LED0_PIN, GPIO_OUT); - gpio_set(LED0_PIN); -#endif -#ifdef LED1_PIN - gpio_init(LED1_PIN, GPIO_OUT); - gpio_set(LED1_PIN); -#endif -#ifdef LED2_PIN - gpio_init(LED2_PIN, GPIO_OUT); - gpio_set(LED2_PIN); -#endif -#ifdef LED3_PIN - gpio_init(LED3_PIN, GPIO_OUT); - gpio_set(LED3_PIN); -#endif /* If further modules are supported (e.g. HDC1010 sensor or the EPD) they have * to be added here so V_PERIPH pin is set and the devices are powered */ #if defined(MODULE_MMA8X5X) || defined(MODULE_TCS37727) || \ diff --git a/boards/pic32-wifire/wifire.c b/boards/pic32-wifire/wifire.c index 368f34e5ebe9..1565a3dc57a7 100644 --- a/boards/pic32-wifire/wifire.c +++ b/boards/pic32-wifire/wifire.c @@ -20,14 +20,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); - gpio_init(LED3_PIN, GPIO_OUT); - gpio_init(LED4_PIN, GPIO_OUT); - LED1_OFF; - LED2_OFF; - LED3_OFF; - LED4_OFF; /* Stop the linker from throwing away the PIC32 config register settings */ diff --git a/boards/pyboard/board.c b/boards/pyboard/board.c index 8d02322843e4..4c2911d6cbc8 100644 --- a/boards/pyboard/board.c +++ b/boards/pyboard/board.c @@ -25,6 +25,4 @@ void board_init(void) { - /* initialize LED */ - gpio_init(LED0_PIN, GPIO_OUT); } diff --git a/boards/qn9080dk/board.c b/boards/qn9080dk/board.c index 93ecd63ae08b..6af89542d449 100644 --- a/boards/qn9080dk/board.c +++ b/boards/qn9080dk/board.c @@ -61,9 +61,6 @@ mtd_dev_t *mtd0 = (mtd_dev_t *)&mtd_nor_dev; void board_init(void) { /* Initialize LEDs and Buttons. */ - gpio_init(LED_RED_PIN, GPIO_OUT); - gpio_init(LED_GREEN_PIN, GPIO_OUT); - gpio_init(LED_BLUE_PIN, GPIO_OUT); gpio_init(BTN1_PIN, BTN1_MODE); gpio_init(BTN2_PIN, BTN2_MODE); diff --git a/boards/remote-pa/board.c b/boards/remote-pa/board.c index 38f652002fdc..a6db0ee14c0a 100644 --- a/boards/remote-pa/board.c +++ b/boards/remote-pa/board.c @@ -28,10 +28,6 @@ static inline void rf_switch_init(void); 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); /* initialize the 2.4GHz RF switch */ diff --git a/boards/remote-reva/board.c b/boards/remote-reva/board.c index 7e35f183893b..8bd82bb1f4de 100644 --- a/boards/remote-reva/board.c +++ b/boards/remote-reva/board.c @@ -29,7 +29,6 @@ static inline void rf_switch_init(void); void board_init(void) { - /* initialize the boards LEDs */ leds_init(); /* initialize the 2.4GHz RF switch */ rf_switch_init(); @@ -43,10 +42,6 @@ void board_init(void) */ static inline void leds_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); - /* Shoot rainbows */ LED_RAINBOW(); } diff --git a/boards/remote-revb/board.c b/boards/remote-revb/board.c index 662cab0c2eea..0d8c41c9727d 100644 --- a/boards/remote-revb/board.c +++ b/boards/remote-revb/board.c @@ -29,7 +29,6 @@ static inline void rf_switch_init(void); void board_init(void) { - /* initialize the boards LEDs */ leds_init(); /* initialize the 2.4GHz RF switch */ rf_switch_init(); @@ -43,9 +42,6 @@ void board_init(void) */ static inline void leds_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); /* Shoot rainbows */ LED_RAINBOW(); diff --git a/boards/rpi-pico/board.c b/boards/rpi-pico/board.c index 007302c69290..730c9dd4c224 100644 --- a/boards/rpi-pico/board.c +++ b/boards/rpi-pico/board.c @@ -22,5 +22,4 @@ void board_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); } diff --git a/boards/samd10-xmini/board.c b/boards/samd10-xmini/board.c index 716abc7b86b6..8cccd775f4ec 100644 --- a/boards/samd10-xmini/board.c +++ b/boards/samd10-xmini/board.c @@ -23,8 +23,6 @@ void board_init(void) { - /* initialize the on-board LED */ - gpio_init(LED0_PIN, GPIO_OUT); /* initialize the on-board button */ gpio_init(BTN0_PIN, BTN0_MODE); diff --git a/boards/samd20-xpro/board.c b/boards/samd20-xpro/board.c index c2ee17f71ac8..9c5ee9c8b531 100644 --- a/boards/samd20-xpro/board.c +++ b/boards/samd20-xpro/board.c @@ -23,9 +23,6 @@ void board_init(void) { - /* initialize the on-board LED */ - gpio_init(LED0_PIN, GPIO_OUT); - LED0_OFF; /* initialize the on-board button */ gpio_init(BTN0_PIN, BTN0_MODE); diff --git a/boards/samd21-xpro/board.c b/boards/samd21-xpro/board.c index 990d4fd48610..c0d9e9693bd0 100644 --- a/boards/samd21-xpro/board.c +++ b/boards/samd21-xpro/board.c @@ -26,9 +26,6 @@ void board_init(void) { - /* initialize the on-board LED */ - gpio_init(LED0_PIN, GPIO_OUT); - LED0_OFF; /* initialize the on-board button */ gpio_init(BTN0_PIN, BTN0_MODE); diff --git a/boards/same54-xpro/board.c b/boards/same54-xpro/board.c index 680fdbc02cfc..0b8597d004af 100644 --- a/boards/same54-xpro/board.c +++ b/boards/same54-xpro/board.c @@ -70,11 +70,6 @@ VFS_AUTO_MOUNT(littlefs2, VFS_MTD(same54_nor_dev), "/nvm", 0); void board_init(void) { - /* initialize the on-board LED */ - gpio_init(LED0_PIN, GPIO_OUT); - LED0_OFF; - /* initialize the on-board button */ gpio_init(BTN0_PIN, BTN0_MODE); - } diff --git a/boards/saml21-xpro/board.c b/boards/saml21-xpro/board.c index 10ce3839e694..bcd95d5eed6f 100644 --- a/boards/saml21-xpro/board.c +++ b/boards/saml21-xpro/board.c @@ -21,25 +21,8 @@ * @} */ -#include - #include "board.h" -#include "cpu.h" -#include "periph/gpio.h" - -void led_init(void); void board_init(void) { - /* initialize the boards LEDs */ - led_init(); -} - -/** - * @brief Initialize the boards on-board LED - */ -void led_init(void) -{ - gpio_init(LED0_PIN, GPIO_OUT); - LED0_OFF; } diff --git a/boards/samr21-xpro/board.c b/boards/samr21-xpro/board.c index 49c20e21d8bf..b37e5ef73ea0 100644 --- a/boards/samr21-xpro/board.c +++ b/boards/samr21-xpro/board.c @@ -37,9 +37,6 @@ void board_antenna_config(uint8_t antenna) void board_init(void) { - /* initialize the on-board LED */ - gpio_init(LED0_PIN, GPIO_OUT); - LED0_OFF; /* initialize the on-board antenna switch */ if (IS_USED(MODULE_AT86RF233)) { diff --git a/boards/samr30-xpro/board.c b/boards/samr30-xpro/board.c index 8a9f7036a6a2..b86c52dc37b9 100644 --- a/boards/samr30-xpro/board.c +++ b/boards/samr30-xpro/board.c @@ -26,8 +26,6 @@ #include "cpu.h" #include "periph/gpio.h" -void led_init(void); - void board_antenna_config(uint8_t antenna) { if (antenna == RFCTL_ANTENNA_EXT){ @@ -42,23 +40,9 @@ void board_antenna_config(uint8_t antenna) void board_init(void) { - /* initialize the boards LEDs */ - led_init(); - /* initialize the on-board antenna switch */ gpio_init(RFCTL1_PIN, GPIO_OUT); gpio_init(RFCTL2_PIN, GPIO_OUT); /* set default antenna switch configuration */ board_antenna_config(RFCTL_ANTENNA_DEFAULT); } - -/** - * @brief Initialize the boards on-board LED - */ -void led_init(void) -{ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_set(LED0_PIN); /* gpio is inverted => clear */ - gpio_init(LED1_PIN, GPIO_OUT); - gpio_set(LED1_PIN); /* gpio is inverted => clear */ -} diff --git a/boards/samr34-xpro/board.c b/boards/samr34-xpro/board.c index b050c41b7abe..fbb680679653 100644 --- a/boards/samr34-xpro/board.c +++ b/boards/samr34-xpro/board.c @@ -29,13 +29,8 @@ #include "sx127x_params.h" #endif -void led_init(void); - void board_init(void) { - /* initialize the boards LEDs */ - led_init(); - /* initialize board specific pins for LoRa */ #ifdef MODULE_SX127X gpio_init(TCXO_PWR_PIN, GPIO_OUT); @@ -44,14 +39,3 @@ void board_init(void) gpio_write(TX_OUTPUT_SEL_PIN, !SX127X_PARAM_PASELECT); #endif /* USEMODULE_SX127X */ } - -/** - * @brief Initialize the boards on-board LED - */ -void led_init(void) -{ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_set(LED0_PIN); /* gpio is inverted => clear */ - gpio_init(LED1_PIN, GPIO_OUT); - gpio_set(LED1_PIN); /* gpio is inverted => clear */ -} diff --git a/boards/seeeduino_arch-pro/board.c b/boards/seeeduino_arch-pro/board.c index 24925e4282b7..b962a7db4f03 100644 --- a/boards/seeeduino_arch-pro/board.c +++ b/boards/seeeduino_arch-pro/board.c @@ -25,26 +25,8 @@ extern void SystemInit(void); -/** - * @brief Initialize the on-board LEDs. - */ -static void leds_init(void) -{ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); - gpio_init(LED3_PIN, GPIO_OUT); - - LED0_OFF; - LED1_OFF; - LED2_OFF; - LED3_OFF; -} - void board_init(void) { /* initialize core clocks via CMSIS function */ SystemInit(); - /* initialize the boards LEDs */ - leds_init(); } diff --git a/boards/seeeduino_xiao/board.c b/boards/seeeduino_xiao/board.c index afcaeca896d2..c658defcc7cd 100644 --- a/boards/seeeduino_xiao/board.c +++ b/boards/seeeduino_xiao/board.c @@ -27,12 +27,5 @@ void board_init(void) { - /* initialize the on-board LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); - LED0_OFF; - LED1_OFF; - LED2_OFF; } diff --git a/boards/sensebox_samd21/board.c b/boards/sensebox_samd21/board.c index bcabdfbf1573..6fcc85c19a46 100644 --- a/boards/sensebox_samd21/board.c +++ b/boards/sensebox_samd21/board.c @@ -44,11 +44,7 @@ mtd_dev_t *mtd0 = (mtd_dev_t *)&sensebox_sd_dev; void board_init(void) { - /* initialize the on-board red LED on pin PA27 */ - gpio_init(LED0_PIN, GPIO_OUT); - /* initialize the on-board green LED on pin PA28 */ - gpio_init(LED1_PIN, GPIO_OUT); /* initialize the on-board button on pin PA20 */ gpio_init(BTN0_PIN, BTN0_MODE); diff --git a/boards/serpente/board.c b/boards/serpente/board.c index d72184937ab5..4e5aba975097 100644 --- a/boards/serpente/board.c +++ b/boards/serpente/board.c @@ -58,12 +58,5 @@ mtd_dev_t *mtd0 = (mtd_dev_t *)&serpente_nor_dev; void board_init(void) { - /* initialize the on-board red LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); - LED0_OFF; - LED1_OFF; - LED2_OFF; } diff --git a/boards/sodaq-one/board.c b/boards/sodaq-one/board.c index 5a729d86dd53..1d443c50129f 100644 --- a/boards/sodaq-one/board.c +++ b/boards/sodaq-one/board.c @@ -23,13 +23,6 @@ void board_init(void) { - /* initialize the on-board LEDs, switch them off to start with */ - LED0_OFF; - gpio_init(LED0_PIN, GPIO_OUT); - LED1_OFF; - gpio_init(LED1_PIN, GPIO_OUT); - LED2_OFF; - gpio_init(LED2_PIN, GPIO_OUT); /* reset RN2483 (LoRa) */ LORA_RESET_OFF; diff --git a/boards/sodaq-sara-aff/Kconfig b/boards/sodaq-sara-aff/Kconfig index e78b3552e754..d2687832dcf8 100644 --- a/boards/sodaq-sara-aff/Kconfig +++ b/boards/sodaq-sara-aff/Kconfig @@ -13,4 +13,7 @@ config BOARD_SODAQ_SARA_AFF select BOARD_COMMON_SODAQ select CPU_MODEL_SAMD21J18A +config MODULE_PERIPH_INIT_LED0 + default n if MODULE_PERIPH_SPI + source "$(RIOTBOARD)/common/sodaq/Kconfig" diff --git a/boards/sodaq-sara-aff/Makefile.dep b/boards/sodaq-sara-aff/Makefile.dep index 6674052da641..a8e771c25674 100644 --- a/boards/sodaq-sara-aff/Makefile.dep +++ b/boards/sodaq-sara-aff/Makefile.dep @@ -1 +1,6 @@ +ifneq (,$(filter periph_spi,$(USEMODULE))) + # The LED pin is also used for SPI + DISABLE_MODULE += periph_init_led0 +endif + include $(RIOTBOARD)/common/sodaq/Makefile.dep diff --git a/boards/sodaq-sara-aff/board.c b/boards/sodaq-sara-aff/board.c index 2440ef538418..2f8f4d4d0796 100644 --- a/boards/sodaq-sara-aff/board.c +++ b/boards/sodaq-sara-aff/board.c @@ -23,20 +23,6 @@ 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 */ - LED0_OFF; - gpio_init(LED0_PIN, GPIO_OUT); - #endif - - LED_RED_OFF; - gpio_init(LED_RED_PIN, GPIO_OUT); - LED_GREEN_OFF; - gpio_init(LED_GREEN_PIN, GPIO_OUT); - LED_BLUE_OFF; - gpio_init(LED_BLUE_PIN, GPIO_OUT); - /* set NB-IoT device off by default */ NB_IOT_DISABLE; gpio_init(NB_IOT_ENABLE_PIN, GPIO_OUT); @@ -48,5 +34,4 @@ void board_init(void) /* set GPS off by default */ GPS_ENABLE_OFF; gpio_init(GPS_ENABLE_PIN, GPIO_OUT); - } diff --git a/boards/sodaq-sara-sff/board.c b/boards/sodaq-sara-sff/board.c index d71d4ee762d9..351730c95320 100644 --- a/boards/sodaq-sara-sff/board.c +++ b/boards/sodaq-sara-sff/board.c @@ -44,12 +44,9 @@ void board_init(void) /* Initialize the output ports for the LEDs */ LED_RED_OFF; - gpio_init(LED_RED_PIN, GPIO_OUT); LED_BLUE_OFF; - gpio_init(LED_BLUE_PIN, GPIO_OUT); LED_GREEN_OFF; - gpio_init(LED_GREEN_PIN, GPIO_OUT); } diff --git a/boards/spark-core/board.c b/boards/spark-core/board.c index 20bc53245a45..a3b7d7061e1d 100644 --- a/boards/spark-core/board.c +++ b/boards/spark-core/board.c @@ -24,15 +24,6 @@ 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); - gpio_set(LED0_PIN); - gpio_set(LED1_PIN); - gpio_set(LED2_PIN); - gpio_set(LED3_PIN); /* disable systick interrupt, set by the spark bootloader */ SysTick->CTRL = 0; diff --git a/boards/stm32f030f4-demo/board.c b/boards/stm32f030f4-demo/board.c index 6988f9798b9a..f96bf9551f43 100644 --- a/boards/stm32f030f4-demo/board.c +++ b/boards/stm32f030f4-demo/board.c @@ -24,6 +24,4 @@ void board_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); - LED0_OFF; } diff --git a/boards/stm32f0discovery/board.c b/boards/stm32f0discovery/board.c index 098924099ac4..96fbbf23ff00 100644 --- a/boards/stm32f0discovery/board.c +++ b/boards/stm32f0discovery/board.c @@ -23,7 +23,4 @@ void board_init(void) { - /* initialize the boards LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); } diff --git a/boards/stm32f3discovery/board.c b/boards/stm32f3discovery/board.c index 0957d3bc7fbe..f5cb5510af19 100644 --- a/boards/stm32f3discovery/board.c +++ b/boards/stm32f3discovery/board.c @@ -23,13 +23,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); - gpio_init(LED4_PIN, GPIO_OUT); - gpio_init(LED5_PIN, GPIO_OUT); - gpio_init(LED6_PIN, GPIO_OUT); - gpio_init(LED7_PIN, GPIO_OUT); } diff --git a/boards/stm32f429i-disc1/board.c b/boards/stm32f429i-disc1/board.c index 8b3d4223820e..70fa8580b5e9 100644 --- a/boards/stm32f429i-disc1/board.c +++ b/boards/stm32f429i-disc1/board.c @@ -23,7 +23,4 @@ void board_init(void) { - /* initialize the boards LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); } diff --git a/boards/stm32f469i-disco/board.c b/boards/stm32f469i-disco/board.c index 029f1322d0f1..937aa994df0d 100644 --- a/boards/stm32f469i-disco/board.c +++ b/boards/stm32f469i-disco/board.c @@ -23,8 +23,4 @@ void board_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); - gpio_init(LED3_PIN, GPIO_OUT); } diff --git a/boards/stm32f4discovery/board.c b/boards/stm32f4discovery/board.c index 3be8cc2f9272..32e1ba63b518 100644 --- a/boards/stm32f4discovery/board.c +++ b/boards/stm32f4discovery/board.c @@ -23,9 +23,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); } diff --git a/boards/stm32f723e-disco/Kconfig b/boards/stm32f723e-disco/Kconfig index 5613a145dc09..12028483581a 100644 --- a/boards/stm32f723e-disco/Kconfig +++ b/boards/stm32f723e-disco/Kconfig @@ -33,4 +33,7 @@ config BOARD_STM32F723E_DISCO # Workaround due to stdout only working with stdin enabled select MODULE_STDIN if TEST_KCONFIG +config MODULE_PERIPH_INIT_LED0 + default n if MODULE_PERIPH_SPI + source "$(RIOTBOARD)/common/stm32/Kconfig" diff --git a/boards/stm32f723e-disco/Makefile.dep b/boards/stm32f723e-disco/Makefile.dep index 5b2792852203..e7a10d482458 100644 --- a/boards/stm32f723e-disco/Makefile.dep +++ b/boards/stm32f723e-disco/Makefile.dep @@ -8,5 +8,10 @@ ifneq (,$(filter touch_dev,$(USEMODULE))) USEMODULE += ft5x06 endif +ifneq (,$(filter periph_spi,$(USEMODULE))) + # The LED pin is also used for SPI + DISABLE_MODULE += periph_init_led0 +endif + # TODO: remove the stdin dependency USEMODULE += stdin diff --git a/boards/stm32f723e-disco/board.c b/boards/stm32f723e-disco/board.c index d1cf2a0ef3b7..7b6a10e665d5 100644 --- a/boards/stm32f723e-disco/board.c +++ b/boards/stm32f723e-disco/board.c @@ -25,11 +25,4 @@ void board_init(void) { - /* initialize the boards LEDs */ - /* NOTE: LED0 must be explicitly enabled as it is also used for SPI_DEV(0) */ -#ifdef AUTO_INIT_LED0 - gpio_init(LED0_PIN, GPIO_OUT); -#endif - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); } diff --git a/boards/stm32f723e-disco/include/gpio_params.h b/boards/stm32f723e-disco/include/gpio_params.h index e4dfa8379989..8756099080a7 100644 --- a/boards/stm32f723e-disco/include/gpio_params.h +++ b/boards/stm32f723e-disco/include/gpio_params.h @@ -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 = "LD1 (blue)", .pin = LED0_PIN, diff --git a/boards/stm32f769i-disco/board.c b/boards/stm32f769i-disco/board.c index cc9025c484d7..ef70732d0c2a 100644 --- a/boards/stm32f769i-disco/board.c +++ b/boards/stm32f769i-disco/board.c @@ -25,9 +25,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); } diff --git a/boards/stm32g0316-disco/board.c b/boards/stm32g0316-disco/board.c index dd4984c9411f..b546982f3071 100644 --- a/boards/stm32g0316-disco/board.c +++ b/boards/stm32g0316-disco/board.c @@ -24,8 +24,6 @@ void board_init(void) { - gpio_init(LED0_PIN, LED0_MODE); - gpio_set(LED0_PIN); gpio_init(BTN0_PIN, BTN0_MODE); } diff --git a/boards/stm32l0538-disco/board.c b/boards/stm32l0538-disco/board.c index 7f2223297438..803386e3575b 100644 --- a/boards/stm32l0538-disco/board.c +++ b/boards/stm32l0538-disco/board.c @@ -23,7 +23,4 @@ void board_init(void) { - /* initialize the boards LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); } diff --git a/boards/stm32l476g-disco/board.c b/boards/stm32l476g-disco/board.c index 50be4d67a232..b6d406ff123e 100644 --- a/boards/stm32l476g-disco/board.c +++ b/boards/stm32l476g-disco/board.c @@ -23,7 +23,4 @@ void board_init(void) { - /* initialize LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); } diff --git a/boards/teensy31/board.c b/boards/teensy31/board.c index 42b9623c2900..0c59003a86b5 100644 --- a/boards/teensy31/board.c +++ b/boards/teensy31/board.c @@ -27,8 +27,5 @@ void board_init(void) { - /* initialize the boards LEDs */ - gpio_init(LED0_PIN, GPIO_OUT); - gpio_set(LED0_PIN); } diff --git a/boards/ublox-c030-u201/board.c b/boards/ublox-c030-u201/board.c index 06392e6cddb8..b0aa265417c5 100644 --- a/boards/ublox-c030-u201/board.c +++ b/boards/ublox-c030-u201/board.c @@ -23,7 +23,4 @@ void board_init(void) { - gpio_init(LED0_PIN, GPIO_OUT); - gpio_init(LED1_PIN, GPIO_OUT); - gpio_init(LED2_PIN, GPIO_OUT); } diff --git a/boards/waspmote-pro/board.c b/boards/waspmote-pro/board.c index 50d6d91cec27..a8d065bee5b4 100644 --- a/boards/waspmote-pro/board.c +++ b/boards/waspmote-pro/board.c @@ -25,24 +25,6 @@ #include "board.h" #include "cpu.h" -/** - * @brief Initialize the boards on-board LEDs (green and red) - * - * The LED initialization is hard-coded in this function. As the LED is soldered - * onto the board it is fixed to its CPU pins. - * - * The LEDs are connected to the following pins: - * - LED_GREEN: PC1 - * - LED_RED: PD6 - */ -void led_init(void) -{ - LED0_ENABLE_PORT; - LED_GREEN_ON; - LED1_ENABLE_PORT; - LED_RED_ON; -} - void board_init(void) { /* initialize UART_1 on AUX1 */ @@ -57,6 +39,4 @@ void board_init(void) SET_MUX_USB_MODULE; #endif #endif - - led_init(); } diff --git a/tests/leds/Makefile b/tests/leds/Makefile index 1db6fdba2306..76108073c06b 100644 --- a/tests/leds/Makefile +++ b/tests/leds/Makefile @@ -1,6 +1,6 @@ include ../Makefile.tests_common # Some boards do not initialize LED0 by default -CFLAGS=-DAUTO_INIT_LED0 +CFLAGS=-DPERIPH_INIT_LED0 include $(RIOTBASE)/Makefile.include From 301e955418990120f5cb553e6ee45feadce4e319 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 18 Feb 2022 00:05:50 +0100 Subject: [PATCH 4/7] boards/mcb2388: provide custom led_init() --- boards/mcb2388/board_init.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/boards/mcb2388/board_init.c b/boards/mcb2388/board_init.c index 856ae5899892..a150cd8df710 100644 --- a/boards/mcb2388/board_init.c +++ b/boards/mcb2388/board_init.c @@ -31,6 +31,13 @@ static mtd_dev_t _mtd_mci = { .driver = &mtd_mci_driver }; mtd_dev_t *mtd0 = &_mtd_mci; #endif +void led_init(void) +{ + /* LEDs */ + FIO2DIR |= LED0_MASK | LED1_MASK | LED2_MASK | LED3_MASK \ + | LED4_MASK | LED5_MASK | LED6_MASK | LED7_MASK; +} + void board_init(void) { } From d6035fe247d8f88b51a7df5b450a0a2b200aa020 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 18 Feb 2022 00:14:14 +0100 Subject: [PATCH 5/7] boards/nrf6310: provide custom led_init() --- boards/nrf6310/board.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/boards/nrf6310/board.c b/boards/nrf6310/board.c index 3df8edffc87c..2d76ab2433bb 100644 --- a/boards/nrf6310/board.c +++ b/boards/nrf6310/board.c @@ -23,9 +23,13 @@ #include "board.h" #include "cpu.h" -void board_init(void) +void led_init(void) { /* initialize and turn off on-board LEDs */ - NRF_GPIO->DIRSET = (LED0_MASK | LED1_MASK | LED2_MASK); - NRF_GPIO->OUTSET = (LED0_MASK | LED1_MASK | LED2_MASK); + NRF_GPIO->DIRSET = LED0_MASK | LED1_MASK | LED2_MASK; + NRF_GPIO->OUTSET = LED0_MASK | LED1_MASK | LED2_MASK; +} + +void board_init(void) +{ } From de0eed384d4049e160bfd88f8571ae09c2b70479 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 18 Feb 2022 12:51:09 +0100 Subject: [PATCH 6/7] boards/remote: provide custom led_init() --- boards/firefly/board.c | 5 +---- boards/remote-reva/board.c | 18 +++++++----------- boards/remote-revb/board.c | 18 +++++++----------- 3 files changed, 15 insertions(+), 26 deletions(-) diff --git a/boards/firefly/board.c b/boards/firefly/board.c index 636f560e1038..6fb07f0d614f 100644 --- a/boards/firefly/board.c +++ b/boards/firefly/board.c @@ -22,11 +22,8 @@ #include "cpu.h" #include "fancy_leds.h" -static inline void leds_init(void); - void board_init(void) { - leds_init(); } /** @@ -35,7 +32,7 @@ void board_init(void) * The LED initialization is hard-coded in this function. As the LED (RGB) are * soldered onto the board they are fixed to their CPU pins. */ -static inline void leds_init(void) +void led_init(void) { /* Shoot rainbows */ LED_RAINBOW(); diff --git a/boards/remote-reva/board.c b/boards/remote-reva/board.c index 8bd82bb1f4de..d14a7a44481b 100644 --- a/boards/remote-reva/board.c +++ b/boards/remote-reva/board.c @@ -24,23 +24,13 @@ #include "cpu.h" #include "fancy_leds.h" -static inline void leds_init(void); -static inline void rf_switch_init(void); - -void board_init(void) -{ - leds_init(); - /* initialize the 2.4GHz RF switch */ - rf_switch_init(); -} - /** * @brief Initialize the boards on-board LEDs * * The LED initialization is hard-coded in this function. As the LED (RGB) are * soldered onto the board they are fixed to their CPU pins. */ -static inline void leds_init(void) +void led_init(void) { /* Shoot rainbows */ LED_RAINBOW(); @@ -60,3 +50,9 @@ static void rf_switch_init(void) gpio_init(RF_SWITCH_GPIO, GPIO_OUT); RF_SWITCH_2_4_GHZ; } + +void board_init(void) +{ + /* initialize the 2.4GHz RF switch */ + rf_switch_init(); +} diff --git a/boards/remote-revb/board.c b/boards/remote-revb/board.c index 0d8c41c9727d..608ad45face8 100644 --- a/boards/remote-revb/board.c +++ b/boards/remote-revb/board.c @@ -24,23 +24,13 @@ #include "cpu.h" #include "fancy_leds.h" -static inline void leds_init(void); -static inline void rf_switch_init(void); - -void board_init(void) -{ - leds_init(); - /* initialize the 2.4GHz RF switch */ - rf_switch_init(); -} - /** * @brief Initialize the boards on-board LEDs * * The LED initialization is hard-coded in this function. As the LED (RGB) are * soldered onto the board they are fixed to their CPU pins. */ -static inline void leds_init(void) +void led_init(void) { /* Shoot rainbows */ @@ -61,3 +51,9 @@ static void rf_switch_init(void) gpio_init(RF_SWITCH_GPIO, GPIO_OUT); RF_SWITCH_2_4_GHZ; } + +void board_init(void) +{ + /* initialize the 2.4GHz RF switch */ + rf_switch_init(); +} From 2127f091d479ceeb9235acddfc67caab1107df6e Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Fri, 18 Feb 2022 12:53:36 +0100 Subject: [PATCH 7/7] boards/avr-rss2: provide custom led_init() --- boards/avr-rss2/led_init.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 boards/avr-rss2/led_init.c diff --git a/boards/avr-rss2/led_init.c b/boards/avr-rss2/led_init.c new file mode 100644 index 000000000000..1ff009744425 --- /dev/null +++ b/boards/avr-rss2/led_init.c @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2019 Robert Olsson + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup boards_avr-rss2 + * @{ + * + * @file + * @brief Board specific LED initialization + * @author Robert Olsson + * + * + * @} + */ + +#include "board.h" + +void led_init(void) +{ + /* Ports Pins as Output */ + LED_PORT_DDR |= LED1_MASK | LED0_MASK; + /* All LEDs OFF */ + LED_PORT |= LED1_MASK | LED0_MASK; +}