Time Event class. More...
#include "qp.h"
Public Member Functions | |
void | QTimeEvt_ctorX (QTimeEvt *const me, QActive *const act, enum_t const sig, uint_fast8_t const tickRate) |
void | QTimeEvt_armX (QTimeEvt *const me, QTimeEvtCtr const nTicks, QTimeEvtCtr const interval) |
bool | QTimeEvt_disarm (QTimeEvt *const me) |
bool | QTimeEvt_rearm (QTimeEvt *const me, QTimeEvtCtr const nTicks) |
bool | QTimeEvt_wasDisarmed (QTimeEvt *const me) |
QTimeEvtCtr | QTimeEvt_currCtr (QTimeEvt const *const me) |
Static Public Member Functions | |
bool | QTimeEvt_noActive (uint_fast8_t const tickRate) |
![]() | |
static QEvt * | QEvt_ctor (QEvt *const me, enum_t const sig) |
Public Attributes | |
QEvt | super |
![]() | |
QSignal | sig |
Static Private Member Functions | |
void | QTimeEvt_tick_ (uint_fast8_t const tickRate, void const *const sender) |
void | QTimeEvt_tick1_ (uint_fast8_t const tickRate, void const *const sender) |
Private Attributes | |
struct QTimeEvt *volatile | next |
void *volatile | act |
QTimeEvtCtr volatile | ctr |
QTimeEvtCtr | interval |
QTimeEvt | QTimeEvt_timeEvtHead_ [QF_MAX_TICK_RATE] |
Time Event class.
Time events, as any other QF events derive from the QEvt base class. Typically, you will use a time event as-is, but you can also further derive more specialized time events from it by adding some more data members and/or specialized functions that operate on the specialized time events.
Internally, the armed time events are organized into linked lists–one list for every supported ticking rate. These linked lists are scanned in every invocation of the QTIMEEVT_TICK_X() macro. Only armed (timing out) time events are in the list, so only armed time events consume CPU cycles.
QTimeEvt::QTimeEvt_ctorX | ( | QTimeEvt *const | me, |
QActive *const | act, | ||
enum_t const | sig, | ||
uint_fast8_t const | tickRate | ||
) |
The "extended" constructor to initialize a Time Event.
act
, tick rate tickRate
and event signal sig
. You cannot change these attributes later.[in,out] | me | current instance pointer (see Object Orientation) |
[in] | act | pointer to the active object associated with this time event. The time event will post itself to this AO. |
[in] | sig | signal to associate with this time event. |
[in] | tickRate | system clock tick rate to associate with this time event in the range [0..15]. |
qf_time:300
sig
must be validtickRate
must be in rangeQTimeEvt::QTimeEvt_armX | ( | QTimeEvt *const | me, |
QTimeEvtCtr const | nTicks, | ||
QTimeEvtCtr const | interval | ||
) |
Arm a time event (extended version for one shot or periodic time event)
A time event can be disarmed at any time by calling QTimeEvt_disarm(). Also, a time event can be re-armed to fire in a different number of clock ticks by calling the QTimeEvt_rearm().
[in,out] | me | current instance pointer (see Object Orientation) |
[in] | nTicks | number of clock ticks (at the associated rate) to rearm the time event with. |
[in] | interval | interval (in clock ticks) for periodic time event. |
qf_time:400
QTimeEvt::QTimeEvt_disarm | ( | QTimeEvt *const | me | ) |
Disarm a time event.
[in,out] | me | current instance pointer (see Object Orientation) |
QTimeEvt::QTimeEvt_rearm | ( | QTimeEvt *const | me, |
QTimeEvtCtr const | nTicks | ||
) |
Rearm a time event.
[in,out] | me | current instance pointer (see Object Orientation) |
[in] | nTicks | number of clock ticks (at the associated rate) to rearm the time event with. |
qf_time:600
QTimeEvt::QTimeEvt_wasDisarmed | ( | QTimeEvt *const | me | ) |
Check the "was disarmed" status of a time event.
[in,out] | me | current instance pointer (see Object Orientation) |
QTimeEvt::QTimeEvt_currCtr | ( | QTimeEvt const *const | me | ) |
Get the current value of the down-counter of a time event.
[in,out] | me | current instance pointer (see Object Orientation) |
|
staticprivate |
Processes all armed time events at every clock tick.
tickRate
.This function must be called periodically from a time-tick ISR or from a task so that QF can manage the timeout events assigned to the given system clock tick rate.
[in] | tickRate | clock tick rate serviced in this call [1..15]. |
[in] | sender | pointer to a sender object (only for QS tracing) |
tickRate
parameter can preempt each other. For example, higher clock tick rates might be serviced from interrupts while others from tasks (active objects).
|
staticprivate |
|
static |
Check if any time events are active at a given clock tick rate.
[in] | tickRate | system clock tick rate to find out about. |
qf_time:800
|
private |
|
private |
Down-counter of the time event.
|
private |
|
private |