PaulStoffregen / Encoder

Quadrature Encoder Library for Arduino
http://www.pjrc.com/teensy/td_libs_Encoder.html
540 stars 239 forks source link

Add esp32 compatibility #22

Closed lumostor closed 6 years ago

lumostor commented 6 years ago

Modified direct_pin_read.h and interrupt_pins.h to add ESP32 compatibility.

brunnwart commented 6 years ago

Dear Lumostor, I just tried the new version of Encoder.h in the Arduino IDE selecting board "ESP32 dev module" with the sample code:

include

Encoder myEnc(5, 6); void setup() { } void loop() { } but get multiple error messages ~/Arduino/libraries/Encoder-master/Encoder.h:558:21: error: array subscript is above array bounds [-Werror=array-bounds] interruptArgs[i] = state; with i ranging from 16 to 39. Do you have an idea how to fix this? Thanks and regards.

lumostor commented 6 years ago

@brunnwart, It is corrected, I will will issue a new pull request. With compiler warnings to default these errors were unseen. Thanks to flagging this out.

P.S. I you want to give it a try in the interim , clone lumostor/Encoder or change CORE_NUM_INTERRUPT value to 40, just after defined(ESP32) in utility/interrupt_pins.h PaulStoffregen/Encoder already UPDATED