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

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

commit c0f423b6018b2ad44cc34815f29d80ee4ef24cdd
Author: Parthiban Nallathambi <[email protected]>
AuthorDate: Mon Nov 23 13:36:59 2026 +0530

    boards/tricore: Register the user LEDs of the Lite Kits.
    
    With CONFIG_GPIO_LOWER_HALF, register LED1 and LED2 of the a2g-tc375-lite
    and a3g-tc4d7-lite boards as /dev/gpio0 and /dev/gpio1 through the GPIO
    driver of their port, off at boot, and describe them in the board
    documentation.
    
    Signed-off-by: Parthiban Nallathambi <[email protected]>
---
 .../tricore/tc3x/boards/a2g-tc375-lite/index.rst   | 10 +++++++
 .../tricore/tc4x/boards/a3g-tc4d7-lite/index.rst   | 10 +++++++
 boards/tricore/tc3x/a2g-tc375-lite/src/tc375.h     |  6 ++++
 .../tc3x/a2g-tc375-lite/src/tc375_bringup.c        | 32 ++++++++++++++++++++++
 boards/tricore/tc4x/a3g-tc4d7-lite/src/tc4d7.h     |  6 ++++
 .../tc4x/a3g-tc4d7-lite/src/tc4d7_bringup.c        | 32 ++++++++++++++++++++++
 6 files changed, 96 insertions(+)

diff --git 
a/Documentation/platforms/tricore/tc3x/boards/a2g-tc375-lite/index.rst 
b/Documentation/platforms/tricore/tc3x/boards/a2g-tc375-lite/index.rst
index e66a6cfa31b..966f7bdcbe2 100644
--- a/Documentation/platforms/tricore/tc3x/boards/a2g-tc375-lite/index.rst
+++ b/Documentation/platforms/tricore/tc3x/boards/a2g-tc375-lite/index.rst
@@ -29,6 +29,16 @@ NuttShell with the ostest and hello examples::
 
     tools/configure.sh a2g-tc375-lite:nsh
 
+User LEDs
+=========
+
+LED1 (P00.5) and LED2 (P00.6) are on when their pin is low.  With
+``CONFIG_GPIO_LOWER_HALF`` the board registers them through the GPIO
+driver of their port as ``/dev/gpio0`` and ``/dev/gpio1``, off at boot,
+for example for the ``gpio`` example::
+
+    nsh> gpio -o 0 /dev/gpio0
+
 Flashing
 ========
 
diff --git 
a/Documentation/platforms/tricore/tc4x/boards/a3g-tc4d7-lite/index.rst 
b/Documentation/platforms/tricore/tc4x/boards/a3g-tc4d7-lite/index.rst
index 64ed078e0ab..f0382335741 100644
--- a/Documentation/platforms/tricore/tc4x/boards/a3g-tc4d7-lite/index.rst
+++ b/Documentation/platforms/tricore/tc4x/boards/a3g-tc4d7-lite/index.rst
@@ -29,6 +29,16 @@ NuttShell with the ostest and hello examples::
 
     tools/configure.sh a3g-tc4d7-lite:nsh
 
+User LEDs
+=========
+
+LED1 (P03.9) and LED2 (P03.10) are on when their pin is low.  With
+``CONFIG_GPIO_LOWER_HALF`` the board registers them through the GPIO
+driver of their port as ``/dev/gpio0`` and ``/dev/gpio1``, off at boot,
+for example for the ``gpio`` example::
+
+    nsh> gpio -o 0 /dev/gpio0
+
 Flashing
 ========
 
diff --git a/boards/tricore/tc3x/a2g-tc375-lite/src/tc375.h 
b/boards/tricore/tc3x/a2g-tc375-lite/src/tc375.h
index 3d53a995bb4..47cfc1bc578 100644
--- a/boards/tricore/tc3x/a2g-tc375-lite/src/tc375.h
+++ b/boards/tricore/tc3x/a2g-tc375-lite/src/tc375.h
@@ -35,6 +35,12 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
+/* User LEDs LED1 on P00.5 and LED2 on P00.6, on when low */
+
+#define LED_PORT         0
+#define LED1_PIN         5
+#define LED2_PIN         6
+
 /****************************************************************************
  * Public Types
  ****************************************************************************/
diff --git a/boards/tricore/tc3x/a2g-tc375-lite/src/tc375_bringup.c 
b/boards/tricore/tc3x/a2g-tc375-lite/src/tc375_bringup.c
index 8dfcdab323d..da1d74ebd46 100644
--- a/boards/tricore/tc3x/a2g-tc375-lite/src/tc375_bringup.c
+++ b/boards/tricore/tc3x/a2g-tc375-lite/src/tc375_bringup.c
@@ -30,7 +30,9 @@
 #include <syslog.h>
 
 #include <nuttx/fs/fs.h>
