QP/C  8.0.2
Real-Time Embedded Framework
Loading...
Searching...
No Matches
QTimeEvt Class Reference

Time Event class. More...

#include "qp.h"

Inheritance diagram for QTimeEvt:
QEvt

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, uint32_t const nTicks, uint32_t const interval)
 
bool QTimeEvt_disarm (QTimeEvt *const me)
 
bool QTimeEvt_rearm (QTimeEvt *const me, uint32_t 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 Public Member Functions inherited from QEvt
static void QEvt_ctor (QEvt *const me, enum_t const sig)
 
static QEvtQEvt_init (QEvt *const me, uint8_t const dummy)
 

Protected Attributes

QEvt super
 

Private Member Functions

QTimeEvtQTimeEvt_expire_ (QTimeEvt *const me, QTimeEvt *const prev_link, QActive const *const act, uint_fast8_t const tickRate)
 

Static Private Member Functions

void QTimeEvt_init (void)
 
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
 Link to the next time event in the list.
 
void * act
 Active object that receives the time events.
 
QTimeEvtCtr volatile ctr
 Down-counter of the time event.
 
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)
 

Additional Inherited Members

- Public Attributes inherited from QEvt
QSignal sig
 Signal of the event (see Event Signal)
 

Detailed Description

Time Event class.

Details

Time events are special QF events equipped with the notion of time passage. The basic usage model of the time events is as follows. An active object allocates one or more QTimeEvt objects (provides the storage for them). When the active object needs to arrange for a timeout, it arms one of its time events to fire either just once (one-shot) or periodically. Each time event times out independently from the others, so a QF application can make multiple parallel timeout requests (from the same or different active objects). When QF detects that the appropriate moment has arrived, it inserts the time event directly into the recipient's event queue. The recipient then processes the time event just like any other event.

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.

Note
QF manages the time events in the QTIMEEVT_TICK_X() macro, which must be called periodically, from the clock tick ISR or from other periodic source. QTIMEEVT_TICK_X() caYou might also use the special QTicker active object.
Even though QTimeEvt is a subclass of QEvt, QTimeEvt instances can NOT be allocated dynamically from event pools. In other words, it is illegal to allocate QTimeEvt instances with the Q_NEW() or Q_NEW_X() macros.
Backward Traceability

Definition at line 629 of file qp.h.

Member Function Documentation

◆ QTimeEvt_ctorX()

void QTimeEvt_ctorX ( QTimeEvt *const me,
QActive *const act,
enum_t const sig,
uint_fast8_t const tickRate )

◆ QTimeEvt_armX()

void QTimeEvt_armX ( QTimeEvt *const me,
uint32_t const nTicks,
uint32_t const interval )

Definition at line 73 of file qf_time.c.

◆ QTimeEvt_disarm()

bool QTimeEvt_disarm ( QTimeEvt *const me)

Definition at line 137 of file qf_time.c.

◆ QTimeEvt_rearm()

bool QTimeEvt_rearm ( QTimeEvt *const me,
uint32_t const nTicks )

Definition at line 181 of file qf_time.c.

◆ QTimeEvt_wasDisarmed()

bool QTimeEvt_wasDisarmed ( QTimeEvt *const me)

Definition at line 250 of file qf_time.c.

◆ QTimeEvt_currCtr()

QTimeEvtCtr QTimeEvt_currCtr ( QTimeEvt const *const me)

Definition at line 264 of file qf_time.c.

◆ QTimeEvt_init()

void QTimeEvt_init ( void )
staticprivate

Definition at line 275 of file qf_time.c.

◆ QTimeEvt_tick_()

void QTimeEvt_tick_ ( uint_fast8_t const tickRate,
void const *const sender )
staticprivate

Definition at line 287 of file qf_time.c.

◆ QTimeEvt_expire_()

QTimeEvt * QTimeEvt_expire_ ( QTimeEvt *const me,
QTimeEvt *const prev_link,
QActive const *const act,
uint_fast8_t const tickRate )
private

Definition at line 398 of file qf_time.c.

◆ QTimeEvt_tick1_()

void QTimeEvt_tick1_ ( uint_fast8_t const tickRate,
void const *const sender )
staticprivate

◆ QTimeEvt_noActive()

bool QTimeEvt_noActive ( uint_fast8_t const tickRate)
static

Definition at line 377 of file qf_time.c.

Member Data Documentation

◆ super

QEvt super
protected

Definition at line 630 of file qp.h.

◆ next

struct QTimeEvt* volatile next
private

Link to the next time event in the list.

Backward Traceability

Definition at line 632 of file qp.h.

◆ act

void* act
private

Active object that receives the time events.

Definition at line 633 of file qp.h.

◆ ctr

QTimeEvtCtr volatile ctr
private

Down-counter of the time event.

Details

The down-counter is decremented by 1 in every QTimeEvt_tick_() call. The time event fires (gets posted or published) when the down-counter reaches zero.

Backward Traceability

Definition at line 634 of file qp.h.

◆ interval

QTimeEvtCtr interval
private

Interval for periodic time event (zero for one-shot time event)

Details

The value of the interval is re-loaded to the internal down-counter when the time event expires, so that the time event keeps timing out periodically.

Backward Traceability

Definition at line 635 of file qp.h.

◆ tickRate

uint8_t tickRate
private

Definition at line 636 of file qp.h.

◆ flags

uint8_t flags
private

Definition at line 637 of file qp.h.

◆ QTimeEvt_timeEvtHead_

QTimeEvt QTimeEvt_timeEvtHead_[QF_MAX_TICK_RATE]
private

Array of heads of linked lists of time events (one for every clock tick rate)

Backward Traceability

Definition at line 689 of file qp.h.


The documentation for this class was generated from the following files: