/* * MTG RFID Companion - EC11 rotary encoder driver * * Phase 7 Step 7.1: Interrupt-driven quadrature decode on GPIO CLK/DT with * a debounced push button on SW (active low). */ #pragma once #include "esp_err.h" #include #include #ifdef __cplusplus extern "C" { #endif /** * @brief Install GPIO ISR service and configure encoder pins. */ esp_err_t encoder_init(void); /** * @brief True if the encoder has rotated since the last check. */ bool encoder_has_delta(void); /** * @brief Return the accumulated rotation steps and reset it. * Positive = clockwise, negative = counter-clockwise (configurable). */ int32_t encoder_get_delta_and_reset(void); /** * @brief Get current quadrature steps per mechanical detent tick (2 or 4). */ int8_t encoder_get_steps_per_detent(void); /** * @brief Set quadrature steps per mechanical detent tick (2 or 4). */ void encoder_set_steps_per_detent(int8_t steps); #ifdef __cplusplus } #endif