OS
v1.7.5
Documentation
|
A non-blocking Timer object. More...
#include <timer.hpp>
Public Member Functions | |
timer () | |
timer (const qOS::duration_t tTime) | |
Initializes the instance of the timer with the specified expiration time. Timer will start armed. | |
bool | set (const qOS::duration_t tTime) noexcept |
Set the expiration time for a timer. On success, the timer gets armed immediately. | |
void | disarm (void) noexcept |
Disarms the timer object. | |
void | reload (void) noexcept |
Reload the timer with the previous specified time. | |
bool | status (void) const noexcept |
Get the current status of the Timer (Armed or Disarmed) | |
bool | freeRun (const qOS::duration_t tTime) noexcept |
Non-Blocking timer check with automatic arming. | |
qOS::clock_t | remaining (void) const noexcept |
Retrieve the remaining time in epochs. | |
qOS::clock_t | elapsed (void) const noexcept |
Retrieve the elapsed time in epochs. | |
bool | expired (void) const noexcept |
Non-Blocking timer check. | |
bool | deadLineCheck (void) const noexcept |
Check if the specified deadline for has been reached. | |
qOS::clock_t | getInterval (void) const noexcept |
Retrieve the timer interval value. | |
timer & | operator= (const qOS::duration_t tTime) |
Set the expiration time for a timer and gets armed immediately. | |
timer & | operator= (const bool en) |
Disarm or reload the timer. | |
bool | operator() (void) const |
Non-Blocking timer check. | |
bool | operator() (const qOS::duration_t tTime) |
Set the expiration time for a timer and gets armed immediately. | |
void | operator() (const bool en) |
Disarm or reload the timer. | |
Static Public Attributes | |
static const bool | ARMED |
Constant that defines the status of an armed timer. | |
static const bool | DISARMED |
Constant that defines the status of a disarmed timer. | |
static const qOS::clock_t | DISARM_VALUE |
Constant that defines the value of a disarmed timer. | |
static const qOS::clock_t | REMAINING_IN_DISARMED_STATE |
Constant that defines the value that a disarmed timer returns when the remaining time is requested. | |
A non-blocking Timer object.
Timers are an essential extension as they allow for accurate and efficient timekeeping without blocking tasks. Using timers enables the embedded application to perform other critical tasks while the timer is running in the background. Timers also provide flexibility in the event that the timer needs to be paused, restarted, or adjusted on the fly. This can be particularly useful in applications that require dynamic timing or have unpredictable event intervals.
qOS::timer::timer | ( | ) |
|
inlineexplicit |
Initializes the instance of the timer with the specified expiration time. Timer will start armed.
[in] | tTime | The expiration time given in milliseconds. |
|
noexcept |
Check if the specified deadline for has been reached.
true
if the deadline has been reached, otherwise, returns false
.
|
noexcept |
Disarms the timer object.
|
noexcept |
Retrieve the elapsed time in epochs.
|
noexcept |
Non-Blocking timer check.
true
when timer expires, otherwise, returns false
. false
.
|
noexcept |
Non-Blocking timer check with automatic arming.
Behavior: If disarmed, it gets armed immediately with the specified time.
If armed, the time argument is ignored and the API only checks for expiration. When the time expires, the timer gets armed immediately taking the specified time.
[in] | tTime | The expiration time given in milliseconds. |
true
on success, otherwise, returns false
. false
.
|
noexcept |
Retrieve the timer interval value.
void qOS::timer::operator() | ( | const bool | en | ) |
Disarm or reload the timer.
[in] | en | true for reload of false to disarm. |
bool qOS::timer::operator() | ( | const qOS::duration_t | tTime | ) |
Set the expiration time for a timer and gets armed immediately.
[in] | tTime | The expiration time given in milliseconds. |
bool qOS::timer::operator() | ( | void | ) | const |
Non-Blocking timer check.
true
when timer expires, otherwise, returns false
. false
. timer & qOS::timer::operator= | ( | const bool | en | ) |
Disarm or reload the timer.
[in] | en | true for reload of false to disarm. |
timer & qOS::timer::operator= | ( | const qOS::duration_t | tTime | ) |
Set the expiration time for a timer and gets armed immediately.
[in] | tTime | The expiration time given in milliseconds. |
|
noexcept |
Reload the timer with the previous specified time.
|
noexcept |
Retrieve the remaining time in epochs.
|
noexcept |
Set the expiration time for a timer. On success, the timer gets armed immediately.
[in] | tTime | The expiration time given in milliseconds. |
true
on success, otherwise, returns false
.
|
noexcept |
Get the current status of the Timer (Armed or Disarmed)
true
when armed, otherwise false
when disarmed.
|
static |
Constant that defines the status of an armed timer.
|
static |
Constant that defines the value of a disarmed timer.
|
static |
Constant that defines the status of a disarmed timer.
|
static |
Constant that defines the value that a disarmed timer returns when the remaining time is requested.