17#ifndef SBL_COMPONENTS_CONTROL_ENCODER_HPP_
18#define SBL_COMPONENTS_CONTROL_ENCODER_HPP_
33 Encoder() : state_(0), delta_(0), position_(0) {}
46 uint8_t new_state = (b ? 2u : 0u) | (a ? 1u : 0u);
49 uint8_t idx = (state_ << 2) | new_state;
53 static constexpr int8_t table[16] = {
64 int8_t step = table[idx];
Quadrature encoder with Gray code state machine and position tracking.
int32_t position() const
Cumulative position (does not reset)
int32_t delta()
Steps since last delta() call.
void reset()
Reset all state.
void update(bool a, bool b)
Feed quadrature signals.
Root namespace for all Sound Byte Libs functionality.