This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
I am using Oleg's algorithm for reading an encoder using a lookup table, here: | |
https://www.circuitsathome.com/mcu/reading-rotary-encoder-on-arduino | |
But instead of this table of 16 bytes: | |
static int8_t enc_states[] = { 0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0 }; | |
I am using two tables of 8 bits each. The bits in these tables indicate sign bits and one bits | |
of the generated results. This takes advantage of the fact that I can easily encode 3 values |