16 NULL, NULL, NULL, NULL };
27 unit = (pcnt_unit_t) -1;
40 uint32_t intr_status = PCNT.int_st.val;
43 for (i = 0; i < PCNT_UNIT_MAX; i++) {
44 if (intr_status & (BIT(i))) {
45 ptr = ESP32Encoder::encoders[i];
50 if(PCNT.status_unit[i].h_lim_lat){
53 if(PCNT.status_unit[i].l_lim_lat){
57 PCNT.int_clr.val = BIT(i);
65 Serial.println(
"Already attached, FAIL!");
70 if (ESP32Encoder::encoders[index] == NULL) {
75 if (index == MAX_ESP32_ENCODERS) {
76 Serial.println(
"Too many encoders, FAIL!");
82 unit = (pcnt_unit_t) index;
89 gpio_set_direction(
aPinNumber, GPIO_MODE_INPUT);
90 gpio_set_direction(
bPinNumber, GPIO_MODE_INPUT);
159 pcnt_event_enable(
unit, PCNT_EVT_H_LIM);
160 pcnt_event_enable(
unit, PCNT_EVT_L_LIM);
162 pcnt_counter_pause(
unit);
163 pcnt_counter_clear(
unit);
170 Serial.println(
"Encoder wrap interrupt failed");
173 pcnt_intr_enable(
unit);
174 pcnt_counter_resume(
unit);
194 pcnt_get_counter_value(
unit, &c);
203 return pcnt_counter_clear(
unit);
207 return pcnt_counter_pause(
unit);
211 return pcnt_counter_resume(
unit);
216 pcnt_filter_disable(
unit);
218 pcnt_set_filter_value(
unit, value);
219 pcnt_filter_enable(
unit);
pcnt_config_t r_enc_config
static void IRAM_ATTR pcnt_example_intr_handler(void *arg)
void setFilter(uint16_t value)
void attachHalfQuad(int aPintNumber, int bPinNumber)
void attachSingleEdge(int aPintNumber, int bPinNumber)
void setCount(int64_t value)
static pcnt_isr_handle_t user_isr_handle
#define MAX_ESP32_ENCODERS
void attach(int aPintNumber, int bPinNumber, enum encType et)
static ESP32Encoder * encoders[MAX_ESP32_ENCODERS]
static enum puType useInternalWeakPullResistors
static bool attachedInterrupt
void attachFullQuad(int aPintNumber, int bPinNumber)