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)
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/>.
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
];
28 extern motorDmaTimer_t dmaMotorTimers
[MAX_DMA_TIMERS
];
29 extern motorDmaOutput_t dmaMotors
[MAX_SUPPORTED_MOTORS
];
32 #ifdef USE_DSHOT_TELEMETRY
33 extern uint32_t readDoneCount
;
35 FAST_DATA_ZERO_INIT
extern uint32_t inputStampUs
;
37 typedef struct dshotDMAHandlerCycleCounters_s
{
39 uint32_t changeDirectionCompletedAt
;
40 } dshotDMAHandlerCycleCounters_t
;
42 FAST_DATA_ZERO_INIT
extern dshotDMAHandlerCycleCounters_t dshotDMAHandlerCycleCounters
;
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
57 , TIM_OCInitTypeDef
*pOcInit
, DMA_InitTypeDef
* pDmaInit
62 bool pwmStartDshotMotorUpdate(void);