Don't handle non-MSP characters on VTX MSP port (#14091)
[betaflight.git] / src / main / drivers / pwm_output_dshot_shared.h
blob7c282d50083eb0de9d68d9c18386b074bee31bf1
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #ifdef USE_DSHOT
23 extern FAST_DATA_ZERO_INIT uint8_t dmaMotorTimerCount;
24 #if defined(STM32F7) || defined(STM32H7)
25 extern FAST_DATA_ZERO_INIT motorDmaTimer_t dmaMotorTimers[MAX_DMA_TIMERS];
26 extern FAST_DATA_ZERO_INIT motorDmaOutput_t dmaMotors[MAX_SUPPORTED_MOTORS];
27 #else
28 extern motorDmaTimer_t dmaMotorTimers[MAX_DMA_TIMERS];
29 extern motorDmaOutput_t dmaMotors[MAX_SUPPORTED_MOTORS];
30 #endif
32 #ifdef USE_DSHOT_TELEMETRY
33 extern uint32_t readDoneCount;
35 FAST_DATA_ZERO_INIT extern uint32_t inputStampUs;
37 typedef struct dshotDMAHandlerCycleCounters_s {
38 uint32_t irqAt;
39 uint32_t changeDirectionCompletedAt;
40 } dshotDMAHandlerCycleCounters_t;
42 FAST_DATA_ZERO_INIT extern dshotDMAHandlerCycleCounters_t dshotDMAHandlerCycleCounters;
44 #endif
46 uint8_t getTimerIndex(TIM_TypeDef *timer);
47 motorDmaOutput_t *getMotorDmaOutput(uint8_t index);
48 void dshotEnableChannels(uint8_t motorCount);
50 #ifdef USE_DSHOT_TELEMETRY
51 void pwmDshotSetDirectionOutput(
52 motorDmaOutput_t * const motor
53 #ifndef USE_DSHOT_TELEMETRY
54 #if defined(STM32F7) || defined(STM32H7)
55 , LL_TIM_OC_InitTypeDef* pOcInit, LL_DMA_InitTypeDef* pDmaInit
56 #else
57 , TIM_OCInitTypeDef *pOcInit, DMA_InitTypeDef* pDmaInit
58 #endif
59 #endif
62 bool pwmTelemetryDecode(void);
64 #endif
65 #endif