+#include <nuttx/ioexpander/gpio.h>
 
+#include "aurix/tricore_gpio_port.h"
 #include "tricore_internal.h"
 #include "tc375.h"
 
@@ -55,6 +57,9 @@ void tricore_mpuinit(void)
 
 int tc375_bringup(void)
 {
+#ifdef CONFIG_GPIO_LOWER_HALF
+  FAR struct ioexpander_dev_s *port;
+#endif
   int ret;
 
 #ifdef CONFIG_FS_PROCFS
@@ -78,6 +83,33 @@ int tc375_bringup(void)
     }
 #endif
 
+#ifdef CONFIG_GPIO_LOWER_HALF
+  /* The user LEDs as /dev/gpio0 and /dev/gpio1, off (high) at boot */
+
+  port = tricore_gpio_port_initialize(LED_PORT);
+  if (port == NULL)
+    {
+      syslog(LOG_ERR, "ERROR: Failed to create the LED port\n");
+    }
+  else
+    {
+      IOEXP_WRITEPIN(port, LED1_PIN, true);
+      IOEXP_WRITEPIN(port, LED2_PIN, true);
+
+      ret = gpio_lower_half(port, LED1_PIN, GPIO_OUTPUT_PIN, 0);
+      if (ret < 0)
+        {
+          syslog(LOG_ERR, "ERROR: Failed to register LED1: %d\n", ret);
+        }
+
+      ret = gpio_lower_half(port, LED2_PIN, GPIO_OUTPUT_PIN, 1);
+      if (ret < 0)
+        {
+          syslog(LOG_ERR, "ERROR: Failed to register LED2: %d\n", ret);
+        }
+    }
+#endif
+
   UNUSED(ret);
   return OK;
 }
diff --git a/boards/tricore/tc4x/a3g-tc4d7-lite/src/tc4d7.h 
b/boards/tricore/tc4x/a3g-tc4d7-lite/src/tc4d7.h
index f10272c006c..ac18608c107 100644
--- a/boards/tricore/tc4x/a3g-tc4d7-lite/src/tc4d7.h
+++ b/boards/tricore/tc4x/a3g-tc4d7-lite/src/tc4d7.h
@@ -35,6 +35,12 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
+/* User LEDs LED1 on P03.9 and LED2 on P03.10, on when low */
+
+#define LED_PORT         3
+#define LED1_PIN         9
+#define LED2_PIN         10
+
 /****************************************************************************
  * Public Types
  ****************************************************************************/
diff --git a/boards/tricore/tc4x/a3g-tc4d7-lite/src/tc4d7_bringup.c 
b/boards/tricore/tc4x/a3g-tc4d7-lite/src/tc4d7_bringup.c
index bd55128e863..17800533241 100644
--- a/boards/tricore/tc4x/a3g-tc4d7-lite/src/tc4d7_bringup.c
+++ b/boards/tricore/tc4x/a3g-tc4d7-lite/src/tc4d7_bringup.c
@@ -30,7 +30,9 @@
 #include <syslog.h>
 
 #include <nuttx/fs/fs.h>
+#include <nuttx/ioexpander/gpio.h>
 
+#include "aurix/tricore_gpio_port.h"
 #include "tricore_internal.h"
 #include "tc4d7.h"
 
@@ -55,6 +57,9 @@ void tricore_mpuinit(void)
 
 int tc4d7_bringup(void)
 {
+#ifdef CONFIG_GPIO_LOWER_HALF
+  FAR struct ioexpander_dev_s *port;
+#endif
   int ret;
 
 #ifdef CONFIG_FS_PROCFS
@@ -78,6 +83,33 @@ int tc4d7_bringup(void)
     }
 #endif
 
+#ifdef CONFIG_GPIO_LOWER_HALF
+  /* The user LEDs as /dev/gpio0 and /dev/gpio1, off (high) at boot */
+
+  port = tricore_gpio_port_initialize(LED_PORT);
+  if (port == NULL)
+    {
+      syslog(LOG_ERR, "ERROR: Failed to create the LED port\n");
+    }
+  else
+    {
+      IOEXP_WRITEPIN(port, LED1_PIN, true);
+      IOEXP_WRITEPIN(port, LED2_PIN, true);
+
+      ret = gpio_lower_half(port, LED1_PIN, GPIO_OUTPUT_PIN, 0);
+      if (ret < 0)
+        {
+          syslog(LOG_ERR, "ERROR: Failed to register LED1: %d\n", ret);
+        }
+
+      ret = gpio_lower_half(port, LED2_PIN, GPIO_OUTPUT_PIN, 1);
+      if (ret < 0)
+        {
+          syslog(LOG_ERR, "ERROR: Failed to register LED2: %d\n", ret);
+        }
+    }
+#endif
+
   UNUSED(ret);
   return OK;
 }

Reply via email to