Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
DSHOT driver based on ChibiOS. More...
Go to the source code of this file.
Data Structures | |
struct | DshotTelemetry |
telemetry packed as sent by some KISS ESC More... | |
union | DshotDmaBuffer |
struct | DSHOTConfig |
DSHOT Driver configuration structure. More... | |
union | DshotPacket |
struct | DshotPackets |
struct | DSHOTDriver |
DSHOT driver structure. More... | |
union | DshotTelemetry.__unnamed__ |
struct | DshotTelemetry.__unnamed__.__unnamed__ |
struct | DshotPacket.__unnamed__ |
Macros | |
#define | DSHOT_AT_LEAST_ONE_32B_TIMER TRUE |
By default enable the possibility to mix 16 and 32 bits timer. More... | |
#define | DSHOT_CHANNEL_FIRST_INDEX 0U |
#define | DSHOT_BIT_WIDTHS 16U |
DMA buffer size and number of channels. More... | |
#define | DSHOT_PRE_FRAME_SILENT_SYNC_BITS 2U |
#define | DSHOT_POST_FRAME_SILENT_SYNC_BITS 2U |
#define | DSHOT_DMA_BUFFER_SIZE |
#define | DSHOT_CHANNELS 4U |
#define | DSHOT_ALL_MOTORS 255U |
special value for index : send order to all channels More... | |
Typedefs | |
typedef struct DSHOTDriver | DSHOTDriver |
Type of a structure representing an DSHOT driver. More... | |
Enumerations | |
enum | dshotstate_t { DSHOT_UNINIT = 0, DSHOT_STOP, DSHOT_READY, DSHOT_ONGOING_TELEMETRY_QUERY, DSHOT_ERROR } |
Driver state machine possible states. More... | |
enum | dshot_special_commands_t { DSHOT_CMD_MOTOR_STOP = 0, DSHOT_CMD_BEACON1, DSHOT_CMD_BEACON2, DSHOT_CMD_BEACON3, DSHOT_CMD_BEACON4, DSHOT_CMD_BEACON5, DSHOT_CMD_ESC_INFO, DSHOT_CMD_SPIN_DIRECTION_1, DSHOT_CMD_SPIN_DIRECTION_2, DSHOT_CMD_3D_MODE_OFF, DSHOT_CMD_3D_MODE_ON, DSHOT_CMD_SETTINGS_REQUEST, DSHOT_CMD_SAVE_SETTINGS, DSHOT_CMD_SPIN_DIRECTION_NORMAL = 20, DSHOT_CMD_SPIN_DIRECTION_REVERSED = 21, DSHOT_CMD_LED0_ON, DSHOT_CMD_LED1_ON, DSHOT_CMD_LED2_ON, DSHOT_CMD_LED3_ON, DSHOT_CMD_LED0_OFF, DSHOT_CMD_LED1_OFF, DSHOT_CMD_LED2_OFF, DSHOT_CMD_LED3_OFF, DSHOT_CMD_AUDIO_STREAM_MODE_ON_OFF = 30, DSHOT_CMD_SILENT_MODE_ON_OFF = 31, DSHOT_CMD_MAX = 47 } |
DSHOT special commands (0-47) for KISS and BLHELI ESC. More... | |
Functions | |
void | dshotStart (DSHOTDriver *driver, const DSHOTConfig *config) |
Configures and activates the DSHOT peripheral. More... | |
void | dshotSetThrottle (DSHOTDriver *driver, const uint8_t index, const uint16_t throttle) |
prepare throttle order for specified ESC More... | |
void | dshotSendFrame (DSHOTDriver *driver) |
send throttle order More... | |
void | dshotSendThrottles (DSHOTDriver *driver, const uint16_t throttles[DSHOT_CHANNELS]) |
send throttle packed order to all of the ESCs More... | |
void | dshotSendSpecialCommand (DSHOTDriver *driver, const uint8_t index, const dshot_special_commands_t specmd) |
send special order to one of the ESC (BHELIX, KISS, ...) More... | |
uint32_t | dshotGetCrcErrorsCount (DSHOTDriver *driver) |
return number of telemetry crc error since dshotStart More... | |
const DshotTelemetry * | dshotGetTelemetry (const DSHOTDriver *driver, const uint32_t index) |
return last received telemetry data More... | |
DSHOT driver based on ChibiOS.
Definition in file esc_dshot.h.
struct DshotTelemetry |
telemetry packed as sent by some KISS ESC
Definition at line 125 of file esc_dshot.h.
Data Fields | ||
---|---|---|
union DshotTelemetry | __unnamed__ | |
uint8_t | crc8 |
union DshotDmaBuffer |
Definition at line 139 of file esc_dshot.h.
Data Fields | ||
---|---|---|
uint16_t | widths16[DSHOT_DMA_BUFFER_SIZE][DSHOT_CHANNELS] |
struct DSHOTConfig |
DSHOT Driver configuration structure.
Definition at line 155 of file esc_dshot.h.
Data Fields | ||
---|---|---|
DshotDmaBuffer * | dma_buf | dshot dma buffer, sgould be defined in a non Dcached region |
uint8_t | dma_channel | : dma channel associated with pwm timer used to generate dshot output |
uint32_t | dma_stream | : dma stream associated with pwm timer used to generate dshot output |
PWMDriver * | pwmp | PWM driver that feed up to 4 dshot lines. |
SerialDriver * | tlm_sd | if non null : dshot telemetry serial driver |
union DshotPacket |
Definition at line 208 of file esc_dshot.h.
Data Fields | ||
---|---|---|
struct DshotPacket | __unnamed__ | |
uint16_t | rawFrame |
struct DshotPackets |
Definition at line 217 of file esc_dshot.h.
Data Fields | ||
---|---|---|
volatile uint8_t | currentTlmQry | |
DshotPacket | dp[DSHOT_CHANNELS] | |
DshotTelemetry | dt[DSHOT_CHANNELS] | |
volatile bool | onGoingQry |
union DshotTelemetry.__unnamed__ |
Definition at line 126 of file esc_dshot.h.
Data Fields | ||
---|---|---|
__unnamed__ | __unnamed__ | |
uint8_t | rawData[9] |
struct DshotTelemetry.__unnamed__.__unnamed__ |
struct DshotPacket.__unnamed__ |
Definition at line 209 of file esc_dshot.h.
Data Fields | ||
---|---|---|
uint16_t | crc: 4 | |
uint16_t | telemetryRequest: 1 | |
uint16_t | throttle: 11 |
#define DSHOT_ALL_MOTORS 255U |
special value for index : send order to all channels
Definition at line 63 of file esc_dshot.h.
#define DSHOT_AT_LEAST_ONE_32B_TIMER TRUE |
By default enable the possibility to mix 16 and 32 bits timer.
Definition at line 40 of file esc_dshot.h.
#define DSHOT_BIT_WIDTHS 16U |
DMA buffer size and number of channels.
Definition at line 49 of file esc_dshot.h.
#define DSHOT_CHANNEL_FIRST_INDEX 0U |
Definition at line 44 of file esc_dshot.h.
#define DSHOT_CHANNELS 4U |
Definition at line 56 of file esc_dshot.h.
#define DSHOT_DMA_BUFFER_SIZE |
Definition at line 52 of file esc_dshot.h.
#define DSHOT_POST_FRAME_SILENT_SYNC_BITS 2U |
Definition at line 51 of file esc_dshot.h.
#define DSHOT_PRE_FRAME_SILENT_SYNC_BITS 2U |
Definition at line 50 of file esc_dshot.h.
typedef struct DSHOTDriver DSHOTDriver |
Type of a structure representing an DSHOT driver.
Definition at line 149 of file esc_dshot.h.
DSHOT special commands (0-47) for KISS and BLHELI ESC.
Definition at line 91 of file esc_dshot.h.
enum dshotstate_t |
Driver state machine possible states.
Enumerator | |
---|---|
DSHOT_UNINIT | Not initialized.
|
DSHOT_STOP | Stopped.
|
DSHOT_READY | Ready.
|
DSHOT_ONGOING_TELEMETRY_QUERY | Transfering.
|
DSHOT_ERROR | Transfert error.
|
Definition at line 68 of file esc_dshot.h.
uint32_t dshotGetCrcErrorsCount | ( | DSHOTDriver * | driver | ) |
return number of telemetry crc error since dshotStart
[in] | driver | pointer to the DSHOTDriver object |
Definition at line 329 of file esc_dshot.c.
References DSHOTDriver::crc_errors.
const DshotTelemetry* dshotGetTelemetry | ( | const DSHOTDriver * | driver, |
const uint32_t | index | ||
) |
return last received telemetry data
[in] | driver | pointer to the DSHOTDriver object |
[in] | index | channel : [0..3] or [0..1] depending on driver used |
Definition at line 342 of file esc_dshot.c.
References DSHOTDriver::dshotMotors, and DshotPackets::dt.
void dshotSendFrame | ( | DSHOTDriver * | driver | ) |
send throttle order
[in] | driver | pointer to the DSHOTDriver object |
Definition at line 302 of file esc_dshot.c.
References buildDshotDmaBuffer(), DSHOTDriver::config, DshotPackets::currentTlmQry, DSHOTConfig::dma_buf, DMA_READY, DSHOTDriver::dmap, dmaStartTransfert(), DshotPackets::dp, DSHOT_CHANNELS, DSHOT_DMA_BUFFER_SIZE, DSHOTDriver::dshotMotors, getTimerWidth(), DSHOTDriver::mb, DshotPackets::onGoingQry, DSHOTConfig::pwmp, setDshotPacketTlm(), DMADriver::state, and DSHOTConfig::tlm_sd.
Referenced by actuators_dshot_arch_commit(), dshotSendSpecialCommand(), and dshotSendThrottles().
void dshotSendSpecialCommand | ( | DSHOTDriver * | driver, |
const uint8_t | index, | ||
const dshot_special_commands_t | specmd | ||
) |
send special order to one of the ESC (BHELIX, KISS, ...)
[in] | driver | pointer to the DSHOTDriver object |
[in] | index | channel : [0..3] or [0..1] depending on driver used |
[in] | specmd | special commands, see enum @api |
Definition at line 239 of file esc_dshot.c.
References DSHOTDriver::config, DshotPackets::dp, DSHOT_ALL_MOTORS, DSHOT_CHANNELS, DSHOT_CMD_3D_MODE_OFF, DSHOT_CMD_3D_MODE_ON, DSHOT_CMD_AUDIO_STREAM_MODE_ON_OFF, DSHOT_CMD_MAX, DSHOT_CMD_SAVE_SETTINGS, DSHOT_CMD_SETTINGS_REQUEST, DSHOT_CMD_SILENT_MODE_ON_OFF, DSHOT_CMD_SPIN_DIRECTION_1, DSHOT_CMD_SPIN_DIRECTION_2, DSHOTDriver::dshotMotors, dshotSendFrame(), setDshotPacketThrottle(), setDshotPacketTlm(), and DSHOTConfig::tlm_sd.
void dshotSendThrottles | ( | DSHOTDriver * | driver, |
const uint16_t | throttles[DSHOT_CHANNELS] | ||
) |
send throttle packed order to all of the ESCs
[in] | driver | pointer to the DSHOTDriver object |
[in] | throttle[DSHOT_CHANNELS] | [48 .. 2047] |
Definition at line 286 of file esc_dshot.c.
References DshotPackets::dp, DSHOT_CHANNELS, DSHOTDriver::dshotMotors, dshotSendFrame(), and setDshotPacketThrottle().
void dshotSetThrottle | ( | DSHOTDriver * | driver, |
const uint8_t | index, | ||
const uint16_t | throttle | ||
) |
prepare throttle order for specified ESC
[in] | driver | pointer to the DSHOTDriver object |
[in] | index | channel : [0..3] or [0..1] depending on driver used |
[in] | throttle | [48 .. 2047] |
Definition at line 210 of file esc_dshot.c.
References DshotPackets::dp, DSHOT_ALL_MOTORS, DSHOT_CHANNEL_FIRST_INDEX, DSHOT_CHANNELS, DSHOT_CMD_MAX, DSHOT_MAX_VALUE, DSHOTDriver::dshotMotors, Min, and setDshotPacketThrottle().
Referenced by actuators_dshot_arch_commit().
void dshotStart | ( | DSHOTDriver * | driver, |
const DSHOTConfig * | config | ||
) |
Configures and activates the DSHOT peripheral.
[in] | driver | pointer to the DSHOTDriver object |
[in] | config | pointer to the DSHOTConfig object. @api |
Definition at line 122 of file esc_dshot.c.
References DSHOTDriver::_mbBuf, ARRAY_LEN, config, DSHOTDriver::config, DSHOTDriver::crc_errors, DshotPackets::currentTlmQry, DCR_DBA, DCR_DBL, DSHOTDriver::dma_conf, DMA_DIR_M2P, dmaObjectInit(), DSHOTDriver::dmap, dmaStart(), DshotPackets::dp, DSHOT_CHANNELS, DSHOT_PWM_PERIOD, DSHOT_TELEMETRY_BAUD, DSHOTDriver::dshotMotors, dshotTlmRec(), getTimerWidth(), makeDshotPacket(), DSHOTDriver::mb, DshotPackets::onGoingQry, DSHOTDriver::pwm_conf, DSHOTConfig::pwmp, DMAConfig::stream, TICK_FREQ, TICKS_PER_PERIOD, and DSHOTConfig::tlm_sd.
Referenced by actuators_dshot_arch_init().