...update public stuff

This commit is contained in:
Wastl Kraus 2025-08-08 15:44:19 +02:00
parent 392d8c64d2
commit 7bd10ebc48
4 changed files with 64 additions and 39 deletions

View File

@ -12,9 +12,9 @@ Supports all standard DShot modes (150, 300, 600) and features continuous frame
## 🚀 Features ## 🚀 Features
- **All DShot Modes:** DSHOT150, DSHOT300 (default), DSHOT600 - **All DShot Modes:** DSHOT150, DSHOT300 (default), DSHOT600, (DSHOT1200)
- **BiDirectional DShot:** Experimental support for telemetry and RPM feedback - **BiDirectional DShot:** Experimental support for RPM feedback
- **Continuous Frames:** Hardware-timed, CPU-independent signal generation - **Continuous Frames:** Independent timed, Hardware signal generation
- **Configurable Pause:** Ensures ESCs can reliably detect frame boundaries - **Configurable Pause:** Ensures ESCs can reliably detect frame boundaries
- **Simple API:** Easy integration into your Arduino or ESP-IDF project - **Simple API:** Easy integration into your Arduino or ESP-IDF project
@ -33,25 +33,7 @@ git clone https://github.com/derdoktor667/DShotRMT.git
## ⚡ Quick Start ## ⚡ Quick Start
```cpp ```cpp
#include <DShotRMT.h> Use "dshot300.ino" example sketch
constexpr gpio_num_t MOTOR_PIN = GPIO_NUM_17;
constexpr dshot_mode_t MODE = DSHOT300;
constexpr bool BIDIRECTIONAL = true;
DShotRMT motor(MOTOR_PIN, MODE, BIDIRECTIONAL);
void setup() {
Serial.begin(115200);
motor.begin();
motor.setThrottle(1000); // Set throttle value (482047)
}
void loop() {
// Optionally read RPM if bidirectional mode is enabled
uint32_t rpm = motor.getMotorRPM(14); // 14 magnets
Serial.println(rpm);
}
``` ```
--- ---
@ -105,6 +87,7 @@ crc = (~(value ^ (value >> 4) ^ (value >> 8))) & 0x0F;
The RMT (Remote Control) peripheral generates accurate, hardware-timed signals for controlling external devices. The RMT (Remote Control) peripheral generates accurate, hardware-timed signals for controlling external devices.
Perfect for DShot: Perfect for DShot:
- Utilizes latest ESP-IDF APIs
- Hardware-timed pulses - Hardware-timed pulses
- CPU-independent - CPU-independent
- Loop mode with inter-frame pause - Loop mode with inter-frame pause
@ -116,11 +99,9 @@ Perfect for DShot:
- `DShotRMT(gpio_num_t gpio, dshot_mode_t mode, bool isBidirectional)` - `DShotRMT(gpio_num_t gpio, dshot_mode_t mode, bool isBidirectional)`
- `void begin()` - `void begin()`
- `void setThrottle(uint16_t throttle)` - `void sendThrottle(uint16_t throttle)`
- `uint32_t getERPM()`
- `uint32_t getMotorRPM(uint8_t magnet_count)`
See [examples/dshot300/dshot300.ino](examples/dshot300/dshot300.ino) for a full demo. See [examples/dshot300/dshot300.ino](examples/dshot300/dshot300.ino) for a more informations.
--- ---

View File

