![]() |
µGFX
2.9
version 2.9
|
Module which provides software based timers for user-space applications.
The reason why uGFX has it's own timer abstraction is because virtual timers provided by ChibiOS/RT are interrupt context only. While great for what they are designed for, they make coding of the input drivers much more complex. For non-performance critical drivers like these input drivers, it would also hog an in-ordinate amount of critical (interrupt locked) system time. This contrary to the goals of a real-time operating system. So a user-land (thread based) timer mechanism is also required.
Data Structures | |
struct | GTimer_t |
A GTimer structure. More... | |
Functions | |
void | gtimerInit (GTimer *pt) |
Initialise a timer. More... | |
void | gtimerDeinit (GTimer *pt) |
Deinitialise a timer. More... | |
void | gtimerStart (GTimer *pt, GTimerFunction fn, void *param, gBool periodic, gDelay millisec) |
Set a timer going or alter its properties if it is already going. More... | |
void | gtimerStop (GTimer *pt) |
Stop a timer (periodic or otherwise) More... | |
gBool | gtimerIsActive (GTimer *pt) |
Test if a timer is currently active. More... | |
void | gtimerJab (GTimer *pt) |
Jab a timer causing the current period to immediate expire. More... | |
void | gtimerJabI (GTimer *pt) |
Jab a timer causing the current period to immediate expire. More... | |
GTIMER Optional Sizing Parameters | |
#define | GTIMER_THREAD_PRIORITY gThreadpriorityHigh |
Defines the GTIMER thread priority. More... | |
#define | GTIMER_THREAD_WORKAREA_SIZE 2048 |
Defines the size of the timer threads work area (stack+structures). More... | |
Typedefs | |
typedef struct GTimer_t | GTimer |
A GTimer structure. More... | |
void gtimerDeinit | ( | GTimer * | pt | ) |
Deinitialise a timer.
[in] | pt | Pointer to a GTimer structure |
Definition at line 134 of file gtimer.c.
References gtimerStop().
void gtimerInit | ( | GTimer * | pt | ) |
gBool gtimerIsActive | ( | GTimer * | pt | ) |
Test if a timer is currently active.
[in] | pt | Pointer to a GTimer structure |
Definition at line 208 of file gtimer.c.
Referenced by ginputGetToggle().
void gtimerJab | ( | GTimer * | pt | ) |
Jab a timer causing the current period to immediate expire.
The callback function will be called as soon as possible.
[in] | pt | Pointer to a GTimer structure |
Definition at line 212 of file gtimer.c.
References gfxMutexEnter(), gfxMutexExit(), and gfxSemSignal().
void gtimerJabI | ( | GTimer * | pt | ) |
Jab a timer causing the current period to immediate expire.
The callback function will be called as soon as possible.
[in] | pt | Pointer to a GTimer structure |
Definition at line 223 of file gtimer.c.
References gfxSemSignalI().
void gtimerStart | ( | GTimer * | pt, |
GTimerFunction | fn, | ||
void * | param, | ||
gBool | periodic, | ||
gDelay | millisec | ||
) |
Set a timer going or alter its properties if it is already going.
[in] | pt | Pointer to a GTimer structure |
[in] | fn | The callback function |
[in] | param | The parameter to pass to the callback function |
[in] | periodic | Is the timer a periodic timer? gFalse is a once-only timer. |
[in] | millisec | The timer period. The following special values are allowed: gDelayNone causes the callback function to be called asap. A periodic timer with this value will fire once only. gDelayForever never timeout (unless triggered by gtimerJab or gtimerJabI) |
void gtimerStop | ( | GTimer * | pt | ) |
Stop a timer (periodic or otherwise)
[in] | pt | Pointer to a GTimer structure |
Definition at line 190 of file gtimer.c.
References gfxMutexEnter(), and gfxMutexExit().
Referenced by gtimerDeinit().
#define GTIMER_THREAD_PRIORITY gThreadpriorityHigh |
Defines the GTIMER thread priority.
Defaults to gThreadpriorityHigh
Definition at line 34 of file gtimer_options.h.
#define GTIMER_THREAD_WORKAREA_SIZE 2048 |
Defines the size of the timer threads work area (stack+structures).
Defaults to 2048 bytes
Definition at line 41 of file gtimer_options.h.