From b47c37cac7b0f6dbe5ee63828d99f606392ca84a Mon Sep 17 00:00:00 2001 From: Bogdan Ivanus Date: Fri, 14 Nov 2025 15:57:33 +0200 Subject: [PATCH 1/2] Changed 'built-in' (default) LED used with Zephir boards from RED to GREEN. --- cores/arduino/Arduino.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h index 4d35beda..dcc60fa9 100644 --- a/cores/arduino/Arduino.h +++ b/cores/arduino/Arduino.h @@ -64,8 +64,8 @@ #else #define LED_BUILTIN \ DIGITAL_PIN_GPIOS_FIND_PIN( \ - DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0)), \ - DT_PHA_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0, pin)) + DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 1)), \ + DT_PHA_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 1, pin)) #endif /* If digital-pin-gpios is not defined, tries to use the led0 alias */ From 1afa525abe2a30f6a681c4bd6ea026eb3edee83a Mon Sep 17 00:00:00 2001 From: Bogdan Ivanus Date: Thu, 20 Nov 2025 15:09:48 +0200 Subject: [PATCH 2/2] Reverted change in Arduino.h which affects all boards, and reintroduced the fix as overlay config instead, for R1, C33 and H7. --- cores/arduino/Arduino.h | 4 +-- .../arduino_giga_r1_stm32h747xx_m7.overlay | 20 ++++++++++++++ ...arduino_portenta_c33_r7fa6m5bh3cfc.overlay | 26 +++++++++++++++++++ ...arduino_portenta_h7_stm32h747xx_m7.overlay | 23 ++++++++++++++++ 4 files changed, 71 insertions(+), 2 deletions(-) diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h index dcc60fa9..4d35beda 100644 --- a/cores/arduino/Arduino.h +++ b/cores/arduino/Arduino.h @@ -64,8 +64,8 @@ #else #define LED_BUILTIN \ DIGITAL_PIN_GPIOS_FIND_PIN( \ - DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 1)), \ - DT_PHA_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 1, pin)) + DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0)), \ + DT_PHA_BY_IDX(DT_PATH(zephyr_user), builtin_led_gpios, 0, pin)) #endif /* If digital-pin-gpios is not defined, tries to use the led0 alias */ diff --git a/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.overlay b/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.overlay index fdf6eb3b..92c914f5 100644 --- a/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.overlay +++ b/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.overlay @@ -540,3 +540,23 @@ /* Include common flash filesystem configuration */ qspi_flash: &n25q128a1 {}; #include "../common/arduino_flash_fs.dtsi" + +/ { + zephyr,user { + /* Override builtin LED GPIO to point to the green LED */ + builtin_led_gpios = <&gpioj 13 0>; /* Pin 13 on GPIOJ for Green LED, active-low */ + }; + + leds { + compatible = "gpio-leds"; + red_led: led_0 { + gpios = <&gpioi 12 GPIO_ACTIVE_LOW>; /* Red LED on GPIO pin 12 of GPIOI, active-low */ + }; + green_led: led_1 { + gpios = <&gpioj 13 GPIO_ACTIVE_LOW>; /* Green LED on GPIO pin 13 of GPIOJ, active-low */ + }; + blue_led: led_2 { + gpios = <&gpioe 3 GPIO_ACTIVE_LOW>; /* Blue LED on GPIO pin 3 of GPIOE, active-low */ + }; + }; +}; \ No newline at end of file diff --git a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.overlay b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.overlay index 806ef2da..d79f3b18 100644 --- a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.overlay +++ b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.overlay @@ -302,3 +302,29 @@ /* Include common flash filesystem configuration */ qspi_flash: &at25sf128a {}; #include "../common/arduino_flash_fs.dtsi" + +/ { + zephyr,user { + /* Override builtin LED GPIO to point to the green LED (led2) */ + builtin_led_gpios = <&ioport4 0 0>; /* GPIO pin 0 on ioport4 (green LED) */ + }; + + leds { + compatible = "gpio-leds"; + + led1: led1 { + gpios = <&ioport1 7 GPIO_ACTIVE_LOW>; /* Red LED on GPIO pin 7 of ioport1, active-low */ + label = "LEDR"; /* Label changed to Red LED */ + }; + + led2: led2 { + gpios = <&ioport4 0 GPIO_ACTIVE_LOW>; /* Green LED on GPIO pin 0 of ioport4, active-low */ + label = "LEDG"; /* Label changed to Green LED */ + }; + + led3: led3 { + gpios = <&ioport8 0 GPIO_ACTIVE_LOW>; /* Blue LED on GPIO pin 0 of ioport8, active-low */ + label = "LEDB"; /* Label changed to Blue LED */ + }; + }; +}; \ No newline at end of file diff --git a/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.overlay b/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.overlay index 72ae8ffe..25d25856 100644 --- a/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.overlay +++ b/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.overlay @@ -388,3 +388,26 @@ qspi_flash: &mx25l12833f {}; <&adc1 13>; /* Hack for D20 */ }; }; + +/ { + zephyr,user { + /* Override builtin LED GPIO to point to the green LED */ + builtin_led_gpios = <&gpiok 6 0>; /* Pin 6 on GPIOK, active low */ + }; + + leds { + compatible = "gpio-leds"; + + red_led: led_0 { + gpios = <&gpiok 5 GPIO_ACTIVE_LOW>; /* Red LED on GPIO pin 5, active-low */ + }; + + green_led: led_1 { + gpios = <&gpiok 6 GPIO_ACTIVE_LOW>; /* Green LED on GPIO pin 6, active-low */ + }; + + blue_led: led_2 { + gpios = <&gpiok 7 GPIO_ACTIVE_LOW>; /* Blue LED on GPIO pin 7, active-low */ + }; + }; +}; \ No newline at end of file