diff --git a/boards/arm/stm32/nucleo-f302r8/src/nucleo-f302r8.h b/boards/arm/stm32/nucleo-f302r8/src/nucleo-f302r8.h index f4c5b164fa8..4e4edf86ac9 100644 --- a/boards/arm/stm32/nucleo-f302r8/src/nucleo-f302r8.h +++ b/boards/arm/stm32/nucleo-f302r8/src/nucleo-f302r8.h @@ -77,6 +77,17 @@ #define NUCLEOF302R8_PWMTIMER 1 +#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 ****************************************************************************/ diff --git a/boards/arm/stm32/nucleo-f302r8/src/stm32_bringup.c b/boards/arm/stm32/nucleo-f302r8/src/stm32_bringup.c index 3b1e172a926..0d81f27d5fe 100644 --- a/boards/arm/stm32/nucleo-f302r8/src/stm32_bringup.c +++ b/boards/arm/stm32/nucleo-f302r8/src/stm32_bringup.c @@ -27,6 +27,8 @@ #include #include +#include + #include #ifdef CONFIG_USERLED @@ -41,6 +43,10 @@ # include "board_qencoder.h" #endif +#ifdef CONFIG_SENSORS_HALL3PHASE +# include "board_hall3ph.h" +#endif + #include "nucleo-f302r8.h" /**************************************************************************** @@ -144,6 +150,20 @@ int stm32_bringup(void) } #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 + UNUSED(ret); return OK; }