![]() |
semf
|
Class for reading and debouncing a digital input (e.g. used for buttons or relays inputs). The two signals changedToHigh
and changedToLow
will be emitted after the pin level changed and the debounce time is passed.
More...
#include <debounceddigitalinpolling.h>
Public Member Functions | |
DebouncedDigitalInPolling (Gpio &gpio, uint32_t debounceLowTime, uint32_t debounceHighTime, bool inverted=false) | |
Constructor. More... | |
DebouncedDigitalInPolling (Gpio &gpio, app::TimeBase &timeBase, uint32_t debounceLowTime, uint32_t debounceHighTime, bool inverted=false) | |
Constructor. More... | |
DebouncedDigitalInPolling (const DebouncedDigitalInPolling &other)=delete | |
virtual | ~DebouncedDigitalInPolling ()=default |
void | setDebounceHighTime (uint32_t time) |
Sets the debounce time for switching from low to high. More... | |
void | setDebounceLowTime (uint32_t time) |
Sets the debounce time for switching from high to low. More... | |
void | tick () override |
Checks the present pin state and counts the debounce time. More... | |
![]() | |
DigitalInPolling (Gpio &gpio, bool inverted=false) | |
Constructor. More... | |
DigitalInPolling (Gpio &gpio, app::TimeBase &timeBase, bool inverted=false) | |
Constructor. More... | |
DigitalInPolling (const DigitalInPolling &other)=delete | |
virtual | ~DigitalInPolling ()=default |
void | tick () override |
State | state () const override |
Returns the level status of the hardware pin. More... | |
![]() | |
DigitalIn (Gpio &gpio, bool inverted=false) | |
Constructor. More... | |
DigitalIn (const DigitalIn &other)=delete | |
bool | isInverted () const override |
Returns of the pin level logic is inverted. More... | |
void | setInverted (bool inverted) override |
Configures the inversion of the input reading. More... | |
State | state () const override |
Returns the level status of the hardware pin. More... | |
![]() | |
virtual | ~DigitalIn ()=default |
virtual bool | isInverted () const =0 |
Returns of the pin level logic is inverted. More... | |
virtual void | setInverted (bool inverted)=0 |
Configures the inversion of the input reading. More... | |
virtual State | state () const =0 |
Returns the level status of the hardware pin. More... | |
![]() | |
virtual | ~TickReceiver ()=default |
virtual void | tick ()=0 |
Is called by every tick. Is called periodically e.g. by a Timer object. More... | |
![]() | |
virtual | ~Node ()=default |
T * | next () const |
Returns a pointer to the next element in a list. More... | |
void | setNext (T *next) |
Sets a pointer to the next element in a list. More... | |
T * | previous () const |
Returns a pointer to the previous element in a list. More... | |
void | setPrevious (T *previous) |
Sets a pointer to the previous element in a list. More... | |
bool | isInAList () |
Returns if a node is part of a LinkedList . More... | |
Additional Inherited Members | |
![]() | |
enum | State : bool { Low = false , High = true } |
![]() | |
Signal | changedToHigh |
Signal | changedToLow |
![]() | |
void | setState (State state) |
Sets the hardware pin status internally. More... | |
![]() | |
Gpio & | gpio () const |
Returns the pointer to the GPIO to check the status from. More... | |
Class for reading and debouncing a digital input (e.g. used for buttons or relays inputs). The two signals changedToHigh
and changedToLow
will be emitted after the pin level changed and the debounce time is passed.
For reading the actual hardware pin level, call the function DigitalIn::state()
.
app::DigitalIn
DigitalInPolling
Definition at line 27 of file debounceddigitalinpolling.h.
semf::DebouncedDigitalInPolling::DebouncedDigitalInPolling | ( | Gpio & | gpio, |
uint32_t | debounceLowTime, | ||
uint32_t | debounceHighTime, | ||
bool | inverted = false |
||
) |
Constructor.
gpio | GPIO interface object for hardware access. |
debounceLowTime | Debounce time taken to change from high to low. |
debounceHighTime | Debounce time taken to change from low to high. |
inverted | true sets high level of a pin as low and low level of a pin as high. |
Definition at line 15 of file debounceddigitalinpolling.cpp.
semf::DebouncedDigitalInPolling::DebouncedDigitalInPolling | ( | Gpio & | gpio, |
app::TimeBase & | timeBase, | ||
uint32_t | debounceLowTime, | ||
uint32_t | debounceHighTime, | ||
bool | inverted = false |
||
) |
Constructor.
gpio | GPIO interface object for hardware access. |
timeBase | The timebase for the internal timer. |
debounceLowTime | Debounce time taken to change from high to low. |
debounceHighTime | Debounce time taken to change from low to high. |
inverted | true sets high level of a pin as low and low level of a pin as high. |
Definition at line 22 of file debounceddigitalinpolling.cpp.
|
explicitdelete |
|
virtualdefault |
void semf::DebouncedDigitalInPolling::setDebounceHighTime | ( | uint32_t | time | ) |
Sets the debounce time for switching from low to high.
time | The debounce high time. |
Definition at line 29 of file debounceddigitalinpolling.cpp.
void semf::DebouncedDigitalInPolling::setDebounceLowTime | ( | uint32_t | time | ) |
Sets the debounce time for switching from high to low.
time | The debounce low time. |
Definition at line 35 of file debounceddigitalinpolling.cpp.
|
overridevirtual |
Checks the present pin state and counts the debounce time.
Implements semf::TickReceiver.
Definition at line 41 of file debounceddigitalinpolling.cpp.