Phase 7: EC11 encoder, life counter views, WS2812B RMT + LEDC buzzer feedback, E2E UI state machine; document build/hardware notes

This commit is contained in:
2026-09-09 18:36:17 +02:00
parent 8a95e1735a
commit 01c24d17b6
14 changed files with 914 additions and 29 deletions

51
main/encoder.h Normal file
View File

@@ -0,0 +1,51 @@
/*
* 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 <stdbool.h>
#include <stdint.h>
#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 Return current accumulator without resetting.
*/
int32_t encoder_get_delta(void);
/**
* @brief True if the push button was pressed since last poll.
*/
bool encoder_button_pressed(void);
/**
* @brief Clear the button-pressed flag.
*/
void encoder_clear_button(void);
#ifdef __cplusplus
}
#endif