|
Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
Quadrature encoder with Gray code state machine and position tracking. More...
#include <encoder.hpp>
Public Member Functions | |
| Encoder () | |
| void | update (bool a, bool b) |
| Feed quadrature signals. | |
| int32_t | delta () |
| Steps since last delta() call. | |
| int32_t | position () const |
| Cumulative position (does not reset) | |
| void | reset () |
| Reset all state. | |
Quadrature encoder with Gray code state machine and position tracking.
Definition at line 31 of file encoder.hpp.
|
inline |
Definition at line 33 of file encoder.hpp.
|
inline |
Steps since last delta() call.
Positive = CW, negative = CCW. Resets on read.
Definition at line 76 of file encoder.hpp.
|
inline |
Cumulative position (does not reset)
Definition at line 83 of file encoder.hpp.
|
inline |
Reset all state.
Definition at line 86 of file encoder.hpp.
|
inline |
Feed quadrature signals.
Call once per update cycle with current A and B readings. The state machine detects CW/CCW transitions and accumulates delta.
| a | Channel A reading |
| b | Channel B reading |
Definition at line 44 of file encoder.hpp.
Referenced by sbl::encoder::read().