pico]OS  1.0.4
Typedefs | Functions
Timer Functions
Abstracted Functions

Typedefs

typedef POSTIMER_t NOSTIMER_t

Functions

NANOEXT NOSTIMER_t POSCALL nosTimerCreate (const char *name)
NANOEXT VAR_t POSCALL nosTimerSet (NOSTIMER_t tmr, NOSSEMA_t sema, UINT_t waitticks, UINT_t periodticks)
NANOEXT VAR_t POSCALL nosTimerStart (NOSTIMER_t tmr)
NANOEXT VAR_t POSCALL nosTimerStop (NOSTIMER_t tmr)
NANOEXT void POSCALL nosTimerDestroy (NOSTIMER_t tmr)
NANOEXT VAR_t POSCALL nosTimerFired (NOSTIMER_t tmr)

Detailed Description

A timer object is a counting variable that is counted down by the system timer interrupt tick rate. If the variable reaches zero, a semaphore, that is bound to the timer, will be signaled. If the timer is in auto reload mode, the timer is restarted and will signal the semaphore again and again, depending on the period rate the timer is set to.


Typedef Documentation

Handle to a nano layer timer object.


Function Documentation

NANOEXT NOSTIMER_t POSCALL nosTimerCreate ( const char *  name)

Timer function. Allocates a timer object. After a timer is allocated with this function, it must be set up with nosTimerSet and than started with nosTimerStart.

Returns:
handle to the new timer object. NULL is returned on error.
Parameters:
nameName of the new timer object to create. If the last character in the name is an asteriks (*), the operating system automatically assigns the timer an unique name (the registry feature must be enabled for this automatism). This parameter can be NULL if the nano layer registry feature is not used and will not be used in future.
Note:
NOSCFG_FEATURE_TIMER must be defined to 1 to have timer support compiled in.
You must use nosTimerDestroy to destroy the flag object again.
Even if the function posTimerDestroy would work also, it is required to call nosTimerDestroy. Only this function removes the flag object from the registry.
Dependent of your configuration, this function can be defined as macro to decrease code size.
See also:
nosTimerSet, nosTimerStart, nosTimerDestroy
NANOEXT void POSCALL nosTimerDestroy ( NOSTIMER_t  tmr)

Timer function. Deletes a timer object and free its resources.

Parameters:
tmrhandle to the timer object.
Note:
NOSCFG_FEATURE_TIMER must be defined to 1 to have timer support compiled in.
POSCFG_FEATURE_TIMERDESTROY must be defined to 1 to have this function compiled in.
Dependent of your configuration, this function can be defined as macro to decrease code size.
See also:
nosTimerCreate
NANOEXT VAR_t POSCALL nosTimerFired ( NOSTIMER_t  tmr)

Timer function. The function is used to test if a timer has fired.

Parameters:
tmrhandle to the timer object.
Returns:
1 when the timer has fired, otherwise 0. A negative value is returned on error.
Note:
NOSCFG_FEATURE_TIMER must be defined to 1 to have timer support compiled in.
POSCFG_FEATURE_TIMERFIRED must be defined to 1 to have this function compiled in.
Dependent of your configuration, this function can be defined as macro to decrease code size.
See also:
nosTimerCreate, nosTimerSet, nosTimerStart
NANOEXT VAR_t POSCALL nosTimerSet ( NOSTIMER_t  tmr,
NOSSEMA_t  sema,
UINT_t  waitticks,
UINT_t  periodticks 
)

Timer function. Sets up a timer object.

Parameters:
tmrhandle to the timer object.
semaseaphore object that shall be signaled when timer fires.
waitticksnumber of initial wait ticks. The timer fires the first time when this ticks has been expired.
periodticksAfter the timer has fired, it is reloaded with this value, and will fire again when this count of ticks has been expired (auto reload mode). If this value is set to zero, the timer won't be restarted (= one shot mode).
Returns:
zero on success.
Note:
NOSCFG_FEATURE_TIMER must be defined to 1 to have timer support compiled in.
Dependent of your configuration, this function can be defined as macro to decrease code size.
See also:
nosTimerCreate, nosTimerStart
NANOEXT VAR_t POSCALL nosTimerStart ( NOSTIMER_t  tmr)

Timer function. Starts a timer. The timer will fire first time when the waitticks counter has been reached zero. If the periodticks were set, the timer will be reloaded with this value.

Parameters:
tmrhandle to the timer object.
Returns:
zero on success.
Note:
NOSCFG_FEATURE_TIMER must be defined to 1 to have timer support compiled in.
Dependent of your configuration, this function can be defined as macro to decrease code size.
See also:
nosTimerStop, nosTimerFired
NANOEXT VAR_t POSCALL nosTimerStop ( NOSTIMER_t  tmr)

Timer function. Stops a timer. The timer will no more fire. The timer can be reenabled with nosTimerStart.

Parameters:
tmrhandle to the timer object.
Returns:
zero on success.
Note:
NOSCFG_FEATURE_TIMER must be defined to 1 to have timer support compiled in.
Dependent of your configuration, this function can be defined as macro to decrease code size.
See also:
nosTimerStart, nosTimerDestroy