mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 03:20:00 +03:00
changed pwmGPIOConfig() signature to better show that last parameter is pin mode.
git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@380 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
parent
0664b3005d
commit
fbef1aa284
1 changed files with 4 additions and 7 deletions
|
@ -264,15 +264,12 @@ static void pwmICConfig(TIM_TypeDef *tim, uint8_t channel, uint16_t polarity)
|
||||||
TIM_ICInit(tim, &TIM_ICInitStructure);
|
TIM_ICInit(tim, &TIM_ICInitStructure);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pwmGPIOConfig(GPIO_TypeDef *gpio, uint32_t pin, uint8_t input)
|
static void pwmGPIOConfig(GPIO_TypeDef *gpio, uint32_t pin, GPIO_Mode mode)
|
||||||
{
|
{
|
||||||
gpio_config_t cfg;
|
gpio_config_t cfg;
|
||||||
|
|
||||||
cfg.pin = pin;
|
cfg.pin = pin;
|
||||||
if (input)
|
cfg.mode = mode;
|
||||||
cfg.mode = Mode_IPD;
|
|
||||||
else
|
|
||||||
cfg.mode = Mode_AF_PP;
|
|
||||||
cfg.speed = Speed_2MHz;
|
cfg.speed = Speed_2MHz;
|
||||||
gpioInit(gpio, &cfg);
|
gpioInit(gpio, &cfg);
|
||||||
}
|
}
|
||||||
|
@ -281,7 +278,7 @@ static pwmPortData_t *pwmOutConfig(uint8_t port, uint16_t period, uint16_t value
|
||||||
{
|
{
|
||||||
pwmPortData_t *p = &pwmPorts[port];
|
pwmPortData_t *p = &pwmPorts[port];
|
||||||
pwmTimeBase(timerHardware[port].tim, period);
|
pwmTimeBase(timerHardware[port].tim, period);
|
||||||
pwmGPIOConfig(timerHardware[port].gpio, timerHardware[port].pin, 0);
|
pwmGPIOConfig(timerHardware[port].gpio, timerHardware[port].pin, Mode_AF_PP);
|
||||||
pwmOCConfig(timerHardware[port].tim, timerHardware[port].channel, value);
|
pwmOCConfig(timerHardware[port].tim, timerHardware[port].channel, value);
|
||||||
// Needed only on TIM1
|
// Needed only on TIM1
|
||||||
if (timerHardware[port].outputEnable)
|
if (timerHardware[port].outputEnable)
|
||||||
|
@ -309,7 +306,7 @@ static pwmPortData_t *pwmInConfig(uint8_t port, pwmCallbackPtr callback, uint8_t
|
||||||
{
|
{
|
||||||
pwmPortData_t *p = &pwmPorts[port];
|
pwmPortData_t *p = &pwmPorts[port];
|
||||||
pwmTimeBase(timerHardware[port].tim, 0xFFFF);
|
pwmTimeBase(timerHardware[port].tim, 0xFFFF);
|
||||||
pwmGPIOConfig(timerHardware[port].gpio, timerHardware[port].pin, 1);
|
pwmGPIOConfig(timerHardware[port].gpio, timerHardware[port].pin, Mode_IPD);
|
||||||
pwmICConfig(timerHardware[port].tim, timerHardware[port].channel, TIM_ICPolarity_Rising);
|
pwmICConfig(timerHardware[port].tim, timerHardware[port].channel, TIM_ICPolarity_Rising);
|
||||||
TIM_Cmd(timerHardware[port].tim, ENABLE);
|
TIM_Cmd(timerHardware[port].tim, ENABLE);
|
||||||
pwmNVICConfig(timerHardware[port].irq);
|
pwmNVICConfig(timerHardware[port].irq);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue