Ucosii Software Timers

Source: Internet
Author: User

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 }
}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.