1 // Rotary knob implementation - Version 2.
2 // Uses 2 digital pins - D2 (via interrupt) & D6.
5 #include <avr/interrupt.h>
9 #define ENCODER_PIN_1 PD2
12 #define ENCODER_PIN_2 PD6
15 #define ENCODER_INT INT2_vect
18 typedef struct knob_report_t {
19 int8_t dir; // Contains number of rotations that happened
20 int8_t phase; // Contains 0 if last rotation happened on 90 degrees, 1 if on 270
24 knob_report_t knob_report_read(void);
25 void knob_report_reset(void);