High-level driver for DC motors. More...
High-level driver for DC motors.
Definition in file motor_driver.h.
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_config_t |
Describe DC motor driver with PWM device and motors array. More... | |
Macros | |
#define | CONFIG_MOTOR_DRIVER_MAX (2) |
Maximum number of motors by motor driver. | |
#define | MOTOR_DRIVER_DEV(x) (x) |
Macro to return motor driver id. | |
Typedefs | |
typedef unsigned int | motor_driver_t |
Default motor driver type definition. | |
typedef void(* | motor_driver_cb_t) (const motor_driver_t motor_driver, uint8_t motor_id, int32_t pwm_duty_cycle) |
Motor 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_driver_mode_brake_t { MOTOR_BRAKE_LOW = 0, MOTOR_BRAKE_HIGH = 1 } |
Describe DC motor driver brake modes. More... | |
enum | motor_direction_t { MOTOR_CW = 0, MOTOR_CCW = 1 } |
Describe DC motor direction states. More... | |
Functions | |
int | motor_driver_init (const motor_driver_t motor_driver) |
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... | |