OS  v7.3.3
Documentation
Loading...
Searching...
No Matches
qclock.h
1
8#ifndef QCLOCK_H
9 #define QCLOCK_H
10
11 #include "qtypes.h"
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17
23 #if (Q_SETUP_TIME_CANONICAL == 1)
24 typedef qUINT32_t qTime_t;
25 #define QTIME_NULL ( 0UL )
26 #define qTimeImmediate ( (qTime_t)(0UL) )
27 #define QTUNIT_MINUTE ( 60000UL )
28 #define QTUNIT_HOUR ( 3600000UL )
29 #define QTUNIT_DAY ( 86400000UL )
30 #define QTUNIT_WEEK ( 604800000UL )
31 #else
35 #define QTIME_NULL ( 0.0F )
37 #define qTimeImmediate ( (qTime_t)(0.0F) )
39 #define QTUNIT_MINUTE ( 60.0F )
41 #define QTUNIT_HOUR ( 3600.0F )
43 #define QTUNIT_DAY ( 86400.0F )
45 #define QTUNIT_WEEK ( 604800.0F )
46 #endif
47
55 #define QTUNIT_TOTIME( _xTime_ , _qUnit_ ) \
56 ( (qTime_t)(_xTime_)*(qTime_t)(_qUnit_) ) \
57
58 #if ( Q_SETUP_TICK_IN_HERTZ == 1 )
59 #define qTimingBase_t qClock_t
60 #else
62 #define qTimingBase_t qTime_t
63 #endif
64
67
81 typedef qClock_t (*qGetTickFcn_t)(void);
82
89
96
103
110
121 void qClock_SysTick( void );
122
127 extern qGetTickFcn_t qClock_GetTick; // skipcq: CXX-W2009
128
139 const qClock_t td );
140
143 #ifdef __cplusplus
144 }
145 #endif
146
147#endif
148
qUINT32_t qClock_t
A 32-bit unsigned integer to hold ticks count. Epochs counter.
Definition qclock.h:66
qBool_t qClock_SetTimeBase(const qTimingBase_t tb)
Set the system time-base for time conversions.
Definition qclock.c:18
qClock_t qClock_Convert2Clock(const qTime_t t)
Convert the specified input time(seconds) to time(epochs)
Definition qclock.c:73
qGetTickFcn_t qClock_GetTick
Return the current tick used by the OS.
Definition qclock.c:99
qBool_t qClock_SetTickProvider(const qGetTickFcn_t provider)
Set the clock-tick provider function.
Definition qclock.c:38
qClock_t(* qGetTickFcn_t)(void)
Pointer to Function type qGetTickFcn_t : A function to get the hardware tick value.
Definition qclock.h:81
qBool_t qClock_TimeDeadlineCheck(const qClock_t ti, const qClock_t td)
Perform a timestamp check. This function computes the amount of time elapsed between the current inst...
Definition qclock.c:101
qFloat32_t qTime_t
The typedef that specified an time quantity, usually expressed in seconds.
Definition qclock.h:33
void qClock_SysTick(void)
Feed the system tick.
Definition qclock.c:94
#define qTimingBase_t
A macro to specify a qTime_t type for time-base APIs.
Definition qclock.h:62
qTime_t qClock_Convert2Time(const qClock_t t)
Convert the specified input time(epochs) to time(seconds)
Definition qclock.c:56
qUINT8_t qBool_t
A type to instantiate an OS boolean variable.
Definition qtypes.h:139
uint32_t qUINT32_t
Unsigned integer type with width of exactly 32 bits respectively.
Definition qtypes.h:48
float qFloat32_t
A type to instantiate a single-precision variable of 32-bits IEEE 754.
Definition qtypes.h:111