39 #ifndef DSHOT_AT_LEAST_ONE_32B_TIMER
40 #define DSHOT_AT_LEAST_ONE_32B_TIMER TRUE
45 #define DSHOT_BIT_WIDTHS 16
46 #define DSHOT_FRAME_SILENT_SYNC_BITS 4
47 #define DSHOT_DMA_BUFFER_SIZE (DSHOT_BIT_WIDTHS+DSHOT_FRAME_SILENT_SYNC_BITS)
48 #define DSHOT_CHANNELS 4 // depend on the number of channels per timer
55 #define DSHOT_ALL_MOTORS 255
125 } __attribute__((__packed__, scalar_storage_order(
"big-endian")));
200 #if DSHOT_AT_LEAST_ONE_32B_TIMER
STM32 DMA subsystem driver header.
telemetry packed as sent by some KISS ESC
void dshotStart(DSHOTDriver *driver, const DSHOTConfig *config)
Configures and activates the DSHOT peripheral.
dshotstate_t
Driver state machine possible states.
PWMConfig pwm_conf
PWM config associated with pwm timer.
DSHOT Driver configuration structure.
PWMDriver * pwmp
PWM driver that feed up to 4 dshot lines.
const DSHOTConfig * config
DMA config associated with pwm timer.
THD_WORKING_AREA(waDshotTlmRec, 512)
stack working area for dshot telemetry thread
DMA stream configuration structure.
const DshotTelemetry * dshotGetTelemetry(const DSHOTDriver *driver, const uint32_t index)
return last received telemetry data
SerialDriver * tlm_sd
if non null : dshot telemetry serial driver
void dshotSendFrame(DSHOTDriver *driver)
send throttle order
volatile uint8_t currentTlmQry
uint8_t dma_channel
: dma channel associated with pwm timer used to generate dshot output
mailbox_t mb
mailbox for dshot telemetry thread
uint32_t crc_errors
number of crc errors
uint32_t dma_stream
: dma stream associated with pwm timer used to generate dshot output
void dshotSendSpecialCommand(DSHOTDriver *driver, const uint8_t index, const dshot_special_commands_t specmd)
send special order to one of the ESC (BHELIX, KISS, ...)
static const struct usb_config_descriptor config
dshot_special_commands_t
DSHOT special commands (0-47) for KISS and BLHELI ESC.
DMADriver dmap
DMA driver associated with pwm timer.
DMAConfig dma_conf
DMA config associated with pwm timer.
void dshotSendThrottles(DSHOTDriver *driver, const uint16_t throttles[DSHOT_CHANNELS])
send throttle packed order to all of the ESCs
void dshotSetThrottle(DSHOTDriver *driver, const uint8_t index, const uint16_t throttle)
prepare throttle order for specified ESC
uint32_t dshotGetCrcErrorsCount(DSHOTDriver *driver)
return number of telemetry crc error since dshotStart
msg_t _mbBuf[1]
mailbox buffer for dshot telemetry thread
Structure representing a DMA driver.
#define DSHOT_DMA_BUFFER_SIZE