![]() |
semf
|
A TimeBase
is the bridge between e.g. a hardware timer (interrupt service routine) and TickReceiver
objects like /c SoftwareTimer. Multiple timers can be added to one TimeBase
object, but one TickReceiver
object can only be added to a single TimeBase
. It's also not possible to add a TickReceiver
object twice to a TimeBase
.
More...
#include <timebase.h>
Public Member Functions | |
virtual | ~TimeBase ()=default |
virtual void | add (TickReceiver &tickReceiver)=0 |
Adds e.g. a timer to this timebase. More... | |
virtual void | remove (TickReceiver &tickReceiver)=0 |
Removes e.g. a timer from this timebase. More... | |
virtual void | enable (bool enable=true)=0 |
Enables the TimeBase . More... | |
virtual void | disable (bool disable=true)=0 |
Disables the TimeBase . More... | |
virtual bool | isEnabled () const =0 |
Returns if the TimeBase is enabled. More... | |
A TimeBase
is the bridge between e.g. a hardware timer (interrupt service routine) and TickReceiver
objects like /c SoftwareTimer. Multiple timers can be added to one TimeBase
object, but one TickReceiver
object can only be added to a single TimeBase
. It's also not possible to add a TickReceiver
object twice to a TimeBase
.
When e.g. the hardware timer interrupt elapses, the count function of every previously added TickReceiver
will be called in the order, the SoftwareTimer
objects were added.
A TimeBase
can easily be enabled
or disabled
. A disabled TimeBase
does not call the timers count functions until it's enabled again.
count
function must be called cyclically e.g. by a the interrupt service routine of a microcontroller. Definition at line 35 of file timebase.h.
|
virtualdefault |
|
pure virtual |
Adds e.g. a timer to this timebase.
tickReceiver | e.g. /c SoftwareTimer or /c DigitalInPolling to add. |
Implemented in semf::TimeBase.
|
pure virtual |
Disables the TimeBase
.
disable | true disables the TimeBase . |
Implemented in semf::TimeBase.
|
pure virtual |
Enables the TimeBase
.
enable | true enables the TimeBase . |
Implemented in semf::TimeBase.
|
pure virtual |
Returns if the TimeBase
is enabled.
Only a enabled timebase's timers count and elapse.
true
for TimeBase
enabled, otherwise false
. Implemented in semf::TimeBase.
|
pure virtual |
Removes e.g. a timer from this timebase.
tickReceiver | e.g. /c SoftwareTimer or /c DigitalInPolling to remove. |
Implemented in semf::TimeBase.