mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 13:55:18 +03:00
STM32F30x - Enable serial PWM (PPM) input on PWM1.
This might also fix parallel PWM input too, but untested.
This commit is contained in:
parent
133f75a17b
commit
fbe2f82c05
6 changed files with 84 additions and 40 deletions
|
@ -13,7 +13,9 @@
|
|||
|
||||
#include "pwm_common.h"
|
||||
/*
|
||||
Configuration maps:
|
||||
Configuration maps
|
||||
|
||||
Note: this documentation is only valid for STM32F10x, for STM32F30x please read the code itself.
|
||||
|
||||
1) multirotor PPM input
|
||||
PWM1 used for PPM
|
||||
|
@ -250,7 +252,7 @@ static pwmPortData_t *pwmInConfig(uint8_t port, timerCCCallbackPtr callback, uin
|
|||
|
||||
p->channel = channel;
|
||||
|
||||
pwmGPIOConfig(timerHardwarePtr->gpio, timerHardwarePtr->pin, Mode_IPD);
|
||||
pwmGPIOConfig(timerHardwarePtr->gpio, timerHardwarePtr->pin, timerHardwarePtr->gpioInputMode);
|
||||
pwmICConfig(timerHardwarePtr->tim, timerHardwarePtr->channel, TIM_ICPolarity_Rising);
|
||||
|
||||
timerConfigure(timerHardwarePtr, 0xFFFF, PWM_TIMER_MHZ);
|
||||
|
@ -372,10 +374,17 @@ void pwmInit(drv_pwm_config_t *init, failsafe_t *initialFailsafe)
|
|||
mask = 0;
|
||||
|
||||
if (init->useServos && !init->airplane) {
|
||||
// remap PWM9+10 as servos (but not in airplane mode LOL)
|
||||
#ifdef STM32F10X_MD
|
||||
// remap PWM9+10 as servos
|
||||
if (port == PWM9 || port == PWM10)
|
||||
mask = TYPE_S;
|
||||
}
|
||||
#endif
|
||||
#ifdef STM32F303xC
|
||||
// remap PWM5+6 as servos
|
||||
if (port == PWM5 || port == PWM6)
|
||||
mask = TYPE_S;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (init->extraServos && !init->airplane) {
|
||||
// remap PWM5..8 as servos when used in extended servo mode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue