File Switch2Pos.h
File List > Firmware > Libraries > PanelGroup > Inputs > Switch2Pos > Switch2Pos.h
Go to the documentation of this file
#pragma once
#ifdef ARDUINO_ARCH_STM32
#include <PanelGroup.h> // InputBase, PinRef
namespace OpenSkyhawk {
class Switch2Pos : public InputBase {
public:
static constexpr uint16_t DEBOUNCE_MS = 20;
Switch2Pos(uint16_t controlId, PinRef pin);
Switch2Pos(uint16_t controlId, PinRef pin, bool reverse);
void poll() override;
void forceReport() override;
void configure() override;
private:
uint16_t _controlId;
PinRef _pin;
bool _reverse; // true = active-HIGH (external pull-down required)
bool _lastConfirmed; // last emitted state (true = active)
bool _pendingRaw; // raw reading at the last level change
uint32_t _debounceStartMs; // millis() when _pendingRaw last changed
bool _initialized; // false until forceReport() is called; poll() no-op before this
};
} // namespace OpenSkyhawk
#endif // ARDUINO_ARCH_STM32