#include <ESP32_RMT_Dshot.h>
Definition at line 15 of file ESP32_RMT_Dshot.h.
◆ ESP32_RMT_Dshot()
ESP32_RMT_Dshot::ESP32_RMT_Dshot |
( |
rmt_channel_t |
channel, |
|
|
gpio_num_t |
gpio_port |
|
) |
| |
Dshot150 using RMT hardware.
- Parameters
-
channel,rmt | channel |
gpio_port,gpio | port to send Dshot over. |
Definition at line 9 of file ESP32_RMT_Dshot.cpp.
10 const static uint32_t PERF_CLK_HZ = 80000000;
12 const static uint8_t clk_div = 1;
26 const static float ticks_per_second_in_nanosecond = ((float) PERF_CLK_HZ / (
float) clk_div) / 1000000000;
42 case ESP_ERR_INVALID_ARG:
static void * _update_task(void *_this)
static function to help pthead
pthread_mutex_t dshot_frame_lock
rmt_config_t driver_config
err_t startup_error
error when constructing gets put here, read before usage.
◆ ~ESP32_RMT_Dshot()
ESP32_RMT_Dshot::~ESP32_RMT_Dshot |
( |
| ) |
|
Definition at line 59 of file ESP32_RMT_Dshot.cpp.
pthread_mutex_t dshot_frame_lock
rmt_config_t driver_config
◆ _update_task()
void * ESP32_RMT_Dshot::_update_task |
( |
void * |
_this | ) |
|
|
staticprivate |
static function to help pthead
- Parameters
-
- Returns
- 0
Definition at line 76 of file ESP32_RMT_Dshot.cpp.
void update_task()
updates ESC with current dshot buffer, blocks CPU
◆ _write_frame_continuous()
err_t ESP32_RMT_Dshot::_write_frame_continuous |
( |
uint16_t |
dshot_frame | ) |
|
|
overrideprivatevirtual |
Write set Dshot frame continuously on the bus.
- Parameters
-
dshot_frame | Dhsot frame to send, already encoded in bits |
- Returns
-
Implements aruna::driver::Dshot.
Definition at line 81 of file ESP32_RMT_Dshot.cpp.
pthread_mutex_t dshot_frame_lock
◆ bits_to_dshotFrame()
void aruna::driver::ESP32_RMT_Dshot::bits_to_dshotFrame |
( |
uint16_t |
bits, |
|
|
rmt_item32_t * |
frame_buffer |
|
) |
| |
|
private |
convert bits to rmt frame
- Parameters
-
bits | dshot package (16bit with speed, telemetry and CRC) |
frame_buffer | array of 17 (to include 0 terminator) |
◆ single_write()
err_t ESP32_RMT_Dshot::single_write |
( |
uint16_t |
dshot_frame | ) |
|
|
private |
Write a single Dshot frame to the bus.
- Parameters
-
dshot_frame | frame to be written |
- Returns
- always err_t::OK
Definition at line 88 of file ESP32_RMT_Dshot.cpp.
89 const static size_t rmt_size = 17;
90 static rmt_item32_t rmt_frame[rmt_size];
92 for (uint8_t i = 0; i < rmt_size - 1; ++i) {
93 uint16_t i_bit = (
dshot_frame >> (rmt_size - 2 - i)) & 0b1;
97 rmt_frame[i] = {{{on_time, 1, off_time, 0}}};
100 rmt_frame[rmt_size - 1] = {{{0, 1, 0, 0}}};
102 ESP_ERROR_CHECK(rmt_write_items(
driver_config.channel, rmt_frame, rmt_size,
true));
rmt_config_t driver_config
◆ update_task()
void ESP32_RMT_Dshot::update_task |
( |
| ) |
|
|
private |
updates ESC with current dshot buffer, blocks CPU
Definition at line 65 of file ESP32_RMT_Dshot.cpp.
err_t single_write(uint16_t dshot_frame)
Write a single Dshot frame to the bus.
pthread_mutex_t dshot_frame_lock
◆ driver_config
rmt_config_t aruna::driver::ESP32_RMT_Dshot::driver_config |
|
private |
◆ dshot_frame
uint16_t aruna::driver::ESP32_RMT_Dshot::dshot_frame = 0 |
|
private |
◆ dshot_frame_lock
pthread_mutex_t aruna::driver::ESP32_RMT_Dshot::dshot_frame_lock |
|
private |
◆ T0H_ticks
uint16_t aruna::driver::ESP32_RMT_Dshot::T0H_ticks |
|
private |
◆ T0L_ticks
uint16_t aruna::driver::ESP32_RMT_Dshot::T0L_ticks |
|
private |
◆ T1H_ticks
uint16_t aruna::driver::ESP32_RMT_Dshot::T1H_ticks |
|
private |
◆ T1L_ticks
uint16_t aruna::driver::ESP32_RMT_Dshot::T1L_ticks |
|
private |
◆ update_handler
pthread_t aruna::driver::ESP32_RMT_Dshot::update_handler |
|
private |
The documentation for this class was generated from the following files: