mirror of
https://github.com/apache/nuttx.git
synced 2026-08-19 12:38:18 +00:00
boards/nucleo-c092rc: add pulse count example
add pulse count example for nucleo-c092rc Signed-off-by: raiden00pl <raiden00@railab.me>
This commit is contained in:
parent
d54ed68aa0
commit
a8f8979bfe
3 changed files with 35 additions and 0 deletions
|
|
@ -36,6 +36,7 @@ CONFIG_EXAMPLES_ADC_GROUPSIZE=2
|
|||
CONFIG_EXAMPLES_ADC_SWTRIG=y
|
||||
CONFIG_EXAMPLES_BUTTONS=y
|
||||
CONFIG_EXAMPLES_HELLO=y
|
||||
CONFIG_EXAMPLES_PULSECOUNT=y
|
||||
CONFIG_EXAMPLES_PWM=y
|
||||
CONFIG_EXAMPLES_PWM_DEVPATH="/dev/pwm13"
|
||||
CONFIG_EXAMPLES_QENCODER=y
|
||||
|
|
@ -77,6 +78,8 @@ CONFIG_STM32F0L0G0_TIM14=y
|
|||
CONFIG_STM32F0L0G0_TIM14_CH1OUT=y
|
||||
CONFIG_STM32F0L0G0_TIM14_CHANNEL1=y
|
||||
CONFIG_STM32F0L0G0_TIM14_PWM=y
|
||||
CONFIG_STM32F0L0G0_TIM1=y
|
||||
CONFIG_STM32F0L0G0_TIM1_PULSECOUNT=y
|
||||
CONFIG_STM32F0L0G0_TIM3=y
|
||||
CONFIG_STM32F0L0G0_TIM3_QE=y
|
||||
CONFIG_STM32F0L0G0_USART2=y
|
||||
|
|
|
|||
|
|
@ -187,6 +187,12 @@
|
|||
|
||||
#define GPIO_TIM14_CH1OUT (GPIO_TIM14_CH1OUT_2|GPIO_SPEED_HIGH)
|
||||
|
||||
/* Pulse count on TIM1:
|
||||
* TIM1_CH1OUT - PA8 (D7)
|
||||
*/
|
||||
|
||||
#define GPIO_TIM1_CH1OUT (GPIO_TIM1_CH1OUT_3|GPIO_SPEED_HIGH)
|
||||
|
||||
/* DMA channels *************************************************************/
|
||||
|
||||
/* ADC */
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <nuttx/debug.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef CONFIG_INPUT_BUTTONS
|
||||
|
|
@ -42,6 +43,10 @@
|
|||
# include <stm32_wdg.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PULSECOUNT
|
||||
# include "stm32_pulsecount.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSORS_QENCODER
|
||||
# include "board_qencoder.h"
|
||||
#endif
|
||||
|
|
@ -75,6 +80,9 @@
|
|||
|
||||
int stm32_bringup(void)
|
||||
{
|
||||
#ifdef CONFIG_PULSECOUNT
|
||||
struct pulsecount_lowerhalf_s *pulsecount;
|
||||
#endif
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_STM32F0L0G0_IWDG
|
||||
|
|
@ -83,6 +91,24 @@ int stm32_bringup(void)
|
|||
stm32_iwdginitialize("/dev/watchdog0", STM32_LSI_FREQUENCY);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PULSECOUNT
|
||||
/* Initialize and register the pulse count driver. */
|
||||
|
||||
pulsecount = stm32_pulsecountinitialize(1);
|
||||
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
|
||||
|
||||
#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER)
|
||||
/* Register the LED driver */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue