Autodrone
Multi-Domain Vehicle
drv_dshot.c File Reference

This files enables the gpio, timer, and dma peripherals to send dshot commands with pwm. More...

#include "board.h"

Functions

void dshotInit (dshot_type_e dshot_type)
 Initializes the low level registers to set up the timer with PWM DMA. More...
 
void dshotWrite (uint16_t *motor_value)
 Writes to the DMA buffer and starts the DMA stream. More...
 
void dshotWait (uint16_t wait_counts)
 Waits for a certain amount of dshot commands. More...
 
void DMA1_Stream2_IRQHandler (void)
 This function handles DMA1 stream2 global interrupt. More...
 
void DMA1_Stream4_IRQHandler (void)
 This function handles DMA1 stream4 global interrupt. More...
 
void DMA1_Stream0_IRQHandler (void)
 This function handles DMA1 stream0 global interrupt. More...
 
void DMA1_Stream3_IRQHandler (void)
 This function handles DMA1 stream3 global interrupt. More...
 

Variables

volatile uint16_t dshot_command_count = 0
 
bool dshot_telemetry = false
 

Detailed Description

This files enables the gpio, timer, and dma peripherals to send dshot commands with pwm.

Author
Jeremy Wolfe
Date
23 FEB 2022

Function Documentation

◆ DMA1_Stream0_IRQHandler()

void DMA1_Stream0_IRQHandler ( void  )

This function handles DMA1 stream0 global interrupt.

◆ DMA1_Stream2_IRQHandler()

void DMA1_Stream2_IRQHandler ( void  )

This function handles DMA1 stream2 global interrupt.

◆ DMA1_Stream3_IRQHandler()

void DMA1_Stream3_IRQHandler ( void  )

This function handles DMA1 stream3 global interrupt.

◆ DMA1_Stream4_IRQHandler()

void DMA1_Stream4_IRQHandler ( void  )

This function handles DMA1 stream4 global interrupt.

◆ dshotInit()

void dshotInit ( dshot_type_e  dshot_type)

Initializes the low level registers to set up the timer with PWM DMA.

Parameters
dshot_typeDSHOT150/300/600. Allows you to adjust the speed. DSHOT600 is preferred
Returns
Void.

◆ dshotWait()

void dshotWait ( uint16_t  wait_counts)

Waits for a certain amount of dshot commands.

Parameters
wait_countsNumber of commands to wait for.
Returns
Void.

◆ dshotWrite()

void dshotWrite ( uint16_t *  motor_value)

Writes to the DMA buffer and starts the DMA stream.

Parameters
*motor_valueA four length array with elements from 0 to 2047.
Returns
Void.

Variable Documentation

◆ dshot_command_count

volatile uint16_t dshot_command_count = 0

◆ dshot_telemetry

bool dshot_telemetry = false