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

raiden00 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 c4d6b728a03 boards/stm32h7: Add button support to nucleo-h743zi2
c4d6b728a03 is described below

commit c4d6b728a034d21414e8025f84f8d4d15fdd833e
Author: Peter Barada <[email protected]>
AuthorDate: Fri Feb 20 15:06:55 2026 -0500

    boards/stm32h7: Add button support to nucleo-h743zi2
    
    This patch adds support for the user button on nuclo-h743zi2 board
    (and nucleo-h753zi2 which is also a MB1364 board design) and enables
    button support and example in nucleo-h743zi2:jumbo configuration selector.
    
    Signed-off-by: Peter Barada <[email protected]>
---
 .../arm/stm32h7/boards/nucleo-h743zi2/index.rst    | 315 ++++++++++++++++-----
 boards/Kconfig                                     |   1 +
 .../stm32h7/nucleo-h743zi2/configs/jumbo/defconfig |   8 +
 .../arm/stm32h7/nucleo-h743zi2/src/CMakeLists.txt  |   7 +-
 boards/arm/stm32h7/nucleo-h743zi2/src/Makefile     |   4 +
 .../stm32h7/nucleo-h743zi2/src/nucleo-h743zi2.h    |  13 +
 .../arm/stm32h7/nucleo-h743zi2/src/stm32_bringup.c |  14 +
 .../arm/stm32h7/nucleo-h743zi2/src/stm32_buttons.c | 107 +++++++
 8 files changed, 391 insertions(+), 78 deletions(-)

diff --git 
a/Documentation/platforms/arm/stm32h7/boards/nucleo-h743zi2/index.rst 
b/Documentation/platforms/arm/stm32h7/boards/nucleo-h743zi2/index.rst
index f09e8747273..f390092265e 100644
--- a/Documentation/platforms/arm/stm32h7/boards/nucleo-h743zi2/index.rst
+++ b/Documentation/platforms/arm/stm32h7/boards/nucleo-h743zi2/index.rst
@@ -11,7 +11,7 @@ memory and 1MByte SRAM. The board features:
 
 - On-board ST-LINK/V2 for programming and debugging,
 - 3 user LEDs
-- Two pushbuttons (user and reset)
+- Two pushbuttons (user[B1] and reset)
 - 32.768 kHz crystal oscillator
 - USB OTG FS with Micro-AB connectors
 - Ethernet connector compliant with IEEE-802.3-2002
@@ -113,54 +113,60 @@ Some highlights:
 
 
 ..
-   NuttShell (NSH) NuttX-10.0.1
+   ADE
+   telnetd [6:100]
+   
+   NuttShell (NSH)
+   nsh>
    nsh> uname -a
-   NuttX  10.0.1 3ab35e48ff-dirty Mar 28 2021 15:35:29 arm nucleo-h743zi2
+   NuttX  0.0.0 643f33934e-dirty Feb 20 2026 14:50:28 arm nucleo-h743zi2
    nsh> ?
    help usage:  help [-v] [<cmd>]
