DeterministicESPAsyncWebServer v6.28.0
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
dshot.h File Reference

DShot ESC digital throttle protocol codec (DETWS_ENABLE_DSHOT). More...

#include "ServerConfig.h"
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Detailed Description

DShot ESC digital throttle protocol codec (DETWS_ENABLE_DSHOT).

DShot is the digital replacement for analog PWM on brushless-motor ESCs (drones, robotics). Each command is a 16-bit frame - 11 bits of value, 1 telemetry-request bit, and a 4-bit CRC:

bits 15..5  value    (0 = disarm / command context, 1..47 = special commands, 48..2047 = throttle)
bit  4      telemetry-request
bits 3..0   CRC = xor of the three nibbles of (value<<1 | telemetry)

For bidirectional / "extended" DShot (the ESC sends RPM/telemetry back on the same wire) the CRC is inverted. This is the wire codec: detws_dshot_encode builds the 16-bit frame and detws_dshot_decode validates the CRC and unpacks it. The physical layer (the bit-timed pulse train at 150/300/600/1200 kbit via the ESP32 RMT peripheral) is the app's transport - detws_dshot_bit_ns gives the high-time for a 0/1 bit at a given rate so a driver can program the RMT symbols.

Pure, zero heap, no stdlib, host-testable.

Definition in file dshot.h.