A widget that invokes a callback after a given length of time
PtWidget → PtTimer
For more information, see the diagram of the widget hierarchy.
<photon/PtTimer.h>
A PtTimer widget invokes a callback after an initial and repeated time period, given in milliseconds. This widget is intended to provide a non-accurate, resourceless time base for your application. To disable the timer, set Pt_ARG_TIMER_INITIAL to 0 or unrealize the widget.
When you create a PtTimer widget in PhAB, it appears as a black box. The box doesn't appear when you run the application; it's just a placeholder.
PtTimer is easy to use, but doesn't give accurate timer events. In particular, it doesn't guarantee a constant repeat rate; since the repetition is handled by rearming the timer for each event, any delays in handling the events accumulate. Kernel timers guarantee an accurate repeat rate even if your application can't keep up with them. For more information, see “Timers” in the Working with Code chapter of the Photon Programmer's Guide. |
Resource | C type | Pt type | Default |
---|---|---|---|
Pt_ARG_TIMER_INITIAL | unsigned long | Scalar | 0 |
Pt_ARG_TIMER_REPEAT | unsigned long | Scalar | 0 |
Pt_CB_TIMER_ACTIVATE | PtCallback_t * | Link | NULL |
C type | Pt type | Default |
---|---|---|
unsigned long | Scalar | 0 |
The time, in milliseconds, before the first timer callback is activated.
C type | Pt type | Default |
---|---|---|
unsigned long | Scalar | 0 |
The time, in milliseconds, for the repeat rate of the timer once the initial time period has expired.
C type | Pt type | Default |
---|---|---|
PtCallback_t * | Link | NULL |
A list of PtCallback_t structures that define the callbacks that the widget invokes when the timer has expired.
Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:
These callbacks should return Pt_CONTINUE.
If the widget modifies an inherited resource, the “Default override” column indicates the new value. This modification affects any subclasses of the widget.