DolphinV4 API
1.6.1.0
|
Functions | |
void | time_getTime (uint32 *pu32Time) |
RETURN_TYPE | time_getTimeOut (TIMER_TYPE *pu8timer) |
void | time_setTimerCount (TIMER_TYPE *pu8timer, uint32 u32timeToCount) |
void | time_wait (uint32 u32Delay) |
The TIME module uses a HW system timer that generates a system tick at a fixed rate of one tick per millisecond. Using this system tick a system scheduler is implemented. Each millisecond the execution of the application is interrupted and the schedule takes over the CPU. The schedule executes and one of the SYSTEM-TASKS.
For more information make sure to read scheduler_page
Because most of the radio routines are called from the schedule when linking TIME module the radio module will be also linked to your application.
The TIME module offers the application the possibility to build it's own SW timers with the precission of 1ms. Using the wait function the application can stop it's execution for a certain ammount of time. The system timer is based on 32bit counter.
void time_getTime | ( | uint32 * | pu32Time | ) |
Gets the sytem timer counter.
\param[out] pu32Time System timer, this counter is incremented by interrupt routine every 1ms. /n Pointer needs to point to allocated memory, because in function value changes not address. \return
RETURN_TYPE time_getTimeOut | ( | TIMER_TYPE * | pu8timer | ) |
Indicates if a time-out happened in a SW timer
[out] | *pu8timer | Pointer to the timer structure. |
Example 1:
This piece of code shows the standard way to implement a time-out
Example 2:
This will NOT work
...the overflow flag is only set if the time_getTimeOut is called
and a time-out happens. Since that function is not called, the flag is never set
and the program waits in the loop until WDT reset.
Example 3:
This implementation of the time-out would also work
void time_setTimerCount | ( | TIMER_TYPE * | pu8timer, |
uint32 | u32timeToCount | ||
) |
Initialises a SW timer for a time measurement
[in] | *pu8timer | Pointer to the timer structure. See TIMER_TYPE |
[in] | u32timeToCount | Time to measure in ms. |
void time_wait | ( | uint32 | u32Delay | ) |
Performs a dummy loop for the indicated amount of ms. If the system timer is not running i.e. the isr_timer0Init was not called the delay is realised with standby mode waking up by short term timer.
[in] | u32Delay | Amount of ms to wait. |