29 #include "subsystems/actuators/actuators_dualpwm_arch.h"
32 #include <libopencm3/stm32/gpio.h>
33 #include <libopencm3/stm32/rcc.h>
34 #include <libopencm3/stm32/timer.h>
35 #include <libopencm3/cm3/nvic.h>
37 #include "mcu_periph/gpio_arch.h"
53 rcc_periph_clock_enable(RCC_TIM1);
56 rcc_periph_clock_enable(RCC_TIM2);
59 rcc_periph_clock_enable(RCC_TIM3);
62 rcc_periph_clock_enable(RCC_TIM4);
65 rcc_periph_clock_enable(RCC_TIM5);
68 rcc_periph_clock_enable(RCC_TIM8);
71 rcc_periph_clock_enable(RCC_TIM9);
74 rcc_periph_clock_enable(RCC_TIM12);
80 #ifdef DUAL_PWM_SERVO_5
83 #ifdef DUAL_PWM_SERVO_6
90 nvic_set_priority(NVIC_TIM5_IRQ, 2);
91 nvic_enable_irq(NVIC_TIM5_IRQ);
92 timer_enable_irq(TIM5, TIM_DIER_CC1IE);
104 #if DUAL_PWM_USE_TIM5
120 #if DUAL_PWM_USE_TIM5
121 timer_clear_flag(TIM5, TIM_SR_CC1IF);
129 #if DUAL_PWM_USE_TIM5
130 timer_set_period(TIM5, period);
138 #if DUAL_PWM_USE_TIM5
139 timer_set_oc_value(DUAL_PWM_SERVO_5_TIMER, DUAL_PWM_SERVO_5_OC, oc_value);
140 timer_set_oc_value(DUAL_PWM_SERVO_6_TIMER, DUAL_PWM_SERVO_6_OC, oc_value2);
150 static int num_pulse = 0;
154 if (num_pulse == 1) {