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 4f929d63f35cca6a348533b4c6db90efcd65e0ea Author: raiden00pl <[email protected]> AuthorDate: Wed May 20 13:02:02 2026 +0200 boards/nucleo-h743zi2: add pulse count example add pulse count example for nucleo-h743zi2 Signed-off-by: raiden00pl <[email protected]> --- .../stm32h7/nucleo-h743zi2/configs/jumbo/defconfig | 3 +++ boards/arm/stm32h7/nucleo-h743zi2/include/board.h | 4 ++++ .../arm/stm32h7/nucleo-h743zi2/src/stm32_bringup.c | 25 ++++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/boards/arm/stm32h7/nucleo-h743zi2/configs/jumbo/defconfig b/boards/arm/stm32h7/nucleo-h743zi2/configs/jumbo/defconfig index de5ac1f5cd3..23c77196423 100644 --- a/boards/arm/stm32h7/nucleo-h743zi2/configs/jumbo/defconfig +++ b/boards/arm/stm32h7/nucleo-h743zi2/configs/jumbo/defconfig @@ -38,6 +38,7 @@ CONFIG_EXAMPLES_BUTTONS_NAME0="B1" CONFIG_EXAMPLES_BUTTONS_NAMES=y CONFIG_EXAMPLES_BUTTONS_QTD=1 CONFIG_EXAMPLES_HIDKBD=y +CONFIG_EXAMPLES_PULSECOUNT=y CONFIG_EXAMPLES_TOUCHSCREEN=y CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/mouse0" CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE=y @@ -113,6 +114,8 @@ CONFIG_STM32H7_PHYSR_10FD=0x0014 CONFIG_STM32H7_PHYSR_10HD=0x0004 CONFIG_STM32H7_PHYSR_ALTCONFIG=y CONFIG_STM32H7_PHYSR_ALTMODE=0x001c +CONFIG_STM32H7_TIM8=y +CONFIG_STM32H7_TIM8_PULSECOUNT=y CONFIG_STM32H7_USART3=y CONFIG_SYSLOG_INTBUFFER=y CONFIG_SYSLOG_PRIORITY=y diff --git a/boards/arm/stm32h7/nucleo-h743zi2/include/board.h b/boards/arm/stm32h7/nucleo-h743zi2/include/board.h index a9c0a0cb70e..9f065157632 100644 --- a/boards/arm/stm32h7/nucleo-h743zi2/include/board.h +++ b/boards/arm/stm32h7/nucleo-h743zi2/include/board.h @@ -410,6 +410,10 @@ #define GPIO_TIM4_CH1IN (GPIO_TIM4_CH1IN_2|GPIO_SPEED_50MHz) /* PD12 */ #define GPIO_TIM4_CH2IN (GPIO_TIM4_CH2IN_2|GPIO_SPEED_50MHz) /* PD13 */ +/* TIM8 */ + +#define GPIO_TIM8_CH1OUT (GPIO_TIM8_CH1OUT_1|GPIO_SPEED_50MHz) /* PC6 */ + /* FDCAN1 */ #define GPIO_CAN1_RX (GPIO_CAN1_RX_3|GPIO_SPEED_50MHz) /* PD0 */ diff --git a/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_bringup.c b/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_bringup.c index aa17bd7856f..f0d0a7df159 100644 --- a/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_bringup.c +++ b/boards/arm/stm32h7/nucleo-h743zi2/src/stm32_bringup.c @@ -43,6 +43,10 @@ #include "stm32_fdcan_sock.h" #endif +#ifdef CONFIG_PULSECOUNT +#include "stm32_pulsecount.h" +#endif + #ifdef CONFIG_SYSTEMTICK_HOOK #include <semaphore.h> #endif @@ -74,6 +78,9 @@ int stm32_bringup(void) { +#ifdef CONFIG_PULSECOUNT + struct pulsecount_lowerhalf_s *pulsecount; +#endif int ret; #ifdef CONFIG_RAMMTD uint8_t *ramstart; @@ -204,6 +211,24 @@ int stm32_bringup(void) } #endif /* CONFIG_ADC */ +#ifdef CONFIG_PULSECOUNT + /* Initialize and register the pulse count driver. */ + + pulsecount = stm32_pulsecountinitialize(8); + if (pulsecount == NULL) + { + syslog(LOG_ERR, "ERROR: stm32_pulsecountinitialize failed\n"); + return -ENODEV; + } + + ret = pulsecount_register("/dev/pulsecount0", pulsecount); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: pulsecount_register failed: %d\n", ret); + return ret; + } +#endif + #ifdef CONFIG_DEV_GPIO /* Register the GPIO driver */
