39 #ifndef DSHOT_AT_LEAST_ONE_32B_TIMER
40 #define DSHOT_AT_LEAST_ONE_32B_TIMER TRUE
43 #ifndef DSHOT_CHANNEL_FIRST_INDEX
44 #define DSHOT_CHANNEL_FIRST_INDEX 0U
49 #define DSHOT_BIT_WIDTHS 16U
50 #define DSHOT_PRE_FRAME_SILENT_SYNC_BITS 2U
51 #define DSHOT_POST_FRAME_SILENT_SYNC_BITS 2U
52 #define DSHOT_DMA_BUFFER_SIZE (DSHOT_BIT_WIDTHS + \
53 DSHOT_PRE_FRAME_SILENT_SYNC_BITS + \
54 DSHOT_POST_FRAME_SILENT_SYNC_BITS )
56 #define DSHOT_CHANNELS 4U
63 #define DSHOT_ALL_MOTORS 255U
133 } __attribute__((__packed__, scalar_storage_order(
"big-endian")));
140 #if DSHOT_AT_LEAST_ONE_32B_TIMER
185 bool dcache_memory_in_use;
void dshotStart(DSHOTDriver *driver, const DSHOTConfig *config)
Configures and activates the DSHOT peripheral.
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
SerialDriver * tlm_sd
if non null : dshot telemetry serial driver
PWMDriver * pwmp
PWM driver that feed up to 4 dshot lines.
dshotstate_t
Driver state machine possible states.
@ DSHOT_UNINIT
Not initialized.
@ DSHOT_ERROR
Transfert error.
@ DSHOT_ONGOING_TELEMETRY_QUERY
Transfering.
#define DSHOT_DMA_BUFFER_SIZE
uint8_t dma_channel
: dma channel associated with pwm timer used to generate dshot output
void dshotSendThrottles(DSHOTDriver *driver, const uint16_t throttles[DSHOT_CHANNELS])
send throttle packed order to all of the ESCs
uint32_t dma_stream
: dma stream associated with pwm timer used to generate dshot output
void dshotSendFrame(DSHOTDriver *driver)
send throttle order
DshotDmaBuffer * dma_buf
dshot dma buffer, sgould be defined in a non Dcached region
void dshotSendSpecialCommand(DSHOTDriver *driver, const uint8_t index, const dshot_special_commands_t specmd)
send special order to one of the ESC (BHELIX, KISS, ...)
dshot_special_commands_t
DSHOT special commands (0-47) for KISS and BLHELI ESC.
@ DSHOT_CMD_SPIN_DIRECTION_REVERSED
@ DSHOT_CMD_SILENT_MODE_ON_OFF
@ DSHOT_CMD_SAVE_SETTINGS
@ DSHOT_CMD_AUDIO_STREAM_MODE_ON_OFF
@ DSHOT_CMD_SETTINGS_REQUEST
@ DSHOT_CMD_SPIN_DIRECTION_NORMAL
@ DSHOT_CMD_SPIN_DIRECTION_1
@ DSHOT_CMD_SPIN_DIRECTION_2
const DshotTelemetry * dshotGetTelemetry(const DSHOTDriver *driver, const uint32_t index)
return last received telemetry data
volatile uint8_t currentTlmQry
DSHOT Driver configuration structure.
telemetry packed as sent by some KISS ESC
STM32 DMA subsystem driver header.
DMA stream configuration structure.
Structure representing a DMA driver.
static const struct usb_config_descriptor config
uint32_t crc_errors
number of crc errors
mailbox_t mb
mailbox for dshot telemetry thread
DMADriver dmap
DMA driver associated with pwm timer.
PWMConfig pwm_conf
PWM config associated with pwm timer.
const DSHOTConfig * config
DMA config associated with pwm timer.
msg_t _mbBuf[1]
mailbox buffer for dshot telemetry thread
THD_WORKING_AREA(waDshotTlmRec, 512)
stack working area for dshot telemetry thread
DMAConfig dma_conf
DMA config associated with pwm timer.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.