From 093c2864cae2fc5c0bb1981c42a91929eba2bdc7 Mon Sep 17 00:00:00 2001 From: Thorsten Laux Date: Thu, 2 May 2019 15:02:14 +0200 Subject: [PATCH] inverted dshot for f7 --- src/main/drivers/pwm_output_dshot_hal.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/drivers/pwm_output_dshot_hal.c b/src/main/drivers/pwm_output_dshot_hal.c index e61fc0c8ba..6bb79edc60 100644 --- a/src/main/drivers/pwm_output_dshot_hal.c +++ b/src/main/drivers/pwm_output_dshot_hal.c @@ -241,16 +241,12 @@ void pwmDshotMotorHardwareConfig(const timerHardware_t *timerHardware, uint8_t m const uint8_t timerIndex = getTimerIndex(timer); const bool configureTimer = (timerIndex == dmaMotorTimerCount - 1); - uint8_t pupMode = 0; + uint8_t pupMode = (output & TIMER_OUTPUT_INVERTED) ? GPIO_PULLDOWN : GPIO_PULLUP; #ifdef USE_DSHOT_TELEMETRY - if (!useDshotTelemetry) { - pupMode = (output & TIMER_OUTPUT_INVERTED) ? GPIO_PULLDOWN : GPIO_PULLUP; - } else -#endif - { - pupMode = (output & TIMER_OUTPUT_INVERTED) ? GPIO_PULLUP : GPIO_PULLDOWN; + if (useDshotTelemetry) { + output ^= TIMER_OUTPUT_INVERTED; } - +#endif IOConfigGPIOAF(motorIO, IO_CONFIG(GPIO_MODE_AF_PP, GPIO_SPEED_FREQ_VERY_HIGH, pupMode), timerHardware->alternateFunction);