1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 12:55:19 +03:00

Merge pull request #6679 from jflyper/bfdev-fix-servoDevInit

Initialize timers assigned to servos appropriately
This commit is contained in:
Michael Keller 2018-09-02 14:30:52 +12:00 committed by GitHub
commit 09b52975fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -557,16 +557,18 @@ void servoDevInit(const servoDevConfig_t *servoConfig)
IOInit(servos[servoIndex].io, OWNER_SERVO, RESOURCE_INDEX(servoIndex));
const timerHardware_t *timer = timerGetByTag(tag);
#if defined(USE_HAL_DRIVER)
IOConfigGPIOAF(servos[servoIndex].io, IOCFG_AF_PP, timer->alternateFunction);
#else
IOConfigGPIO(servos[servoIndex].io, IOCFG_AF_PP);
#endif
if (timer == NULL) {
/* flag failure and disable ability to arm */
break;
}
#if defined(STM32F1)
IOConfigGPIO(servos[servoIndex].io, IOCFG_AF_PP);
#else
IOConfigGPIOAF(servos[servoIndex].io, IOCFG_AF_PP, timer->alternateFunction);
#endif
pwmOutConfig(&servos[servoIndex].channel, timer, PWM_TIMER_1MHZ, PWM_TIMER_1MHZ / servoConfig->servoPwmRate, servoConfig->servoCenterPulse, 0);
servos[servoIndex].enabled = true;
}