Go to the documentation of this file.
84 #ifndef MOTOR_DRIVER_H
85 #define MOTOR_DRIVER_H
102 #ifndef CONFIG_MOTOR_DRIVER_MAX
103 #define CONFIG_MOTOR_DRIVER_MAX (2)
110 #define MOTOR_DRIVER_DEV(x) (x)
163 int32_t pwm_duty_cycle);
201 int32_t pwm_duty_cycle);
motor_driver_mode_brake_t
Describe DC motor driver brake modes.
pwm_t pwm_dev
PWM device driving motors.
Describe DC motor with PWM channel and GPIOs.
void(* motor_driver_cb_t)(const motor_driver_t motor_driver, uint8_t motor_id, int32_t pwm_duty_cycle)
Motor callback.
int pwm_channel
PWM channel the motor is connected to.
@ MOTOR_BRAKE_HIGH
High stage brake.
void motor_disable(const motor_driver_t motor_driver, uint8_t motor_id)
Disable a motor of a given motor driver.
@ MOTOR_DRIVER_1_DIR
Single GPIO for direction, \ no BRAKE.
@ MOTOR_BRAKE_LOW
Low stage brake.
uint8_t gpio_dir_reverse
flag to reverse direction
int motor_set(const motor_driver_t motor_driver, uint8_t motor_id, int32_t pwm_duty_cycle)
Set motor speed and direction.
@ MOTOR_CCW
counter clockwise
motor_driver_mode_t mode
driver mode
uint32_t pwm_frequency
PWM device frequency.
unsigned int motor_driver_t
Default motor driver type definition.
motor_direction_t
Describe DC motor direction states.
pwm_mode_t pwm_mode
PWM mode.
void motor_enable(const motor_driver_t motor_driver, uint8_t motor_id)
Enable a motor of a given motor driver.
@ MOTOR_DRIVER_2_DIRS
2 GPIOS for direction, \ handling BRAKE
uint32_t pwm_resolution
PWM device resolution.
Describe DC motor driver with PWM device and motors array.
int motor_driver_init(const motor_driver_t motor_driver)
Initialize DC motor driver board.
@ MOTOR_DRIVER_1_DIR_BRAKE
Single GPIO for direction, \ Single GPIO for BRAKE.
motor_driver_cb_t cb
callback on motor_set
int motor_brake(const motor_driver_t motor_driver, uint8_t motor_id)
Brake the motor of a given motor driver.
uint8_t gpio_enable_invert
flag to set enable GPIO inverted mode
Low-level GPIO peripheral driver interface definitions.
motor_driver_mode_t
Describe DC motor driver modes.
gpio_t gpio_dir1_or_brake
GPIO to control rotation direction.
motor_driver_mode_brake_t mode_brake
driver brake mode
#define CONFIG_MOTOR_DRIVER_MAX
Maximum number of motors by motor driver.
gpio_t gpio_dir0
GPIO to control rotation direction.
Low-level PWM peripheral driver interface definitions.
unsigned int pwm_t
Default PWM type definition.
gpio_t gpio_enable
GPIO to enable/disable motor.
uint8_t gpio_brake_invert
flag to make brake active low
uint8_t nb_motors
number of moros