High-level driver for DC motors. More...
High-level driver for DC motors.
Definition in file motor_driver.h.
Include dependency graph for motor_driver.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | motor_t |
| Describe DC motor with PWM channel and GPIOs. More... | |
| struct | motor_driver_params_t |
| Describe DC motor driver with PWM device and motors array. More... | |
| struct | _motor_driver_t |
| Motor driver. More... | |
Macros | |
| #define | CONFIG_MOTOR_DRIVER_MAX (2) |
| Maximum number of motors by motor driver. | |
Typedefs | |
| typedef struct _motor_driver_t | motor_driver_t |
| Motor driver. | |
| typedef void(* | motor_set_post_cb_t) (const motor_driver_t *motor_driver, uint8_t motor_id, int32_t pwm_duty_cycle) |
| Motor callback. More... | |
| typedef void(* | motor_set_cb_t) (const motor_t *motor, motor_direction_t direction) |
| Motor set callback. More... | |
| typedef void(* | motor_brake_cb_t) (const motor_t *motor, bool brake) |
| Motor brake callback. More... | |
Enumerations | |
| enum | motor_driver_mode_t { MOTOR_DRIVER_2_DIRS = 0 , MOTOR_DRIVER_1_DIR = 1 , MOTOR_DRIVER_1_DIR_BRAKE = 2 } |
| Describe DC motor driver modes. More... | |
| enum | motor_direction_t { MOTOR_CW = 0 , MOTOR_CCW = 1 } |
| Describe DC motor direction states. More... | |
Functions | |
| int | motor_driver_init (motor_driver_t *motor_driver, const motor_driver_params_t *params) |
| Initialize DC motor driver board. More... | |
| int | motor_set (const motor_driver_t *motor_driver, uint8_t motor_id, int32_t pwm_duty_cycle) |
| Set motor speed and direction. More... | |
| int | motor_brake (const motor_driver_t *motor_driver, uint8_t motor_id) |
| Brake the motor of a given motor driver. More... | |
| void | motor_enable (const motor_driver_t *motor_driver, uint8_t motor_id) |
| Enable a motor of a given motor driver. More... | |
| void | motor_disable (const motor_driver_t *motor_driver, uint8_t motor_id) |
| Disable a motor of a given motor driver. More... | |