API Functions
Create
os_tmr *ostmrcreate (int32u dly,
int32u period,
int8u opt,
os_tmr_callback CALLBACK,
void * Callback_arg,
int8u *pname,
int8u *perr);
Delete
the BOOLEAN ostmrdel (os_tmr *ptmr,
int8u *perr);
Timer name
int8u ostmrnameget (os_tmr *ptmr,
int8u **pdest,
int8u *perr);
Overflow time
int32u ostmrremainget (os_tmr *ptmr,
int8u *perr);
Timer status
int8u ostmrstateget (os_tmr *ptmr,
int8u *perr);
Start
BOOLEAN ostmrstart (os_tmr *ptmr,
int8u *perr);
Turn off
BOOLEAN ostmrstop (os_tmr *ptmr,
int8u opt,
void *callback_arg,
int8u *perr);
Send Signal
int8u ostmrsignal (void);
Application Examples
OS_TMR *tmr;
void Start_task (void *pdata) {os_enter_critical (); TMR = Ostmrcreate ((int32u) 0, (int32u),//50*100ms (int8u) os_tmr_o
Pt_periodic, (Os_tmr_callback) Tmr_callback, (void *) 0,
(int8u *) "TMR", (int8u *) &err);
Os_exit_critical ();
Ostmrstart (MSG->TMR, &err);
} void Tmr_callback (void *ptmr, void *parg) {int32u remain;
remain = Ostmrremainget (PTMR, &err);
if (remain <= 5) {printf ("Tmr_callback ostmrremainget remain err:%d\r\n", remain);
Return }
}