nucleo-f446re: add 3-phase Hall effect sensor support

This commit is contained in:
raiden00pl 2021-08-18 14:05:06 +02:00 committed by Xiang Xiao
parent dbe4cd88dd
commit 06cf12617c
2 changed files with 31 additions and 2 deletions

View File

@ -216,6 +216,17 @@
#define GPIO_FIRE GPIO_BUTTON_2 #define GPIO_FIRE GPIO_BUTTON_2
#define GPIO_JUMP GPIO_BUTTON_3 #define GPIO_JUMP GPIO_BUTTON_3
#ifdef CONFIG_SENSORS_HALL3PHASE
/* GPIO pins used by the 3-phase Hall effect sensor */
# define GPIO_HALL_PHA (GPIO_INPUT | GPIO_SPEED_2MHz | \
GPIO_PORTA | GPIO_PIN15)
# define GPIO_HALL_PHB (GPIO_INPUT | GPIO_SPEED_2MHz | \
GPIO_PORTB | GPIO_PIN3)
# define GPIO_HALL_PHC (GPIO_INPUT | GPIO_SPEED_2MHz | \
GPIO_PORTB | GPIO_PIN10)
#endif
/**************************************************************************** /****************************************************************************
* Public Data * Public Data
****************************************************************************/ ****************************************************************************/

View File

@ -44,11 +44,15 @@
#endif #endif
#ifdef CONFIG_SENSORS_QENCODER #ifdef CONFIG_SENSORS_QENCODER
#include "board_qencoder.h" # include "board_qencoder.h"
#endif
#ifdef CONFIG_SENSORS_HALL3PHASE
# include "board_hall3ph.h"
#endif #endif
#ifdef CONFIG_VIDEO_FB #ifdef CONFIG_VIDEO_FB
#include <nuttx/video/fb.h> # include <nuttx/video/fb.h>
#endif #endif
#include "nucleo-f446re.h" #include "nucleo-f446re.h"
@ -169,6 +173,20 @@ int stm32_bringup(void)
} }
#endif #endif
#ifdef CONFIG_SENSORS_HALL3PHASE
/* Initialize and register the 3-phase Hall effect sensor driver */
ret = board_hall3ph_initialize(0, GPIO_HALL_PHA, GPIO_HALL_PHB,
GPIO_HALL_PHC);
if (ret != OK)
{
syslog(LOG_ERR,
"ERROR: Failed to register the hall : %d\n",
ret);
return ret;
}
#endif
#ifdef CONFIG_INPUT_AJOYSTICK #ifdef CONFIG_INPUT_AJOYSTICK
/* Initialize and register the joystick driver */ /* Initialize and register the joystick driver */