ContentsIndex
PreviousUpNext
Timer
Topics | Functions | Structs, Records, Enums | Types
Description

Provides applications with three types of timer: precise timer, non-precise timer and HISR timer.

Introduction

There are three types of timers provided through this module. They are the precise timer, non-precise timer and HISR timer (Hardware Interrupt Service Routine timer). 

The precise timer provides higher precision than non-precise timers. But the precise timer stops when the system enters the power saving mode. The function vm_timer_create_non_precise() is used to create non-precise timer. Please note that the firmware of LinkIt ONE is configured to never entering into power saving mode. Therefore the developers do not have to keep the system from entering into the power saving mode for precise timers to work. 

The non-precise timers does not stop when the system enters the power saving mode. Therefore, it can be used to wake the system up from power saving mode. The non-precise timer, however, may have some variance to the timer callback interval. The maximum possible variance is 254 system ticks, where 1 tick equals 4.615 ms. The function vm_timer_create_precise() is used to create precise timer. 

The minimum precision of the timer is 10ms. When a timer is created, the system will invoke the timer callback function repetitively at the specified interval until the timer is deleted by the application. 

A timer will not commence ticking before its current timer callback has completed execution, and a timer callback will not start execution before the current timer callback completes. Therefore, there are some delays of invoking a timer callback. 

The more timers, the more complicated the timer callback functions, and the longer the accumulated time delay. Also note that when the program exits, the application must delete all timers. Again, if you need your application to continue running when the system enters power saving mode, create timers with vm_timer_create_nonç«…_precise instead. 

The HISR timer is invoked is both very precise and is not affected by the power saving mode. However, Due to the nature of its execution context, the callback function of HISR timers should not invoke any other LinkIt API and should only be used to perform certain fast value updates. Failing to do so may result in system failure, since other critical drivers, which require real-time update, e.g. GSM modem, will fail. 

The Timers can be deleted. However, each type of timers can only be deleted by the corresponding delete function. For example, the vm_timer_delete_non_precise() should be used to delete the timers that is created by vm_timer_create_non_precise() function.

Limitation

The maximum number of precise timers allowed by the system is 10. The maximum number of non-precise timer allowed is 10. Applications should not create the timers that exceeds these limitation.

Group
Functions
Function 
Description 
Creates a HISR timer. Once the timer is created, it will fire repeatedly at the interval until the timer is deleted. The thread priority of a HISR timer is higher than the main thread. The callback of a HISR timer is invoked in the interrupt context. Therefore, the callback of a HISR timer should not be used to access any LinkIt SDK APIs. The callback should not use signal, mutex or thread API. But it can call the DCL API. It should only be used to perform fast operations, such as value updates. 
Creates a non-precise timer. Once the timer is created, it will fire repeatedly at the interval until the timer is deleted. A non-precise timer will not stop when the system gets into the power saving mode. The non-precise timer can be used to wake the system up. An application is allowed to have up to 10 non-precise timers.
The callback functions of both precise and non-precise timers are executed by the same thread. A callback will not be executed until the execution of the previous callback completes. 
Creates a precise timer. Once the timer is created, it will fire repeatedly at the interval until the timer is deleted. A precise timer will be stopped when the system gets into the power saving mode. An application is allowed to have up to 10 precise timers.
The callback functions of both precise and non-precise timers are executed by the same thread. A callback will not be executed until the execution of the previous callback completes. 
Delete a HISR timer. Deleting a HISR timer inside the HISR callback execution may cancel a timer that is in expired state but the callback function has not yet been serviced. It cannot be used to delete other types of timers. 
Deletes a non-precise timer that is created by vm_timer_create_non_precise(). It cannot be used to delete other types of timers. 
Deletes a precise timer that is created by vm_timer_create_precise(). It cannot be used to delete other types of timers. 
Starts a HISR timer. Calling this function will cancel the timer event set previously, and start a new HISR timer event. 
Structs, Records, Enums
Struct, Record, Enum 
Description 
timer error code type 
Types
Type 
Description 
HISR timer callback function. 
HISR (High-level Interrupt Service Routine) timer id. 
Non-precise timer id. 
Precise timer id. 
Non-precise timer callback function. 
Precise timer callback function. 
Links
Created with a commercial version of Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at support@toolsfactory.com.