Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Do not call this function from an ISR.
  2. The timer is not started when it is created. To start the timer, simply call OSTmrStart().
  3. Do not make blocking calls within callback functions.
  4. Keep callback functions as short as possible.

Example Usage

Code Block
titleOSTmrCreate() example usage
          OS_TMR  CloseDoorTmr;
           
           
          void Task (void *p_arg)
          {
              OS_ERR   err;
           
           
              (void)&p_arg;
              while (DEF_ON) {
                  OSTmrCreate(&CloseDoorTmr,         /* p_tmr          */
                             "Door close",           /* p_name         */
                              10,                    /* dly            */
                              100,                   /* period         */
                              OS_OPT_TMR_PERIODIC,   /* opt            */
                              DoorCloseFnct,         /* p_callback     */
                              0,                     /* p_callback_arg */
                             &err);                  /* p_err          */
                  /* Check "err" */
                  :
                  :
              }
          }
           
           
          void  DoorCloseFnct (OS_TMR  *p_tmr,
                               void    *p_arg)
          {
              /* Close the door! */
          }

...