24 lines
739 B
C++
24 lines
739 B
C++
// hal/switch_stub.h
|
|
#pragma once
|
|
|
|
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
|
|
}; |