boards/nucleo64: add motor driver
Add motor_driver driver configuration example. The most simple motor driver type is used here (MOTOR_DRIVER_1_DIR) which needs only one pin to work. This example uses already configured PWM channels and 2 free GPIOS. Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
This commit is contained in:
parent
37cfd17de6
commit
f3130a3a81
@ -24,6 +24,7 @@
|
||||
|
||||
#include "board_nucleo.h"
|
||||
#include "arduino_pinmap.h"
|
||||
#include "motor_driver.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -60,6 +61,37 @@ extern "C" {
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Describe DC motors with PWM channel and GPIOs
|
||||
* @{
|
||||
*/
|
||||
static const motor_driver_config_t motor_driver_config[] = {
|
||||
{
|
||||
.pwm_dev = 1,
|
||||
.mode = MOTOR_DRIVER_1_DIR,
|
||||
.mode_brake = MOTOR_BRAKE_HIGH,
|
||||
.pwm_mode = PWM_LEFT,
|
||||
.pwm_frequency = 20000U,
|
||||
.pwm_resolution = 2250U,
|
||||
.nb_motors = 1,
|
||||
.motors = {
|
||||
{
|
||||
.pwm_channel = 0,
|
||||
.gpio_enable = 0,
|
||||
.gpio_dir0 = ARDUINO_PIN_15,
|
||||
.gpio_dir1_or_brake = 0,
|
||||
.gpio_dir_reverse = 0,
|
||||
.gpio_enable_invert = 0,
|
||||
.gpio_brake_invert = 0,
|
||||
},
|
||||
},
|
||||
.cb = NULL,
|
||||
},
|
||||
};
|
||||
|
||||
#define MOTOR_DRIVER_NUMOF (sizeof(motor_driver_config) / sizeof(motor_driver_config[0]))
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -8,6 +8,9 @@ FEATURES_PROVIDED += periph_timer
|
||||
FEATURES_PROVIDED += periph_uart
|
||||
FEATURES_PROVIDED += periph_qdec
|
||||
|
||||
# Various other features (if any)
|
||||
FEATURES_PROVIDED += motor_driver
|
||||
|
||||
# load the common Makefile.features for Nucleo boards
|
||||
include $(RIOTBOARD)/common/nucleo64/Makefile.features
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user