mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
LP-519 F1: Manage GPIO_Mode from pios_servo.c to allow universal timer pin configuration with TIM_SERVO_CHANNEL_CONFIG() macro.
This commit is contained in:
parent
8edd7c1d7c
commit
fc6f426e2c
@ -142,19 +142,22 @@ static void PIOS_Servo_SetupBank(uint8_t bank_nr)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GPIO_InitTypeDef init = chan->pin.init;
|
||||||
|
|
||||||
switch (bank->mode) {
|
switch (bank->mode) {
|
||||||
case PIOS_SERVO_BANK_MODE_PWM:
|
case PIOS_SERVO_BANK_MODE_PWM:
|
||||||
case PIOS_SERVO_BANK_MODE_SINGLE_PULSE:
|
case PIOS_SERVO_BANK_MODE_SINGLE_PULSE:
|
||||||
GPIO_Init(chan->pin.gpio, &chan->pin.init);
|
|
||||||
#if defined(STM32F40_41xxx) || defined(STM32F446xx) || defined(STM32F411xE)
|
#if defined(STM32F40_41xxx) || defined(STM32F446xx) || defined(STM32F411xE)
|
||||||
GPIO_PinAFConfig(chan->pin.gpio, chan->pin.pin_source, chan->remap);
|
GPIO_PinAFConfig(chan->pin.gpio, chan->pin.pin_source, chan->remap);
|
||||||
#elif defined(STM32F10X_MD)
|
#elif defined(STM32F10X_MD)
|
||||||
|
init.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||||
if (chan->remap) {
|
if (chan->remap) {
|
||||||
GPIO_PinRemapConfig(chan->remap, ENABLE);
|
GPIO_PinRemapConfig(chan->remap, ENABLE);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#error Unsupported MCU
|
#error Unsupported MCU
|
||||||
#endif
|
#endif
|
||||||
|
GPIO_Init(chan->pin.gpio, &init);
|
||||||
|
|
||||||
/* Set up for output compare function */
|
/* Set up for output compare function */
|
||||||
switch (chan->timer_chan) {
|
switch (chan->timer_chan) {
|
||||||
@ -180,8 +183,6 @@ static void PIOS_Servo_SetupBank(uint8_t bank_nr)
|
|||||||
|
|
||||||
case PIOS_SERVO_BANK_MODE_DSHOT:
|
case PIOS_SERVO_BANK_MODE_DSHOT:
|
||||||
{
|
{
|
||||||
GPIO_InitTypeDef init = chan->pin.init;
|
|
||||||
|
|
||||||
#if defined(STM32F40_41xxx) || defined(STM32F446xx) || defined(STM32F411xE)
|
#if defined(STM32F40_41xxx) || defined(STM32F446xx) || defined(STM32F411xE)
|
||||||
init.GPIO_Mode = GPIO_Mode_OUT;
|
init.GPIO_Mode = GPIO_Mode_OUT;
|
||||||
#elif defined(STM32F10X_MD)
|
#elif defined(STM32F10X_MD)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user