Skip to content

File syn_dshot_telemetry.h

FileList > output > syn_dshot_telemetry.h

Go to the source code of this file

Zero-Heap Bidirectional DShot (BDShot) Telemetry Decoder. More...

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

Classes

Type Name
struct SYN_DShot_Telemetry

Public Functions

Type Name
SYN_Status syn_dshot_decode_gcr_20bit (uint32_t gcr_20bit, uint16_t * payload_out)
Decode 20-bit raw GCR bitstream into 16-bit BDShot telemetry payload.
SYN_Status syn_dshot_parse_telemetry (uint32_t gcr_20bit, uint8_t pole_pairs, SYN_DShot_Telemetry * telemetry)
Decode complete 20-bit BDShot GCR packet into telemetry measurements.

Detailed Description

BDShot Specifications: * ESC returns a 20-bit GCR (Group Code Recording 5b/4b) encoded packet on the DShot line. * 20 GCR bits -> 16 decoded data bits: * Bits [15:4]: 12-bit eRPM period value (mantissa & exponent format). * Bits [3:0]: 4-bit CRC (computed via (payload ^ (payload >> 4) ^ (payload >> 8)) & 0x0F).

  • eRPM Calculation:
  • period_us = (mantissa << exponent)
  • eRPM = 60,000,000 / period_us
  • RPM = eRPM / (pole_pairs / 2)

Public Functions Documentation

function syn_dshot_decode_gcr_20bit

Decode 20-bit raw GCR bitstream into 16-bit BDShot telemetry payload.

SYN_Status syn_dshot_decode_gcr_20bit (
    uint32_t gcr_20bit,
    uint16_t * payload_out
) 

Parameters:

  • gcr_20bit 20-bit raw GCR frame.
  • payload_out Pointer to receive 16-bit decoded payload ([15:4] period, [3:0] crc).

Returns:

SYN_OK on valid GCR decode, SYN_ERROR if invalid GCR symbol found.


function syn_dshot_parse_telemetry

Decode complete 20-bit BDShot GCR packet into telemetry measurements.

SYN_Status syn_dshot_parse_telemetry (
    uint32_t gcr_20bit,
    uint8_t pole_pairs,
    SYN_DShot_Telemetry * telemetry
) 

Parameters:

  • gcr_20bit 20-bit raw GCR frame.
  • pole_pairs Motor pole pairs (e.g., 14 poles = 7 pole pairs). Default 7 if 0.
  • telemetry Pointer to output telemetry structure.

Returns:

SYN_OK on valid decode and CRC, SYN_ERROR on bad GCR/CRC.



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