Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Classes | Namespaces
encoder.hpp File Reference

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

#include <cstdint>
Include dependency graph for encoder.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

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

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs functionality.
 
namespace  sbl::components
 Mid-level functional components.
 
namespace  sbl::components::control
 Physical control components.
 

Detailed Description

Quadrature encoder component — Gray code state machine.

Encoder tracks rotational position from A/B quadrature signals. Uses a 16-entry transition table for robust decoding. The encoder's push-button is a separate Button component (composable).

Usage: sbl::components::control::Encoder enc; 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

Definition in file encoder.hpp.