17 m_debounceLowTime(debounceLowTime),
18 m_debounceHighTime(debounceHighTime)
24 m_debounceLowTime(debounceLowTime),
25 m_debounceHighTime(debounceHighTime)
32 m_debounceHighTime = time;
38 m_debounceLowTime = time;
45 if (oldState == app::DigitalIn::State::Low && newState == app::DigitalIn::State::High)
49 if (m_highTime >= m_debounceHighTime)
51 setState(app::DigitalIn::State::High);
56 else if (oldState == app::DigitalIn::State::High && newState == app::DigitalIn::State::Low)
60 if (m_lowTime >= m_debounceLowTime)
62 setState(app::DigitalIn::State::Low);
void tick() override
Checks the present pin state and counts the debounce time.
void setDebounceHighTime(uint32_t time)
Sets the debounce time for switching from low to high.
void setDebounceLowTime(uint32_t time)
Sets the debounce time for switching from high to low.
DebouncedDigitalInPolling(Gpio &gpio, uint32_t debounceLowTime, uint32_t debounceHighTime, bool inverted=false)
Constructor.
State state() const override
Returns the level status of the hardware pin.
Class for reading a digital input in polling mode.
State state() const override
Returns the level status of the hardware pin.
void setState(State state)
Sets the hardware pin status internally.
Interface class for using a GPIO pin of the microcontroller.
A TimeBase is the bridge between e.g. a hardware timer (interrupt service routine) and TickReceiver o...