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) |
The "extended" constructor to initialize a Time Event. | |
void | QTimeEvt_armX (QTimeEvt *const me, uint32_t const nTicks, uint32_t const interval) |
Arm a time event (extended version for one shot or periodic time event) | |
bool | QTimeEvt_disarm (QTimeEvt *const me) |
Disarm a time event. | |
bool | QTimeEvt_rearm (QTimeEvt *const me, uint32_t const nTicks) |
Rearm a time event. | |
bool | QTimeEvt_wasDisarmed (QTimeEvt *const me) |
Check the "was disarmed" status of a time event. | |
QTimeEvtCtr | QTimeEvt_currCtr (QTimeEvt const *const me) |
Get the current value of the down-counter of a time event. | |
Static Public Member Functions | |
bool | QTimeEvt_noActive (uint_fast8_t const tickRate) |
Check if any time events are active at a given clock tick rate. | |
Static Public Member Functions inherited from QEvt | |
static void | QEvt_ctor (QEvt *const me, enum_t const sig) |
static QEvt * | QEvt_init (QEvt *const me, uint8_t dummy) |
Event without parameters initialization. | |
Public Attributes | |
QEvt | super |
Public Attributes inherited from QEvt | |
QSignal | sig |
Signal of the event (see Event Signal) | |
Static Private Member Functions | |
void | QTimeEvt_init (void) |
void | QTimeEvt_tick_ (uint_fast8_t const tickRate, void const *const sender) |
Processes all armed time events at every clock tick. | |
void | QTimeEvt_tick1_ (uint_fast8_t const tickRate, void const *const sender) |
Processes one clock tick for QUTest. | |
Private Attributes | |
struct QTimeEvt *volatile | next |
Link to the next time event in the list. | |
uintptr_t | next_dis |
void * | act |
Active object that receives the time events. | |
QTimeEvtCtr volatile | ctr |
Down-counter of the time event. | |
QTimeEvtCtr | ctr_dis |
QTimeEvtCtr | interval |
Interval for periodic time event (zero for one-shot time event) | |
uint8_t | tickRate |
uint8_t | flags |
QTimeEvt | QTimeEvt_timeEvtHead_ [QF_MAX_TICK_RATE] |
Array of heads of linked lists of time events (one for every clock tick rate) | |
uintptr_t | QTimeEvt_timeEvtHead_dis_ [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.
void 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 range void QTimeEvt_armX | ( | QTimeEvt *const | me, |
uint32_t const | nTicks, | ||
uint32_t 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
bool QTimeEvt_disarm | ( | QTimeEvt *const | me | ) |
Disarm a time event.
[in,out] | me | current instance pointer (see Object Orientation) |
bool QTimeEvt_rearm | ( | QTimeEvt *const | me, |
uint32_t 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
bool QTimeEvt_wasDisarmed | ( | QTimeEvt *const | me | ) |
Check the "was disarmed" status of a time event.
[in,out] | me | current instance pointer (see Object Orientation) |
QTimeEvtCtr 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 |
Processes one clock tick for QUTest.
|
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 |
Interval for periodic time event (zero for one-shot time event)
|
private |
|
private |