mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 17:48:54 +08:00
boards/nucleo-h743zi2: add pulse count example
add pulse count example for nucleo-h743zi2 Signed-off-by: raiden00pl <raiden00@railab.me>
This commit is contained in:
committed by
Alin Jerpelea
parent
207bddc40f
commit
4f929d63f3
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user