From c524d19890c2339795944c83d685a38f4c5e19a9 Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Fri, 20 Jun 2014 13:46:47 +0200 Subject: [PATCH] [stm32] actuators_pwm: fix for LisaL Thanks to tommy.detoisien for finding this fix. --- .../subsystems/actuators/actuators_dualpwm_arch.c | 10 +++++----- .../stm32/subsystems/actuators/actuators_pwm_arch.c | 9 ++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/sw/airborne/arch/stm32/subsystems/actuators/actuators_dualpwm_arch.c b/sw/airborne/arch/stm32/subsystems/actuators/actuators_dualpwm_arch.c index 108bb9e8346..bf6a76568dd 100644 --- a/sw/airborne/arch/stm32/subsystems/actuators/actuators_dualpwm_arch.c +++ b/sw/airborne/arch/stm32/subsystems/actuators/actuators_dualpwm_arch.c @@ -75,11 +75,6 @@ void actuators_dualpwm_arch_init(void) { /*---------------- * Configure GPIO *----------------*/ -#if defined(STM32F1) - /* TIM3 GPIO for PWM1..4 */ - AFIO_MAPR |= AFIO_MAPR_TIM3_REMAP_FULL_REMAP; -#endif - #ifdef DUAL_PWM_SERVO_5 set_servo_gpio(DUAL_PWM_SERVO_5_GPIO, DUAL_PWM_SERVO_5_PIN, DUAL_PWM_SERVO_5_AF, DUAL_PWM_SERVO_5_RCC); #endif @@ -87,6 +82,11 @@ void actuators_dualpwm_arch_init(void) { set_servo_gpio(DUAL_PWM_SERVO_6_GPIO, DUAL_PWM_SERVO_6_PIN, DUAL_PWM_SERVO_6_AF, DUAL_PWM_SERVO_6_RCC); #endif +#if defined(STM32F1) && PWM_USE_TIM3 + /* TIM3 GPIO for PWM1..4 */ + AFIO_MAPR |= AFIO_MAPR_TIM3_REMAP_FULL_REMAP; +#endif + #if DUAL_PWM_USE_TIM5 set_servo_timer(TIM5, TIM5_SERVO_HZ, PWM_TIM5_CHAN_MASK); diff --git a/sw/airborne/arch/stm32/subsystems/actuators/actuators_pwm_arch.c b/sw/airborne/arch/stm32/subsystems/actuators/actuators_pwm_arch.c index a47b6fed507..a350a1ca728 100644 --- a/sw/airborne/arch/stm32/subsystems/actuators/actuators_pwm_arch.c +++ b/sw/airborne/arch/stm32/subsystems/actuators/actuators_pwm_arch.c @@ -72,11 +72,6 @@ void actuators_pwm_arch_init(void) { /*---------------- * Configure GPIO *----------------*/ -#if defined(STM32F1) - /* TIM3 GPIO for PWM1..4 */ - AFIO_MAPR |= AFIO_MAPR_TIM3_REMAP_FULL_REMAP; -#endif - #ifdef PWM_SERVO_0 set_servo_gpio(PWM_SERVO_0_GPIO, PWM_SERVO_0_PIN, PWM_SERVO_0_AF, PWM_SERVO_0_RCC); #endif @@ -114,6 +109,10 @@ void actuators_pwm_arch_init(void) { set_servo_gpio(PWM_SERVO_11_GPIO, PWM_SERVO_11_PIN, PWM_SERVO_11_AF, PWM_SERVO_11_RCC); #endif +#if defined(STM32F1) && PWM_USE_TIM3 + /* TIM3 GPIO for PWM1..4 */ + AFIO_MAPR |= AFIO_MAPR_TIM3_REMAP_FULL_REMAP; +#endif #if PWM_USE_TIM1 set_servo_timer(TIM1, TIM1_SERVO_HZ, PWM_TIM1_CHAN_MASK);