Skip to content

Commit

Permalink
use gpio_ll for esp32 in interrupt handler
Browse files Browse the repository at this point in the history
  • Loading branch information
gin66 committed Aug 27, 2024
1 parent 490e293 commit 6adc9e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/StepperISR_esp32_mcpwm_pcnt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#ifdef SUPPORT_ESP32_MCPWM_PCNT

#include <hal/gpio_ll.h>

#define DEFAULT_TIMER_H_L_TRANSITION 160

// cannot be updated while timer is running => fix it to 0
Expand Down Expand Up @@ -120,7 +122,7 @@ static void IRAM_ATTR apply_command(StepperQueue *queue,
uint8_t steps = e->steps;
if (e->toggle_dir) {
gpio_num_t dirPin = (gpio_num_t)queue->dirPin;
gpio_set_level(dirPin, gpio_get_level(dirPin) ^ 1);
gpio_ll_set_level(&GPIO, dirPin, gpio_ll_get_level(&GPIO, dirPin) ^ 1);
}
uint16_t ticks = e->ticks;
#ifndef __ESP32_IDF_V44__
Expand Down
3 changes: 2 additions & 1 deletion src/StepperISR_esp32_rmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// #define TEST_MODE

#include "test_probe.h"
#include <hal/gpio_ll.h>

// The following concept is in use:
//
Expand Down Expand Up @@ -84,7 +85,7 @@ static void IRAM_ATTR apply_command(StepperQueue *q, bool fill_part_one,
// The ongoing command does not contain steps, so change dir here should be
// ok
gpio_num_t dirPin = (gpio_num_t)q->dirPin;
gpio_set_level(dirPin, gpio_get_level(dirPin) ^ 1);
gpio_ll_set_level(&GPIO, dirPin, gpio_ll_get_level(&GPIO, dirPin) ^ 1);
// and delete the request
e_curr->toggle_dir = 0;
}
Expand Down

0 comments on commit 6adc9e9

Please sign in to comment.