semf
debounceddigitalinpolling.h
Go to the documentation of this file.
1
10#ifndef SEMF_INPUT_DIGITALIN_DEBOUNCEDDIGITALINPOLLING_H_
11#define SEMF_INPUT_DIGITALIN_DEBOUNCEDDIGITALINPOLLING_H_
12
14
15namespace semf
16{
28{
29public:
33
41 DebouncedDigitalInPolling(Gpio& gpio, uint32_t debounceLowTime, uint32_t debounceHighTime, bool inverted = false);
50 DebouncedDigitalInPolling(Gpio& gpio, app::TimeBase& timeBase, uint32_t debounceLowTime, uint32_t debounceHighTime, bool inverted = false);
52 virtual ~DebouncedDigitalInPolling() = default;
53
58 void setDebounceHighTime(uint32_t time);
63 void setDebounceLowTime(uint32_t time);
68 void tick() override;
69
70private:
72 uint32_t m_debounceLowTime;
74 uint32_t m_debounceHighTime;
76 uint32_t m_lowTime = 0;
78 uint32_t m_highTime = 0;
79};
80} /* namespace semf */
81#endif /* SEMF_INPUT_DIGITALIN_DEBOUNCEDDIGITALINPOLLING_H_ */
Class for reading and debouncing a digital input (e.g. used for buttons or relays inputs)....
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.
virtual ~DebouncedDigitalInPolling()=default
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.
DebouncedDigitalInPolling(const DebouncedDigitalInPolling &other)=delete
Gpio & gpio() const
Returns the pointer to the GPIO to check the status from.
Definition: digitalin.cpp:40
Class for reading a digital input in polling mode.
DigitalInPolling(Gpio &gpio, bool inverted=false)
Constructor.
Interface class for using a GPIO pin of the microcontroller.
Definition: gpio.h:23
A TimeBase is the bridge between e.g. a hardware timer (interrupt service routine) and TickReceiver o...
Definition: timebase.h:36