...update public stuff
This commit is contained in:
parent
392d8c64d2
commit
7bd10ebc48
33
README.md
33
README.md
|
|
@ -12,9 +12,9 @@ Supports all standard DShot modes (150, 300, 600) and features continuous frame
|
|||
|
||||
## 🚀 Features
|
||||
|
||||
- **All DShot Modes:** DSHOT150, DSHOT300 (default), DSHOT600
|
||||
- **BiDirectional DShot:** Experimental support for telemetry and RPM feedback
|
||||
- **Continuous Frames:** Hardware-timed, CPU-independent signal generation
|
||||
- **All DShot Modes:** DSHOT150, DSHOT300 (default), DSHOT600, (DSHOT1200)
|
||||
- **BiDirectional DShot:** Experimental support for RPM feedback
|
||||
- **Continuous Frames:** Independent timed, Hardware signal generation
|
||||
- **Configurable Pause:** Ensures ESCs can reliably detect frame boundaries
|
||||
- **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
|
||||
|
||||
```cpp
|
||||
#include <DShotRMT.h>
|
||||
|
||||
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 (48–2047)
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// Optionally read RPM if bidirectional mode is enabled
|
||||
uint32_t rpm = motor.getMotorRPM(14); // 14 magnets
|
||||
Serial.println(rpm);
|
||||
}
|
||||
Use "dshot300.ino" example sketch
|
||||
```
|
||||
|
||||
---
|
||||
|
|
@ -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.
|
||||
Perfect for DShot:
|
||||
- Utilizes latest ESP-IDF APIs
|
||||
- Hardware-timed pulses
|
||||
- CPU-independent
|
||||
- Loop mode with inter-frame pause
|
||||
|
|
@ -116,11 +99,9 @@ Perfect for DShot:
|
|||
|
||||
- `DShotRMT(gpio_num_t gpio, dshot_mode_t mode, bool isBidirectional)`
|
||||
- `void begin()`
|
||||
- `void setThrottle(uint16_t throttle)`
|
||||
- `uint32_t getERPM()`
|
||||
- `uint32_t getMotorRPM(uint8_t magnet_count)`
|
||||
- `void sendThrottle(uint16_t throttle)`
|
||||
|
||||
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.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,11 @@ static constexpr HardwareSerial &USB_SERIAL = Serial0;
|
|||
static constexpr uint32_t USB_SERIAL_BAUD = 115200;
|
||||
|
||||
// Motor configuration
|
||||
// Pin number or GPIO_PIN
|
||||
// static constexpr gpio_num_t MOTOR01_PIN = GPIO_NUM_17;
|
||||
static constexpr uint16_t MOTOR01_PIN = 17;
|
||||
|
||||
// Supported: DSHOT150, DSHOT300, DSHOT600, (DSHOT1200)
|
||||
static constexpr dshot_mode_t DSHOT_MODE = DSHOT300;
|
||||
|
||||
// BiDirectional DShot Support (default: false)
|
||||
|
|
@ -24,18 +27,10 @@ static constexpr bool IS_BIDIRECTIONAL = false;
|
|||
// Motor magnet count for RPM calculation
|
||||
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);
|
||||
|
||||
// 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()
|
||||
{
|
||||
|
|
@ -62,7 +57,7 @@ void loop()
|
|||
// Send the value to the ESC
|
||||
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);
|
||||
|
||||
// Prints out "raw" DShot packet every 2 seconds
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
name=DShotRMT
|
||||
version=0.5.0
|
||||
version=0.6.0
|
||||
author=derdoktor667
|
||||
maintainer=derdoktor667
|
||||
sentence=DShotRMT Library supporting all DShot Types and speeds. Tested with BlHeli_S.
|
||||
|
|
|
|||
Loading…
Reference in New Issue