Skip to content

File syn_dshot.h

FileList > output > syn_dshot.h

Go to the source code of this file

Zero-Heap DShot (DShot150/300/600) Digital ESC Driver. More...

  • #include "syntropic/common/syn_defs.h"
  • #include <stdbool.h>
  • #include <stddef.h>
  • #include <stdint.h>

Classes

Type Name
struct SYN_DShot_Packet

Public Types

Type Name
enum SYN_DShot_Speed

Public Functions

Type Name
uint8_t syn_dshot_calc_crc (uint16_t payload_12bit)
Calculate 4-bit DShot CRC for an 12-bit payload ( throttle[11:1] +telemetry[0] ).
SYN_Status syn_dshot_encode (uint16_t throttle, bool telemetry, SYN_DShot_Packet * packet)
Encode throttle value and telemetry flag into a 16-bit DShot frame.
uint16_t syn_dshot_us_to_throttle (uint16_t us)
Convert standard 1000..2000 us RC pulse width to DShot 48..2047 throttle value.

Detailed Description

DShot Frame Format: * 16 bits total: * Bits [15:5]: 11-bit Throttle value (0 = Disarmed/Stop, 1..47 = ESC commands, 48..2047 = Throttle command). * Bit [4]: Telemetry Request flag (1 = Request telemetry byte via bidirectional DShot). * Bits [3:0]: 4-bit CRC (computed via nibble XOR sum: (payload ^ (payload >> 4) ^ (payload >> 8)) & 0x0F).

Public Types Documentation

enum SYN_DShot_Speed

enum SYN_DShot_Speed {
    SYN_DSHOT150 = 150,
    SYN_DSHOT300 = 300,
    SYN_DSHOT600 = 600
};

DShot Speed Variant.


Public Functions Documentation

function syn_dshot_calc_crc

Calculate 4-bit DShot CRC for an 12-bit payload ( throttle[11:1] +telemetry[0] ).

uint8_t syn_dshot_calc_crc (
    uint16_t payload_12bit
) 

Parameters:

  • payload_12bit 12-bit value (throttle << 1) | (telemetry ? 1 : 0).

Returns:

4-bit CRC value.


function syn_dshot_encode

Encode throttle value and telemetry flag into a 16-bit DShot frame.

SYN_Status syn_dshot_encode (
    uint16_t throttle,
    bool telemetry,
    SYN_DShot_Packet * packet
) 

Parameters:

  • throttle 11-bit throttle value (clamped 0..2047).
  • telemetry Telemetry request flag.
  • packet Pointer to output packet struct.

Returns:

SYN_OK on success, SYN_INVALID_PARAM if packet is NULL.


function syn_dshot_us_to_throttle

Convert standard 1000..2000 us RC pulse width to DShot 48..2047 throttle value.

uint16_t syn_dshot_us_to_throttle (
    uint16_t us
) 

Parameters:

  • us Pulse width in microseconds (1000..2000 us).

Returns:

DShot throttle value (0 if us < 1048, 48..2047).



The documentation for this class was generated from the following file src/syntropic/output/syn_dshot.h