33 #include "modules/actuators/actuators_pwm_arch.h"
39 #define PWM_FREQUENCY 1000000
49 #define TIM1_SERVO_HZ SERVO_HZ
52 #define TIM2_SERVO_HZ SERVO_HZ
55 #define TIM3_SERVO_HZ SERVO_HZ
58 #define TIM4_SERVO_HZ SERVO_HZ
61 #define TIM5_SERVO_HZ SERVO_HZ
64 #define TIM8_SERVO_HZ SERVO_HZ
67 #define TIM9_SERVO_HZ SERVO_HZ
69 #ifndef TIM12_SERVO_HZ
70 #define TIM12_SERVO_HZ SERVO_HZ
89 #define PWM_CMD_TO_US(_t) (PWM_FREQUENCY * _t / 1000000)
103 __attribute__((unused))
static void pwmpcb(PWMDriver *pwmp __attribute__((unused))) {}
106 static PWMConfig pwmcfg1 = {
111 { PWM_OUTPUT_DISABLED, NULL },
112 { PWM_OUTPUT_DISABLED, NULL },
113 { PWM_OUTPUT_DISABLED, NULL },
114 { PWM_OUTPUT_DISABLED, NULL },
122 static PWMConfig pwmcfg2 = {
127 { PWM_OUTPUT_DISABLED, NULL },
128 { PWM_OUTPUT_DISABLED, NULL },
129 { PWM_OUTPUT_DISABLED, NULL },
130 { PWM_OUTPUT_DISABLED, NULL },
138 static PWMConfig pwmcfg3 = {
143 { PWM_OUTPUT_DISABLED, NULL },
144 { PWM_OUTPUT_DISABLED, NULL },
145 { PWM_OUTPUT_DISABLED, NULL },
146 { PWM_OUTPUT_DISABLED, NULL },
154 static PWMConfig pwmcfg4 = {
159 { PWM_OUTPUT_DISABLED, NULL },
160 { PWM_OUTPUT_DISABLED, NULL },
161 { PWM_OUTPUT_DISABLED, NULL },
162 { PWM_OUTPUT_DISABLED, NULL },
170 static PWMConfig pwmcfg5 = {
175 { PWM_OUTPUT_DISABLED, NULL },
176 { PWM_OUTPUT_DISABLED, NULL },
177 { PWM_OUTPUT_DISABLED, NULL },
178 { PWM_OUTPUT_DISABLED, NULL },
186 static PWMConfig pwmcfg8 = {
191 { PWM_OUTPUT_DISABLED, NULL },
192 { PWM_OUTPUT_DISABLED, NULL },
193 { PWM_OUTPUT_DISABLED, NULL },
194 { PWM_OUTPUT_DISABLED, NULL },
202 static PWMConfig pwmcfg9 = {
207 { PWM_OUTPUT_DISABLED, NULL },
208 { PWM_OUTPUT_DISABLED, NULL },
209 { PWM_OUTPUT_DISABLED, NULL },
210 { PWM_OUTPUT_DISABLED, NULL },
218 static PWMConfig pwmcfg10 = {
223 { PWM_OUTPUT_DISABLED, NULL },
224 { PWM_OUTPUT_DISABLED, NULL },
225 { PWM_OUTPUT_DISABLED, NULL },
226 { PWM_OUTPUT_DISABLED, NULL },
234 static PWMConfig pwmcfg11 = {
239 { PWM_OUTPUT_DISABLED, NULL },
240 { PWM_OUTPUT_DISABLED, NULL },
241 { PWM_OUTPUT_DISABLED, NULL },
242 { PWM_OUTPUT_DISABLED, NULL },
250 static PWMConfig pwmcfg12 = {
255 { PWM_OUTPUT_DISABLED, NULL },
256 { PWM_OUTPUT_DISABLED, NULL },
257 { PWM_OUTPUT_DISABLED, NULL },
258 { PWM_OUTPUT_DISABLED, NULL },
318 PWM_SERVO_11_CONF.channels[PWM_SERVO_11_CHANNEL].mode = PWM_OUTPUT_ACTIVE_HIGH;
322 PWM_SERVO_12_CONF.channels[PWM_SERVO_12_CHANNEL].mode = PWM_OUTPUT_ACTIVE_HIGH;
326 PWM_SERVO_13_CONF.channels[PWM_SERVO_13_CHANNEL].mode = PWM_OUTPUT_ACTIVE_HIGH;
330 PWM_SERVO_14_CONF.channels[PWM_SERVO_14_CHANNEL].mode = PWM_OUTPUT_ACTIVE_HIGH;
334 PWM_SERVO_15_CONF.channels[PWM_SERVO_15_CHANNEL].mode = PWM_OUTPUT_ACTIVE_HIGH;
338 PWM_SERVO_16_CONF.channels[PWM_SERVO_16_CHANNEL].mode = PWM_OUTPUT_ACTIVE_HIGH;
345 pwmStart(&PWMD1, &pwmcfg1);
348 pwmStart(&PWMD2, &pwmcfg2);
351 pwmStart(&PWMD3, &pwmcfg3);
354 pwmStart(&PWMD4, &pwmcfg4);
357 pwmStart(&PWMD5, &pwmcfg5);
360 pwmStart(&PWMD8, &pwmcfg8);
363 pwmStart(&PWMD9, &pwmcfg9);
366 pwmStart(&PWMD10, &pwmcfg10);
369 pwmStart(&PWMD11, &pwmcfg11);
372 pwmStart(&PWMD12, &pwmcfg12);
#define PWM_SERVO_1_CHANNEL
#define PWM_SERVO_5_CHANNEL
#define PWM_SERVO_5_DRIVER
#define PWM_SERVO_3_CHANNEL
#define PWM_SERVO_0_CHANNEL
#define PWM_SERVO_3_DRIVER
#define PWM_SERVO_4_CHANNEL
#define PWM_SERVO_2_DRIVER
#define PWM_SERVO_1_DRIVER
#define PWM_SERVO_2_CHANNEL
#define PWM_SERVO_4_DRIVER
#define PWM_SERVO_0_DRIVER
void gpio_setup_pin_af(ioportid_t port, uint16_t pin, uint8_t af, bool is_output)
Setup a gpio for input or output with alternate function.
int32_t actuators_pwm_values[ACTUATORS_PWM_NB]
#define PWM_CMD_TO_US(_t)
Print the configuration variables from the header.
static void pwmpcb(PWMDriver *pwmp)
PWM callback function.
void actuators_pwm_arch_init(void)
Arch dependent init file.
void actuators_pwm_commit(void)
Some architecture independent helper functions for GPIOs.
#define PWM_SERVO_6_DRIVER
#define PWM_SERVO_6_CHANNEL
#define PWM_SERVO_10_GPIO
#define PWM_SERVO_7_CHANNEL
#define PWM_SERVO_10_DRIVER
#define PWM_SERVO_10_CONF
#define PWM_SERVO_8_CHANNEL
#define PWM_SERVO_7_DRIVER
#define PWM_SERVO_8_DRIVER
#define PWM_SERVO_9_DRIVER
#define PWM_SERVO_10_CHANNEL
#define PWM_SERVO_9_CHANNEL
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
int int32_t
Typedef defining 32 bit int type.