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

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

commit fc394600b166d60619df8c58ca9086b954c7c144
Author: Liam Howatt <[email protected]>
AuthorDate: Thu Aug 13 16:39:35 2026 -0400

    boards/stm32h5/nucleo-h563zi: Add button irq and config.
    
    Add the missing board_button_irq.
    Create a defconfig based on nsh that enables:
      ARCH_IRQBUTTONS
      EXAMPLES_BUTTONS
      INPUT
      INPUT_BUTTONS
      INPUT_BUTTONS_LOWER
    
    Signed-off-by: Liam Howatt <[email protected]>
---
 .../nucleo-h563zi/configs/buttons/defconfig        | 54 ++++++++++++++++++++++
 .../arm/stm32h5/nucleo-h563zi/src/stm32_buttons.c  | 36 +++++++++++++++
 2 files changed, 90 insertions(+)

diff --git a/boards/arm/stm32h5/nucleo-h563zi/configs/buttons/defconfig 
b/boards/arm/stm32h5/nucleo-h563zi/configs/buttons/defconfig
new file mode 100644
index 00000000000..88ef9553b8e
--- /dev/null
+++ b/boards/arm/stm32h5/nucleo-h563zi/configs/buttons/defconfig
@@ -0,0 +1,54 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed 
.config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that 
includes your
+# modifications.
+#
+# CONFIG_NSH_ARGCAT is not set
+# CONFIG_STANDARD_SERIAL is not set
+CONFIG_ARCH="arm"
+CONFIG_ARCH_BOARD="nucleo-h563zi"
+CONFIG_ARCH_BOARD_NUCLEO_H563ZI=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_CHIP="stm32h5"
+CONFIG_ARCH_CHIP_STM32=y
+CONFIG_ARCH_CHIP_STM32H563ZI=y
+CONFIG_ARCH_CHIP_STM32H5=y
+CONFIG_ARCH_INTERRUPTSTACK=2048
+CONFIG_ARCH_IRQBUTTONS=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARMV8M_STACKCHECK=y
+CONFIG_BOARD_LOOPSPERMSEC=9251
+CONFIG_BUILTIN=y
+CONFIG_DEBUG_ASSERTIONS=y
+CONFIG_DEBUG_FEATURES=y
+CONFIG_DEBUG_SYMBOLS=y
+CONFIG_EXAMPLES_BUTTONS=y
+CONFIG_FS_PROCFS=y
+CONFIG_FS_PROCFS_REGISTER=y
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_IDLETHREAD_STACKSIZE=2048
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INPUT=y
+CONFIG_INPUT_BUTTONS=y
+CONFIG_INPUT_BUTTONS_LOWER=y
+CONFIG_LINE_MAX=64
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_DISABLE_IFUPDOWN=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_READLINE=y
+CONFIG_PREALLOC_TIMERS=4
+CONFIG_RAM_SIZE=655360
+CONFIG_RAM_START=0x20000000
+CONFIG_RAW_BINARY=y
+CONFIG_READLINE_CMD_HISTORY=y
+CONFIG_READLINE_TABCOMPLETION=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_WAITPID=y
+CONFIG_STACK_COLORATION=y
+CONFIG_STM32_USART3=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_USART3_SERIAL_CONSOLE=y
diff --git a/boards/arm/stm32h5/nucleo-h563zi/src/stm32_buttons.c 
b/boards/arm/stm32h5/nucleo-h563zi/src/stm32_buttons.c
index 6549c3cce1e..d0899271aaf 100644
--- a/boards/arm/stm32h5/nucleo-h563zi/src/stm32_buttons.c
+++ b/boards/arm/stm32h5/nucleo-h563zi/src/stm32_buttons.c
@@ -76,4 +76,40 @@ uint32_t board_buttons(void)
   return stm32_gpioread(GPIO_BTN_USER) ? BUTTON_USER_BIT : 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