PaulStoffregen / Encoder

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

Add support for ATmega32u2 and ATmega16u2 #32

Closed M-Reimer closed 5 years ago

M-Reimer commented 5 years ago

This pull request adds support for all boards (including official ones like UNO, MEGA, ...) that have the "additional USB side" Atmel Microcontroller.

If you flash "HoodLoader2" into this chip, then it can be programmed with own sketches.

Would be great if you could accept this pull request as it is not possible to define the variables in my sketch. In Encoder.cpp you write:

// Yes, all the code is in the header file, to provide the user // configure options with #define (before they include it), and // to facilitate some crafty optimizations!

This doesn't work for the interrupt defines as you have "#include "Encoder.h"" in this cpp file and Arduino will compile libraries first --> Errors out immediately.

Link to HoodLoader2: https://github.com/NicoHood/HoodLoader2

M-Reimer commented 5 years ago

Please delay this one. Needs to be updated as there still is an issue with Interrupts with HoodLoader2:

https://github.com/NicoHood/HoodLoader2/issues/67

M-Reimer commented 5 years ago

Should be OK now. Please comment if you need additional information. Would be great if this could be added. I plan to use your library in some kind of "open source video cutting input device" (jog wheel and shuttle control) and your library is far the best I've found so far. Very precise detection of rotary movement!