1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 21:35:44 +03:00

Fix dshot on h7 (#8709)

Fix dshot on h7
This commit is contained in:
Michael Keller 2019-08-13 08:54:48 +12:00 committed by GitHub
commit 8763aea851
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -274,12 +274,19 @@ bool pwmDshotMotorHardwareConfig(const timerHardware_t *timerHardware, uint8_t m
TIM_TypeDef *timer = timerHardware->tim; // "timer" is confusing; "tim"? TIM_TypeDef *timer = timerHardware->tim; // "timer" is confusing; "tim"?
const IO_t motorIO = IOGetByTag(timerHardware->tag); const IO_t motorIO = IOGetByTag(timerHardware->tag);
uint8_t pupMode = (output & TIMER_OUTPUT_INVERTED) ? GPIO_PULLDOWN : GPIO_PULLUP;
#ifdef USE_DSHOT_TELEMETRY
if (useDshotTelemetry) {
output ^= TIMER_OUTPUT_INVERTED;
}
#endif
motor->iocfg = IO_CONFIG(GPIO_MODE_AF_PP, GPIO_SPEED_FREQ_VERY_HIGH, pupMode);
const uint8_t timerIndex = getTimerIndex(timer); const uint8_t timerIndex = getTimerIndex(timer);
const bool configureTimer = (timerIndex == dmaMotorTimerCount - 1); const bool configureTimer = (timerIndex == dmaMotorTimerCount - 1);
IOInit(motorIO, OWNER_MOTOR, RESOURCE_INDEX(motorIndex)); IOInit(motorIO, OWNER_MOTOR, RESOURCE_INDEX(motorIndex));
IOConfigGPIOAF(motorIO, IO_CONFIG(GPIO_MODE_AF_PP, GPIO_SPEED_FREQ_VERY_HIGH, GPIO_PULLDOWN), timerHardware->alternateFunction); IOConfigGPIOAF(motorIO, motor->iocfg, timerHardware->alternateFunction);
// Configure time base // Configure time base