Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
encoder.hpp File Reference

Quadrature encoder component - Gray code state machine. More...

Detailed Description

Quadrature encoder component - Gray code state machine.

Encoder tracks rotational position from A/B quadrature signals. Decodes with a 16-entry transition table indexed by the old and new A/B states. The encoder's push-button is a separate Button component (composable).

Usage:

enc.update(gpio_a, gpio_b); // Feed A/B each tick
int32_t d = enc.delta(); // Steps since last check (+CW/-CCW)
int32_t pos = enc.position(); // Cumulative position
Quadrature encoder with Gray code state machine and position tracking.
Definition encoder.hpp:30
int32_t position() const
Cumulative position (does not reset)
Definition encoder.hpp:95
int32_t delta()
Steps since last delta() call.
Definition encoder.hpp:88
void update(bool a, bool b)
Feed quadrature signals.
Definition encoder.hpp:44

Definition in file encoder.hpp.

#include <cstdint>

Go to the source code of this file.

Classes

class  sbl::control::input::Encoder
 Quadrature encoder with Gray code state machine and position tracking. More...
 

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs code.
 
namespace  sbl::control
 The control stack: scheduler, event queue, merge, CC mapping, calibration.
 
namespace  sbl::control::input
 Inputs: debounce, decoding, smoothing and scaling of raw samples.