-
-     .         cd        dmesg     hexdump   mkrd      reboot    telnetd   xd
-     [         cp        echo      ifconfig  mh        rm        time
-     ?         cmp       env       irqinfo   mount     rmdir     true
-     addroute  dirname   exec      kill      mv        route     uname
-     arp       date      exit      ls        mw        set       umount
-     basename  dd        false     mb        nslookup  sleep     unset
-     break     delroute  free      mkdir     ps        source    usleep
-     cat       df        help      mkfatfs   pwd       test      wget
-
+   
+       .           cp          expr        mkrd        route       truncate
+       [           cmp         false       mount       set         uname
+       ?           dirname     fdinfo      mv          kill        umount
+       addroute    date        free        nslookup    pkill       unset
+       alias       delroute    help        pidof       sleep       uptime
+       unalias     df          hexdump     printf      usleep      watch
+       arp         dmesg       ifconfig    ps          source      wget
+       basename    echo        irqinfo     pwd         test        xd
+       break       env         ls          reboot      top         wait
+       cat         exec        mkdir       rm          time
+       cd          exit        mkfatfs     rmdir       true
+   
    Builtin Apps:
-     fstest    getprime  nsh       ostest    ping      renew     sh
+       dd          hidkbd      nsh         renew       telnetd
+       fstest      iperf       ostest      sh
+       getprime    netcat      ping        tc
    nsh> ps
-     PID PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  
FILLED    CPU COMMAND
-       0   0 FIFO     Kthread N-- Ready              00000000 001024 000472  
46.0%  100.0% Idle Task
-       1 224 RR       Kthread --- Waiting  Signal    00000000 002036 000456  
22.3%    0.0% hpwork
-       2 100 RR       Kthread --- Waiting  Signal    00000000 002036 000680  
33.3%    0.0% lpwork
-       3 100 RR       Task    --- Running            00000000 004084 001304  
31.9%    0.0% init
-       4 100 RR       Kthread --- Waiting  Semaphore 00000000 002036 000752  
36.9%    0.0% usbhost
-       5  50 RR       Kthread --- Waiting  Signal    00000000 004076 000472  
11.5%    0.0% USB Monitor
-       6 100 RR       Task    --- Waiting  Semaphore 00000000 002012 000648  
32.2%    0.0% Telnet daemon 0x38005600
+     TID   PID  PPID PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK       
     STACK    USED FILLED    CPU COMMAND
+       0     0     0   0 FIFO     Kthread   - Ready              
0000000000000000 0001000 0000544  54.4%  100.0% Idle_Task
+       1     0     0 224 RR       Kthread   - Waiting  Semaphore 
0000000000000000 0001976 0000592  29.9%   0.0% hpwork 0x24000120 0x24000168
+       2     0     0 100 RR       Kthread   - Waiting  Semaphore 
0000000000000000 0001976 0000592  29.9%   0.0% lpwork 0x240000bc 0x24000104
+       3     3     0 100 RR       Task      - Running            
0000000000000000 0004048 0001768  43.6%   0.0% nsh_main
+       4     0     0 100 RR       Kthread   - Waiting  Semaphore 
0000000000000000 0002008 0000856  42.6%   0.0% usbhost
+       5     0     0  50 RR       Kthread   - Waiting  Signal    
0000000000000000 0004048 0000536  13.2%   0.0% USB_Monitor
+       6     6     0 100 RR       Task      - Waiting  Semaphore 
0000000000000000 0002008 0000880  43.8%   0.0% telnetd
    nsh> free
-                        total       used       free    largest
-           Umem:       944336     159520     784816     451712
+         total       used       free    maxused    maxfree  nused  nfree name
+        956604     158372     798232     158768     464552     62      5 Umem
    nsh> irqinfo
    IRQ HANDLER  ARGUMENT    COUNT    RATE    TIME
-     3 080011ed 00000000       1599   20.405    0
-    15 08004e0d 00000000       7836  100.000 10000
-    55 08000799 24000000       1122   14.318    0
-    77 0800580b 00000000         14    0.178    0
-   117 0802c6f1 00000000       1372   17.544    0
-   nsh> date; sleep 2; date
-   Thu, Jan 01 00:01:50 1970
-   Thu, Jan 01 00:01:52 1970
+    11 080012c1 00000000       1757   19.719    0
+    15 0800804d 00000000       8910  100.000    1
+    55 080007a1 24000000       2338   26.240    5
+    77 0800849d 00000000         30    0.336    1
+   117 0803bbb1 00000000        206    2.316 21558
    nsh> ifconfig
-   eth0    Link encap:Ethernet HWaddr 46:fd:66:78:aa:54 at UP
+   eth0    Link encap:Ethernet HWaddr ea:63:b9:20:1d:46 at RUNNING mtu 1486
            inet addr:10.0.0.2 DRaddr:10.0.0.1 Mask:255.255.255.0
-
-   lo      Link encap:Local Loopback at UP
+   
+   lo      Link encap:Local Loopback at RUNNING mtu 1518
            inet addr:127.0.0.1 DRaddr:127.0.0.1 Mask:255.0.0.0
-
+   
                 IPv4   TCP   UDP  ICMP
-   Received     0004  0000  0004  0000
+   Received     000a  0000  000a  0000
    Dropped      0000  0000  0000  0000
      IPv4        VHL: 0000   Frg: 0000
      Checksum   0000  0000  0000  ----
@@ -170,46 +176,52 @@ Some highlights:
    Sent         0000  0000  0000  0000
      Rexmit     ----  0000  ----  ----
    nsh> renew eth0
+   nsh> ifconfig eth0
+   eth0    Link encap:Ethernet HWaddr ea:63:b9:20:1d:46 at RUNNING mtu 1486
+           inet addr:192.168.3.120 DRaddr:192.168.3.1 Mask:255.255.255.0
+   
+   nsh> # telnet to board here
    nsh> ifconfig
-   eth0    Link encap:Ethernet HWaddr 46:fd:66:78:aa:54 at UP
-           inet addr:192.168.86.249 DRaddr:192.168.86.1 Mask:255.255.255.0
-
-   lo      Link encap:Local Loopback at UP
+   eth0    Link encap:Ethernet HWaddr ea:63:b9:20:1d:46 at RUNNING mtu 1486
+           inet addr:192.168.3.120 DRaddr:192.168.3.1 Mask:255.255.255.0
+   
+   lo      Link encap:Local Loopback at RUNNING mtu 1518
            inet addr:127.0.0.1 DRaddr:127.0.0.1 Mask:255.0.0.0
-
+   
                 IPv4   TCP   UDP  ICMP
-   Received     0007  0000  0007  0000
+   Received     004b  0037  0013  0001
    Dropped      0000  0000  0000  0000
      IPv4        VHL: 0000   Frg: 0000
      Checksum   0000  0000  0000  ----
      TCP         ACK: 0000   SYN: 0000
                  RST: 0000  0000
      Type       0000  ----  ----  0000
-   Sent         0002  0000  0002  0000
+   Sent         0039  0036  0002  0001
      Rexmit     ----  0000  ----  ----
    nsh> ping www.google.com
-   PING 172.217.14.196 56 bytes of data
-   56 bytes from 172.217.14.196: icmp_seq=0 time=10 ms
-   56 bytes from 172.217.14.196: icmp_seq=1 time=0 ms
-   56 bytes from 172.217.14.196: icmp_seq=2 time=0 ms
-   56 bytes from 172.217.14.196: icmp_seq=3 time=0 ms
-   56 bytes from 172.217.14.196: icmp_seq=4 time=0 ms
-   56 bytes from 172.217.14.196: icmp_seq=5 time=0 ms
-   56 bytes from 172.217.14.196: icmp_seq=6 time=0 ms
-   56 bytes from 172.217.14.196: icmp_seq=7 time=0 ms
-   56 bytes from 172.217.14.196: icmp_seq=8 time=0 ms
-   56 bytes from 172.217.14.196: icmp_seq=9 time=0 ms
+   PING 142.250.191.4 56 bytes of data
+   56 bytes from 142.250.191.4: icmp_seq=0 time=20.0 ms
+   56 bytes from 142.250.191.4: icmp_seq=1 time=10.0 ms
+   56 bytes from 142.250.191.4: icmp_seq=2 time=10.0 ms
+   56 bytes from 142.250.191.4: icmp_seq=3 time=10.0 ms
+   56 bytes from 142.250.191.4: icmp_seq=4 time=10.0 ms
+   56 bytes from 142.250.191.4: icmp_seq=5 time=10.0 ms
+   56 bytes from 142.250.191.4: icmp_seq=6 time=10.0 ms
+   56 bytes from 142.250.191.4: icmp_seq=7 time=10.0 ms
+   56 bytes from 142.250.191.4: icmp_seq=8 time=10.0 ms
+   56 bytes from 142.250.191.4: icmp_seq=9 time=20.0 ms
    10 packets transmitted, 10 received, 0% packet loss, time 10100 ms
-   nsh>
+   rtt min/avg/max/mdev = 10.000/12.000/20.000/4.000 ms
    nsh> ls /dev
    /dev:
     console
+    kmsg
     null
-    ramlog
     rammtd
     sda
     telnet
     ttyS0
+    zero
    nsh> ls /mnt
    /mnt:
     lfs/
@@ -220,40 +232,191 @@ Some highlights:
    nsh> echo "This will stay on the USB drive" > /mnt/sda/afile
    nsh> ls /mnt/sda
    /mnt/sda:
+    GARMIN/
     afile
-   nsh> reboot
-
-   NuttShell (NSH) NuttX-10.0.1
+   nsh> rebootADE
+   telnetd [6:100]
+   
+   NuttShell (NSH)
+   nsh> ls /mnt/lfs
+   /mnt/lfs:
+    .
+    ..
+   nsh> ls /mnt
+   /mnt:
+    lfs/
+   nsh> mount -t vfat /dev/sda /mnt/sda
+   nsh> ls /mnt/sda
+   /mnt/sda:
+    GARMIN/
+    afile
+   nsh> cat /mnt/sda/afile
+   This will stay on the USB drive
+   nsh> buttons
+   nsh: buttons: command not found
+   nsh> ADE
+   ADE
+   telnetd [6:100]
+   
+   NuttShell (NSH)
+   nsh> uname -a
+   NuttX  0.0.0 d147177c62 Feb 20 2026 15:18:50 arm nucleo-h743zi2
+   nsh> ?
+   help usage:  help [-v] [<cmd>]
+   
+       .           cp          expr        mkrd        route       truncate
+       [           cmp         false       mount       set         uname
+       ?           dirname     fdinfo      mv          kill        umount
+       addroute    date        free        nslookup    pkill       unset
+       alias       delroute    help        pidof       sleep       uptime
+       unalias     df          hexdump     printf      usleep      watch
+       arp         dmesg       ifconfig    ps          source      wget
+       basename    echo        irqinfo     pwd         test        xd
+       break       env         ls          reboot      top         wait
+       cat         exec        mkdir       rm          time
+       cd          exit        mkfatfs     rmdir       true
+   
+   Builtin Apps:
+       buttons     getprime    netcat      ping        tc
+       dd          hidkbd      nsh         renew       telnetd
+       fstest      iperf       ostest      sh
+   nsh> ls
+   /:
+    dev/
+    mnt/
+    proc/
+   nsh> free
+         total       used       free    maxused    maxfree  nused  nfree name
+        956492     158452     798040     158848     464440     64      5 Umem
+   nsh> irqinfo
+   IRQ HANDLER  ARGUMENT    COUNT    RATE    TIME
+    11 080012f1 00000000       1073   10.277    0
+    15 0800807d 00000000      10440  100.000    1
+    55 080007a1 24000000       1380   13.218    5
+    77 080084cd 00000000         36    0.344    1
+   117 0803c4ed 00000000        206    1.976 21558
+   nsh> ifconfig
+   eth0    Link encap:Ethernet HWaddr ea:63:b9:20:1d:46 at RUNNING mtu 1486
+           inet addr:10.0.0.2 DRaddr:10.0.0.1 Mask:255.255.255.0
+   
+   lo      Link encap:Local Loopback at RUNNING mtu 1518
+           inet addr:127.0.0.1 DRaddr:127.0.0.1 Mask:255.0.0.0
+   
+                IPv4   TCP   UDP  ICMP
+   Received     000d  0000  000d  0000
+   Dropped      0000  0000  0000  0000
+     IPv4        VHL: 0000   Frg: 0000
+     Checksum   0000  0000  0000  ----
+     TCP         ACK: 0000   SYN: 0000
+                 RST: 0000  0000
+     Type       0000  ----  ----  0000
+   Sent         0000  0000  0000  0000
+     Rexmit     ----  0000  ----  ----
+   nsh> renew eth0
+   nsh> ifconfig eth0
+   eth0    Link encap:Ethernet HWaddr ea:63:b9:20:1d:46 at RUNNING mtu 1486
+           inet addr:192.168.3.120 DRaddr:192.168.3.1 Mask:255.255.255.0
+   
+   nsh> ping www.google.com
+   PING 142.250.217.132 56 bytes of data
+   56 bytes from 142.250.217.132: icmp_seq=0 time=20.0 ms
+   56 bytes from 142.250.217.132: icmp_seq=1 time=10.0 ms
+   56 bytes from 142.250.217.132: icmp_seq=2 time=10.0 ms
+   56 bytes from 142.250.217.132: icmp_seq=3 time=10.0 ms
+   56 bytes from 142.250.217.132: icmp_seq=4 time=10.0 ms
+   56 bytes from 142.250.217.132: icmp_seq=5 time=20.0 ms
+   56 bytes from 142.250.217.132: icmp_seq=6 time=10.0 ms
+   56 bytes from 142.250.217.132: icmp_seq=7 time=10.0 ms
+   56 bytes from 142.250.217.132: icmp_seq=8 time=10.0 ms
+   56 bytes from 142.250.217.132: icmp_seq=9 time=10.0 ms
+   10 packets transmitted, 10 received, 0% packet loss, time 10100 ms
+   rtt min/avg/max/mdev = 10.000/12.000/20.000/4.000 ms
+   nsh> ls /dev
+   /dev:
+    buttons
+    console
+    kmsg
+    null
+    rammtd
+    sda
+    telnet
+    ttyS0
+    zero
+   nsh> ls /mnt
+   /mnt:
+    lfs/
+   nsh> echo "This will go away on reboot." > /mnt/lfs/afile
+   nsh> cat /mnt/lfs/afile
+   This will go away on reboot.
    nsh> mount -t vfat /dev/sda /mnt/sda
+   nsh> echo "This will stay on the USB drive" > /mnt/sda/afile
+   nsh> ls /mnt/sda
+   /mnt/sda:
+    GARMIN/
+    afile
+   nsh> rebootADE
+   telnetd [6:100]
+   
+   NuttShell (NSH)
    nsh> ls /mnt/lfs
    /mnt/lfs:
     .
     ..
+   nsh> ls /mnt
+   /mnt:
+    lfs/
+   nsh> mount -t vfat /dev/sda /mnt/sda
    nsh> ls /mnt/sda
    /mnt/sda:
+    GARMIN/
     afile
    nsh> cat /mnt/sda/afile
    This will stay on the USB drive
+   nsh> buttons
+   buttons_main: Starting the button_daemon
+   buttons_main: button_daemon started
+   button_daemon: Running
+   button_daemon: Opening /dev/buttons
+   button_daemon: Supported BUTTONs 0x01
+   nsh> B1 was pressed
+   B1 was released
+   B1 was pressed
+   B1 was released
+   
+   nsh> ps
+     TID   PID  PPID PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK       
     STACK    USED FILLED    CPU COMMAND
+       0     0     0   0 FIFO     Kthread   - Ready              
0000000000000000 0001000 0000544  54.4%  100.0% Idle_Task
+       1     0     0 224 RR       Kthread   - Waiting  Semaphore 
0000000000000000 0001976 0000592  29.9%   0.0% hpwork 0x24000120 0x24000168
+       2     0     0 100 RR       Kthread   - Waiting  Semaphore 
0000000000000000 0001976 0000592  29.9%   0.0% lpwork 0x240000bc 0x24000104
+       3     3     0 100 RR       Task      - Running            
0000000000000000 0004048 0001768  43.6%   0.0% nsh_main
+       4     0     0 100 RR       Kthread   - Waiting  Semaphore 
0000000000000000 0002008 0000856  42.6%   0.0% usbhost
+       5     0     0  50 RR       Kthread   - Waiting  Signal    
0000000000000000 0004048 0000816  20.1%   0.0% USB_Monitor
+       6     6     0 100 RR       Task      - Waiting  Semaphore 
0000000000000000 0002008 0000880  43.8%   0.0% telnetd
+       8     8     0 100 RR       Task      - Waiting  Signal    
0000000000000000 0004048 0000712  17.5%   0.0% button_daemon
    nsh>
    ```
 
    ```
-   ❯ telnet 192.168.86.249
-   Trying 192.168.86.249...
-   Connected to 192.168.86.249.
+   peter@legion:~$ telnet 192.168.3.120
+   Trying 192.168.3.120...
+   Connected to 192.168.3.120.
    Escape character is '^]'.
-
-   NuttShell (NSH) NuttX-10.0.1
+   
+   NuttShell (NSH)
    nsh> ps
-     PID PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  
FILLED    CPU COMMAND
-       0   0 FIFO     Kthread N-- Ready              00000000 001024 000472  
46.0%  100.0% Idle Task
-       1 224 RR       Kthread --- Waiting  Signal    00000000 002036 000456  
22.3%    0.0% hpwork
-       2 100 RR       Kthread --- Waiting  Signal    00000000 002036 000680  
33.3%    0.0% lpwork
-       3 100 RR       Task    --- Waiting  Semaphore 00000000 004084 001304  
31.9%    0.0% init
-       4 100 RR       Kthread --- Waiting  Semaphore 00000000 002036 000752  
36.9%    0.0% usbhost
-       5  50 RR       Kthread --- Waiting  Signal    00000000 004076 000472  
11.5%    0.0% USB Monitor
-       6 100 RR       Task    --- Waiting  Semaphore 00000000 002012 000648  
32.2%    0.0% Telnet daemon 0x38005600
-       9 100 RR       Kthread --- Waiting  Semaphore 00000000 001004 000448  
44.6%    0.0% telnet_io
-      10 100 RR       Task    --- Running            00000000 002028 001328  
65.4%    0.0% Telnet session
-   nsh>
+   nsh: &ps: command not found
+   nsh> ps
+     TID   PID  PPID PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK       
     STACK    USED FILLED    CPU COMMAND
+       0     0     0   0 FIFO     Kthread   - Ready              
0000000000000000 0001000 0000544  54.4%  100.0% Idle_Task
+       1     0     0 224 RR       Kthread   - Waiting  Semaphore 
0000000000000000 0001976 0000592  29.9%   0.0% hpwork 0x24000120 0x24000168
+       2     0     0 100 RR       Kthread   - Waiting  Semaphore 
0000000000000000 0001976 0000592  29.9%   0.0% lpwork 0x240000bc 0x24000104
+       3     3     0 100 RR       Task      - Waiting  Semaphore 
0000000000000000 0004048 0001384  34.1%   0.0% nsh_main
+       4     0     0 100 RR       Kthread   - Waiting  Semaphore 
0000000000000000 0002008 0000856  42.6%   0.0% usbhost
+       5     0     0  50 RR       Kthread   - Waiting  Signal    
0000000000000000 0004048 0000536  13.2%   0.0% USB_Monitor
+       6     6     0 100 RR       Task      - Waiting  Semaphore 
0000000000000000 0002008 0000880  43.8%   0.0% telnetd
+       8     8     0 100 RR       Task      - Running            
0000000000000000 0002000 0001864  93.2%!  0.0% Telnet_session
+   nsh> ^]
+   telnet> quit
+   Connection closed.
+   peter@legion:~$ 
    ```
diff --git a/boards/Kconfig b/boards/Kconfig
index e84a90b2d57..470dd1052f1 100644
--- a/boards/Kconfig
+++ b/boards/Kconfig
@@ -1921,6 +1921,7 @@ config ARCH_BOARD_NUCLEO_H743ZI2
        depends on ARCH_CHIP_STM32H743ZI
        select ARCH_HAVE_LEDS
        select ARCH_HAVE_BUTTONS
+       select ARCH_HAVE_IRQBUTTONS
        ---help---
                STMicro Nucleo H743ZI2 board based on the STMicro STM32H743ZI 
MCU.
 
diff --git a/boards/arm/stm32h7/nucleo-h743zi2/configs/jumbo/defconfig 
b/boards/arm/stm32h7/nucleo-h743zi2/configs/jumbo/defconfig
index 047abf376a9..c80b8e44ed2 100644
--- a/boards/arm/stm32h7/nucleo-h743zi2/configs/jumbo/defconfig
+++ b/boards/arm/stm32h7/nucleo-h743zi2/configs/jumbo/defconfig
@@ -11,10 +11,12 @@
 CONFIG_ARCH="arm"
 CONFIG_ARCH_BOARD="nucleo-h743zi2"
 CONFIG_ARCH_BOARD_NUCLEO_H743ZI2=y
+CONFIG_ARCH_BUTTONS=y
 CONFIG_ARCH_CHIP="stm32h7"
 CONFIG_ARCH_CHIP_STM32H743ZI=y
 CONFIG_ARCH_CHIP_STM32H7=y
 CONFIG_ARCH_CHIP_STM32H7_CORTEXM7=y
+CONFIG_ARCH_IRQBUTTONS=y
 CONFIG_ARCH_STACKDUMP=y
 CONFIG_ARMV7M_DCACHE=y
 CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y
@@ -32,6 +34,10 @@ CONFIG_DEBUG_USB_WARN=y
 CONFIG_DEFAULT_TASK_STACKSIZE=4096
 CONFIG_DHCPC_RENEW_STACKSIZE=2048
 CONFIG_ETH0_PHY_LAN8742A=y
+CONFIG_EXAMPLES_BUTTONS=y
+CONFIG_EXAMPLES_BUTTONS_NAME0="B1"
+CONFIG_EXAMPLES_BUTTONS_NAMES=y
+CONFIG_EXAMPLES_BUTTONS_QTD=1
 CONFIG_EXAMPLES_HIDKBD=y
 CONFIG_EXAMPLES_TOUCHSCREEN=y
 CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/mouse0"
@@ -44,6 +50,8 @@ CONFIG_FS_PROCFS_REGISTER=y
 CONFIG_HAVE_CXX=y
 CONFIG_HAVE_CXXINITIALIZE=y
 CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INPUT_BUTTONS=y
+CONFIG_INPUT_BUTTONS_LOWER=y
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBM=y
 CONFIG_LINE_MAX=64
diff --git a/boards/arm/stm32h7/nucleo-h743zi2/src/CMakeLists.txt 
b/boards/arm/stm32h7/nucleo-h743zi2/src/CMakeLists.txt
index c273c83da7c..c8ef998d0f2 100644
--- a/boards/arm/stm32h7/nucleo-h743zi2/src/CMakeLists.txt
+++ b/boards/arm/stm32h7/nucleo-h743zi2/src/CMakeLists.txt
@@ -56,6 +56,10 @@ if(CONFIG_BOARDCTL_RESET)
   list(APPEND SRCS stm32_reset.c)
 endif()
 
+if(CONFIG_ARCH_BUTTONS)
+  list(APPEND SRCS stm32_buttons.c)
+endif()
+
 target_sources(board PRIVATE ${SRCS})
 
 set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld")
@@ -64,6 +68,5 @@ if(NOT CONFIG_BUILD_FLAT)
   add_subdirectory(${NUTTX_BOARD_DIR}/kernel)
   set_property(
     GLOBAL PROPERTY LD_SCRIPT_USER ${NUTTX_BOARD_DIR}/scripts/memory.ld
-    ${NUTTX_BOARD_DIR}/scripts/user-space.ld)
+                    ${NUTTX_BOARD_DIR}/scripts/user-space.ld)
 endif()
-
diff --git a/boards/arm/stm32h7/nucleo-h743zi2/src/Makefile 
b/boards/arm/stm32h7/nucleo-h743zi2/src/Makefile
index c8e508792c1..92e776d490e 100644
--- a/boards/arm/stm32h7/nucleo-h743zi2/src/Makefile
+++ b/boards/arm/stm32h7/nucleo-h743zi2/src/Makefile
@@ -34,6 +34,10 @@ else
 CSRCS += stm32_userleds.c
 endif
 
+ifeq ($(CONFIG_ARCH_BUTTONS),y)
+CSRCS += stm32_buttons.c
+endif
+
 ifeq ($(CONFIG_STM32H7_OTGFS),y)
 CSRCS += stm32_usb.c
 endif
diff --git a/boards/arm/stm32h7/nucleo-h743zi2/src/nucleo-h743zi2.h 
b/boards/arm/stm32h7/nucleo-h743zi2/src/nucleo-h743zi2.h
index db4af07cdc4..ad98bd39fd3 100644
--- a/boards/arm/stm32h7/nucleo-h743zi2/src/nucleo-h743zi2.h
+++ b/boards/arm/stm32h7/nucleo-h743zi2/src/nucleo-h743zi2.h
@@ -88,6 +88,19 @@
 #define GPIO_LED_ORANGE GPIO_LD2
 #define GPIO_LED_RED    GPIO_LD3
 
+/* BUTTONS
+ *
+ * The Blue pushbutton B1, labeled "User", is connected to GPIO PC13.
+ * A high value will be sensed when the button is depressed.
+ * Note:
+ *    1) That the EXTI is included in the definition to enable an interrupt
+ *       on this IO.
+ *    2) The following definitions assume the default Solder Bridges are
+ *       installed.
+ */
+
+#define GPIO_BTN_USER  (GPIO_INPUT | GPIO_FLOAT | GPIO_EXTI | GPIO_PORTC | 
GPIO_PIN13)
+
 #define GPIO_OTGFS_VBUS   (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz| \
                            GPIO_OPENDRAIN|GPIO_PORTA|GPIO_PIN9)
 
diff --git a/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_bringup.c 
b/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_bringup.c
index 2f1afe47443..e461b646093 100644
--- a/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_bringup.c
+++ b/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_bringup.c
@@ -49,6 +49,10 @@
 
 #include "nucleo-h743zi2.h"
 
+#ifdef CONFIG_INPUT_BUTTONS
+#  include <nuttx/input/buttons.h>
+#endif
+
 /****************************************************************************
  * Private Functions
  ****************************************************************************/
@@ -157,6 +161,16 @@ int stm32_bringup(void)
     }
 #endif
 
+#if defined(CONFIG_INPUT_BUTTONS_LOWER)
+  /* Register the BUTTON driver */
+
+  ret = btn_lower_initialize("/dev/buttons");
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret);
+    }
+#endif /* CONFIG_INPUT_BUTTONS */
+
 #ifdef HAVE_USBHOST
   /* Initialize USB host operation.  stm32_usbhost_initialize()
    * starts a thread will monitor for USB connection and
diff --git a/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_buttons.c 
b/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_buttons.c
new file mode 100644
index 00000000000..0e162a52383
--- /dev/null
+++ b/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_buttons.c
@@ -0,0 +1,107 @@
+/****************************************************************************
+ * boards/arm/stm32h7/nucleo-h743zi2/src/stm32_buttons.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stddef.h>
+#include <errno.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/board.h>
+
+#include "stm32_gpio.h"
+#include "nucleo-h743zi2.h"
+#include <arch/board/board.h>
+
+#ifdef CONFIG_ARCH_BUTTONS
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_button_initialize
+ *
+ * Description:
+ *   board_button_initialize() must be called to initialize button resources.
+ *   After that, board_buttons() may be called to collect the current state
+ *   of all buttons or board_button_irq() may be called to register button
+ *   interrupt handlers.
+ *
+ ****************************************************************************/
+
+uint32_t board_button_initialize(void)
+{
+  stm32_configgpio(GPIO_BTN_USER);
+  return NUM_BUTTONS;
+}
+
+/****************************************************************************
+ * Name: board_buttons
+ ****************************************************************************/
+
+uint32_t board_buttons(void)
+{
+  return stm32_gpioread(GPIO_BTN_USER) ? 1 : 0;
+}
+
+/****************************************************************************
+ * Button support.
+ *
+ * Description:
+ *   board_button_initialize() must be called to initialize button resources.
+ *   After that, board_buttons() may be called to collect the current state
+ *   of all buttons or board_button_irq() may be called to register button
+ *   interrupt handlers.
+ *
+ *   After board_button_initialize() has been called, board_buttons() may be
+ *   called to collect the state of all buttons.  board_buttons() returns a
+ *   32-bit bit set with each bit associated with a button.  See the
+ *   BUTTON_*_BIT definitions in board.h for the meaning of each bit.
+ *
+ *   board_button_irq() may be called to register an interrupt handler that
+ *   will be called when a button is depressed or released.  The ID value is
+ *   a button enumeration value that uniquely identifies a button resource.
+ *   See the BUTTON_* definitions in board.h for the meaning of enumeration
+ *   value.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_IRQBUTTONS
+int board_button_irq(int id, xcpt_t irqhandler, void *arg)
+{
+  int ret = -EINVAL;
+
+  if (id == BUTTON_USER)
+    {
+      ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true,
+                               irqhandler, arg);
+    }
+
+  return ret;
+}
+#endif
+#endif /* CONFIG_ARCH_BUTTONS */

Reply via email to