101#ifndef CONFIG_MOTOR_DRIVER_MAX 
  102#  define CONFIG_MOTOR_DRIVER_MAX  (2) 
  150                                  int32_t pwm_duty_cycle);
 
  210              int32_t pwm_duty_cycle);
 
Low-level GPIO peripheral driver interface definitions.
#define CONFIG_MOTOR_DRIVER_MAX
Maximum number of motors by motor driver.
int motor_set(const motor_driver_t *motor_driver, uint8_t motor_id, int32_t pwm_duty_cycle)
Set motor speed and direction.
void motor_disable(const motor_driver_t *motor_driver, uint8_t motor_id)
Disable a motor of a given motor driver.
int motor_driver_init(motor_driver_t *motor_driver, const motor_driver_params_t *params)
Initialize DC motor driver board.
motor_direction_t
Describe DC motor direction states.
struct _motor_driver_t motor_driver_t
Motor driver.
motor_driver_mode_t
Describe DC motor driver modes.
void motor_enable(const motor_driver_t *motor_driver, uint8_t motor_id)
Enable a motor of a given motor driver.
void(* motor_set_cb_t)(const motor_t *motor, motor_direction_t direction)
Motor set callback.
int motor_brake(const motor_driver_t *motor_driver, uint8_t motor_id)
Brake the motor of a given motor driver.
void(* motor_brake_cb_t)(const motor_t *motor, bool brake)
Motor brake callback.
void(* motor_set_post_cb_t)(const motor_driver_t *motor_driver, uint8_t motor_id, int32_t pwm_duty_cycle)
Motor callback.
@ MOTOR_CCW
counter clockwise
@ MOTOR_DRIVER_1_DIR
single GPIO for direction, \ no brake
@ MOTOR_DRIVER_1_DIR_BRAKE
single GPIO for direction, \ single GPIO for brake
@ MOTOR_DRIVER_2_DIRS
2 GPIOs for direction, \ handling brake
uint_fast8_t pwm_t
Default PWM type definition.
Low-level PWM peripheral driver interface definitions.
const motor_driver_params_t * params
parameters
Describe DC motor driver with PWM device and motors array.
motor_driver_mode_t mode
driver mode
motor_t motors[CONFIG_MOTOR_DRIVER_MAX]
motors array
uint8_t nb_motors
number of motors
pwm_t pwm_dev
PWM device driving motors.
pwm_mode_t pwm_mode
PWM mode.
bool enable_inverted
if false, enable high (1), low (0) otherwise
bool brake_inverted
if false, brake high (1), low (0) otherwise
motor_set_post_cb_t motor_set_post_cb
callback post to motor_set
uint32_t pwm_frequency
PWM device frequency.
uint32_t pwm_resolution
PWM device resolution.
Describe DC motor with PWM channel and GPIOs.
gpio_t gpio_dir0
GPIO to control direction.
int pwm_channel
PWM channel the motor is connected to.
gpio_t gpio_brake
GPIO to control brake.
gpio_t gpio_enable
GPIO to enable/disable motor.
gpio_t gpio_dir1
GPIO to control direction.
bool gpio_dir_reverse
flag to reverse direction