Skip to content

Commit

Permalink
[MIGRATION]: Migrated to ESP IDF V5
Browse files Browse the repository at this point in the history
  • Loading branch information
Witty-Wizard committed Jun 20, 2024
1 parent cfaa74a commit f81d946
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/dshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ dshot::dshot(int pin, DShotType type) : DriveMaster(pin) {
}
dshot::~dshot() {}

void dshot::begin() {
_channel = rmtInit(_pin, RMT_TX_MODE, RMT_MEM_64);
rmtSetTick(_channel, 1000);
}
void dshot::begin() { rmtInit(_pin, RMT_TX_MODE, RMT_MEM_NUM_BLOCKS_1, 1000); }

void dshot::write(uint16_t value, bool telemetery) {
uint8_t crc = calculateCrc(value);
Expand All @@ -39,7 +36,7 @@ void dshot::write(uint16_t value, bool telemetery) {
_data[i].level0 = 1;
_data[i].level1 = 0;
}
rmtWrite(_channel, _data, DSHOT_FRAME_LENGTH);
rmtWrite(_pin, _data, DSHOT_FRAME_LENGTH,10);
}

uint8_t dshot::calculateCrc(uint16_t value) {
Expand Down
1 change: 0 additions & 1 deletion src/dshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ enum DShotType {
*/
class dshot : public DriveMaster {
private:
rmt_obj_t *_channel = nullptr; /**< RMT channel for DShot communication */
rmt_data_t _data[DSHOT_FRAME_LENGTH]; /**< RMT data array for DShot frames */
uint16_t _timingDuration0; /**< Timing duration for logic 0 */
uint16_t _timingDuration1; /**< Timing duration for logic 1 */
Expand Down

0 comments on commit f81d946

Please sign in to comment.