// components/hal/switch_stub.h #pragma once #include class SwitchStub { public: virtual ~SwitchStub() {} virtual void begin() = 0; virtual bool is_pressed(uint8_t switch_id) = 0; // Configuration methods virtual void configure_switch(uint8_t switch_id, uint8_t gpio_pin) = 0; virtual void set_debounce_time(uint32_t time_ms) = 0; }; // Switch state structure struct SwitchState { uint8_t id; // Switch identifier uint8_t gpio_pin; // GPIO pin (if applicable) bool current_state; // Current pressed state bool previous_state; // Previous state (for debounce) uint32_t last_change_time; // Timestamp of last state change uint32_t debounce_time; // Debounce time in ms }; // Default stub implementation class DefaultSwitchStub : public SwitchStub { private: static const uint8_t NUM_SWITCHES = 10; SwitchState switch_states[NUM_SWITCHES]; bool initialized; public: DefaultSwitchStub(); void begin() override; bool is_pressed(uint8_t switch_id) override; void configure_switch(uint8_t switch_id, uint8_t gpio_pin) override; void set_debounce_time(uint32_t time_ms) override; };