This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new a923e4a714d stm32f746g-disco: Fix USERLED support
a923e4a714d is described below

commit a923e4a714d55a4963c0bd68d90a1bb936d200f8
Author: Martin Vajnar <[email protected]>
AuthorDate: Sun Jun 28 10:57:47 2026 +0200

    stm32f746g-disco: Fix USERLED support
    
    Provide correct pin name BOARD_LED1 and associated bit mask
    BOARD_LED1_BIT. Also use non-negated `ledon`. Add initialization into
    bringup code.
    
    Signed-off-by: Martin Vajnar <[email protected]>
---
 boards/arm/stm32f7/stm32f746g-disco/src/stm32_bringup.c  | 12 ++++++++++++
 boards/arm/stm32f7/stm32f746g-disco/src/stm32_userleds.c |  7 ++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/boards/arm/stm32f7/stm32f746g-disco/src/stm32_bringup.c 
b/boards/arm/stm32f7/stm32f746g-disco/src/stm32_bringup.c
index 1ee2e0d07d3..3773c61a101 100644
--- a/boards/arm/stm32f7/stm32f746g-disco/src/stm32_bringup.c
+++ b/boards/arm/stm32f7/stm32f746g-disco/src/stm32_bringup.c
@@ -42,6 +42,10 @@
 #  include <nuttx/video/fb.h>
 #endif
 
+#if defined(CONFIG_USERLED_LOWER) && !defined(CONFIG_ARCH_LEDS)
+#  include <nuttx/leds/userled.h>
+#endif
+
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -150,6 +154,14 @@ int stm32_bringup(void)
     }
 #endif
 
+#if defined(CONFIG_USERLED_LOWER) && !defined(CONFIG_ARCH_LEDS)
+  ret = userled_lower_initialize("/dev/led0");
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
+    }
+#endif
+
   UNUSED(ret);  /* May not be used */
   return OK;
 }
diff --git a/boards/arm/stm32f7/stm32f746g-disco/src/stm32_userleds.c 
b/boards/arm/stm32f7/stm32f746g-disco/src/stm32_userleds.c
index 6c9c1d9f7c6..9e3d8919dfb 100644
--- a/boards/arm/stm32f7/stm32f746g-disco/src/stm32_userleds.c
+++ b/boards/arm/stm32f7/stm32f746g-disco/src/stm32_userleds.c
@@ -25,6 +25,7 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
+#include <arch/board/board.h>
 
 #include <stdbool.h>
 #include <nuttx/debug.h>
@@ -67,9 +68,9 @@ uint32_t board_userled_initialize(void)
 
 void board_userled(int led, bool ledon)
 {
-  if (led == BOARD_STATUS_LED)
+  if (led == BOARD_LED1)
     {
-      stm32_gpiowrite(GPIO_LD1, !ledon);
+      stm32_gpiowrite(GPIO_LD1, ledon);
     }
 }
 
@@ -86,7 +87,7 @@ void board_userled(int led, bool ledon)
 
 void board_userled_all(uint32_t ledset)
 {
-  stm32_gpiowrite(GPIO_LD1, (ledset & BOARD_STATUS_LED_BIT) != 0);
+  stm32_gpiowrite(GPIO_LD1, (ledset & BOARD_LED1_BIT) != 0);
 }
 
 #endif /* !CONFIG_ARCH_LEDS */

Reply via email to