@ -14,8 +14,11 @@ static constexpr HardwareSerial &USB_SERIAL = Serial0;
static constexpr uint32_t USB_SERIAL_BAUD = 115200; static constexpr uint32_t USB_SERIAL_BAUD = 115200;
// Motor configuration // Motor configuration
// Pin number or GPIO_PIN
// static constexpr gpio_num_t MOTOR01_PIN = GPIO_NUM_17; // static constexpr gpio_num_t MOTOR01_PIN = GPIO_NUM_17;
static constexpr uint16_t MOTOR01_PIN = 17; static constexpr uint16_t MOTOR01_PIN = 17;
// Supported: DSHOT150, DSHOT300, DSHOT600, (DSHOT1200)
static constexpr dshot_mode_t DSHOT_MODE = DSHOT300; static constexpr dshot_mode_t DSHOT_MODE = DSHOT300;
// BiDirectional DShot Support (default: false) // BiDirectional DShot Support (default: false)
@ -24,18 +27,10 @@ static constexpr bool IS_BIDIRECTIONAL = false;
// Motor magnet count for RPM calculation // Motor magnet count for RPM calculation
static constexpr uint8_t MOTOR01_MAGNET_COUNT = 14; static constexpr uint8_t MOTOR01_MAGNET_COUNT = 14;
// Setup Motor Pin, DShot Mode and optional BiDirectional Support //
//
DShotRMT motor01(MOTOR01_PIN, DSHOT_MODE, IS_BIDIRECTIONAL); DShotRMT motor01(MOTOR01_PIN, DSHOT_MODE, IS_BIDIRECTIONAL);
// Prints RPM if BiDirectional is enabled every ms
void printRPMPeriodically(uint16_t timer_ms);
// Reads throttle value from serial input
uint16_t readSerialThrottle(HardwareSerial &serial);
// Prints out the dshot packet bitwise every ms (Debug)
void printTXPacket(uint16_t timer_ms);
// //
void setup() void setup()
{ {
@ -62,7 +57,7 @@ void loop()
// Send the value to the ESC // Send the value to the ESC
motor01.sendThrottle(throttle_input); motor01.sendThrottle(throttle_input);
// Prints RPM every 2 if BiDirectional DShot is enabled // Prints out RPM if BiDirectional DShot is enabled every 2 seconds
printRPMPeriodically(2000); printRPMPeriodically(2000);
// Prints out "raw" DShot packet every 2 seconds // Prints out "raw" DShot packet every 2 seconds

49
keywords.txt Normal file
View File

@ -0,0 +1,49 @@
#######################################
# Syntax Coloring Map For DShotRMT
#######################################
#######################################
# Datatypes (KEYWORD1)
#######################################
DShotRMT KEYWORD1
dshot_mode_t KEYWORD1
dshot_packet_t KEYWORD1
dshot_timing_t KEYWORD1
dshotCommands_e KEYWORD1
dshotCommandType_e KEYWORD1
#######################################
# Methods and Functions (KEYWORD2)
#######################################
begin KEYWORD2
setThrottle KEYWORD2
sendThrottle KEYWORD2
sendDShotCommand KEYWORD2
sendCommand KEYWORD2
getERPM KEYWORD2
getMotorRPM KEYWORD2
getGPIO KEYWORD2
getDShotPacket KEYWORD2
is_bidirectional KEYWORD2
#######################################
# Constants (LITERAL1)
#######################################
DSHOT_OFF LITERAL1
DSHOT150 LITERAL1
DSHOT300 LITERAL1
DSHOT600 LITERAL1
DSHOT1200 LITERAL1
DSHOT_THROTTLE_FAILSAFE LITERAL1
DSHOT_THROTTLE_MIN LITERAL1
DSHOT_THROTTLE_MAX LITERAL1
DSHOT_CMD_MOTOR_STOP LITERAL1
DSHOT_CMD_MAX LITERAL1
DSHOT_CMD_TYPE_INLINE LITERAL1
DSHOT_CMD_TYPE_BLOCKING LITERAL1

View File

@ -1,5 +1,5 @@
name=DShotRMT name=DShotRMT
version=0.5.0 version=0.6.0
author=derdoktor667 author=derdoktor667
maintainer=derdoktor667 maintainer=derdoktor667
sentence=DShotRMT Library supporting all DShot Types and speeds. Tested with BlHeli_S. sentence=DShotRMT Library supporting all DShot Types and speeds. Tested with BlHeli_S.