32 #ifndef MOTOR_DRIVER_PARAM_MODE
34 # define MOTOR_DRIVER_PARAM_MODE MOTOR_DRIVER_1_DIR
36 #ifndef MOTOR_DRIVER_PARAM_BRAKE_INVERTED
38 # define MOTOR_DRIVER_PARAM_BRAKE_INVERTED false
40 #ifndef MOTOR_DRIVER_PARAM_ENABLE_INVERTED
42 # define MOTOR_DRIVER_PARAM_ENABLE_INVERTED false
44 #ifndef MOTOR_DRIVER_PARAM_PWM
46 # define MOTOR_DRIVER_PARAM_PWM 0
48 #ifndef MOTOR_DRIVER_PARAM_PWM_MODE
50 # define MOTOR_DRIVER_PARAM_PWM_MODE PWM_LEFT
52 #ifndef MOTOR_DRIVER_PARAM_PWM_FREQUENCY
54 # define MOTOR_DRIVER_PARAM_PWM_FREQUENCY 20000U
56 #ifndef MOTOR_DRIVER_PARAM_PWM_RESOLUTION
58 # define MOTOR_DRIVER_PARAM_PWM_RESOLUTION 100U
60 #ifndef MOTOR_DRIVER_PARAM_NB_MOTORS
62 # define MOTOR_DRIVER_PARAM_NB_MOTORS 2U
64 #ifndef MOTOR_DRIVER_PARAM_MOTOR_SET_POST_CALLBACK
66 # define MOTOR_DRIVER_PARAM_MOTOR_SET_POST_CALLBACK NULL
70 #ifndef MOTOR_DRIVER_PARAM_MOTOR1_PWM_CHANNEL
72 # define MOTOR_DRIVER_PARAM_MOTOR1_PWM_CHANNEL 1U
74 #ifndef MOTOR_DRIVER_PARAM_MOTOR1_GPIO_ENABLE
76 # define MOTOR_DRIVER_PARAM_MOTOR1_GPIO_ENABLE GPIO_UNDEF
78 #ifndef MOTOR_DRIVER_PARAM_MOTOR1_GPIO_DIR0
80 # define MOTOR_DRIVER_PARAM_MOTOR1_GPIO_DIR0 GPIO_UNDEF
82 #ifndef MOTOR_DRIVER_PARAM_MOTOR1_GPIO_DIR1_OR_BRAKE
84 # define MOTOR_DRIVER_PARAM_MOTOR1_GPIO_DIR1_OR_BRAKE GPIO_UNDEF
86 #ifndef MOTOR_DRIVER_PARAM_MOTOR1_GPIO_DIR_REVERSE
88 # define MOTOR_DRIVER_PARAM_MOTOR1_GPIO_DIR_REVERSE 0
92 #ifndef MOTOR_DRIVER_PARAM_MOTOR2_PWM_CHANNEL
94 # define MOTOR_DRIVER_PARAM_MOTOR2_PWM_CHANNEL 2U
96 #ifndef MOTOR_DRIVER_PARAM_MOTOR2_GPIO_ENABLE
98 # define MOTOR_DRIVER_PARAM_MOTOR2_GPIO_ENABLE GPIO_UNDEF
100 #ifndef MOTOR_DRIVER_PARAM_MOTOR2_GPIO_DIR0
102 # define MOTOR_DRIVER_PARAM_MOTOR2_GPIO_DIR0 GPIO_UNDEF
104 #ifndef MOTOR_DRIVER_PARAM_MOTOR2_GPIO_DIR1_OR_BRAKE
106 # define MOTOR_DRIVER_PARAM_MOTOR2_GPIO_DIR1_OR_BRAKE GPIO_UNDEF
108 #ifndef MOTOR_DRIVER_PARAM_MOTOR2_GPIO_DIR_REVERSE
110 # define MOTOR_DRIVER_PARAM_MOTOR2_GPIO_DIR_REVERSE 0
113 #ifndef MOTOR_DRIVER_PARAMS
115 # define MOTOR_DRIVER_PARAMS \
117 .mode = MOTOR_DRIVER_PARAM_MODE, \
118 .pwm_dev = MOTOR_DRIVER_PARAM_PWM, \
119 .pwm_mode = MOTOR_DRIVER_PARAM_PWM_MODE, \
120 .pwm_frequency = MOTOR_DRIVER_PARAM_PWM_FREQUENCY, \
121 .pwm_resolution = MOTOR_DRIVER_PARAM_PWM_RESOLUTION, \
122 .brake_inverted = MOTOR_DRIVER_PARAM_BRAKE_INVERTED, \
123 .enable_inverted = MOTOR_DRIVER_PARAM_ENABLE_INVERTED, \
124 .nb_motors = MOTOR_DRIVER_PARAM_NB_MOTORS, \
127 .pwm_channel = MOTOR_DRIVER_PARAM_MOTOR1_PWM_CHANNEL, \
128 .gpio_enable = MOTOR_DRIVER_PARAM_MOTOR1_GPIO_ENABLE, \
129 .gpio_dir0 = MOTOR_DRIVER_PARAM_MOTOR1_GPIO_DIR0, \
130 .gpio_dir1 = MOTOR_DRIVER_PARAM_MOTOR1_GPIO_DIR1_OR_BRAKE, \
131 .gpio_dir_reverse = MOTOR_DRIVER_PARAM_MOTOR1_GPIO_DIR_REVERSE, \
134 .pwm_channel = MOTOR_DRIVER_PARAM_MOTOR2_PWM_CHANNEL, \
135 .gpio_enable = MOTOR_DRIVER_PARAM_MOTOR2_GPIO_ENABLE, \
136 .gpio_dir0 = MOTOR_DRIVER_PARAM_MOTOR2_GPIO_DIR0, \
137 .gpio_dir1 = MOTOR_DRIVER_PARAM_MOTOR2_GPIO_DIR1_OR_BRAKE, \
138 .gpio_dir_reverse = MOTOR_DRIVER_PARAM_MOTOR2_GPIO_DIR_REVERSE, \
141 .motor_set_post_cb = MOTOR_DRIVER_PARAM_MOTOR_SET_POST_CALLBACK \
146 #ifndef MOTOR_DRIVER_SAUL_INFO
148 # define MOTOR_DRIVER_SAUL_INFO { .name = "motor_driver" }
#define MOTOR_DRIVER_PARAMS
Default motor driver parameters.
static const saul_reg_info_t motor_driver_saul_info[]
Additional meta information to keep in the SAUL registry.
static const motor_driver_params_t motor_driver_params[]
MOTOR_DRIVER configuration.
#define MOTOR_DRIVER_SAUL_INFO
SAUL information.
High-level driver for DC motors.
SAUL registry interface definition.
Describe DC motor driver with PWM device and motors array.
Additional data to collect for each entry.