Created
October 23, 2017 07:08
-
-
Save pietgeursen/9cba89b875813a6761f2e9504b9ce964 to your computer and use it in GitHub Desktop.
Quadrature decoder function.
This file contains hidden or 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
int32_t get_quad_direction(uint32_t prev, uint32_t latest){ | |
return ((prev >> 1) ^ (latest & 0b01)) == 1 ? -1 : 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment