How to Implement the HW Timer
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
The attached sample app implements the HW timer. Run traces on the app to see the HW timer callback fire once every 100ms--10 times for every SW timeout loop.
The necessary components to get the HW timer working are (see attached .c file for full implementation):
-Disable sleep:
1. #include "devicelpm.h"
2. devlpm_registerForLowPowerQueries(hello_hw_timer_device_lpm_queriable, 0);
3. UINT32 hello_hw_timer_device_lpm_queriable(LowPowerModePollType type, UINT32 context) { return 0; }
-Import patch and declaration:
1. #include "hw_timer.h"
2. In your make target add:
APP_PATCHES_AND_LIBS += hw_timer.a
3. declare in your .c :
extern void hw_timer_int_handler(void);
-Define callback (must call stop, only call start is you want a loop):
void hw_timer_int_handler(void)
{
hw_timer_stop();
//do something
hw_timer_start(10000);
}
-Initialize:
1. hw_timer_register_timer_expired_callback(hw_timer_int_handler);
2. hw_timer_start(100000);
See Sleep Deep_Sleep Explanation and Techniques for alternate methods of disabling sleep.
Jacob
- Subscribe to RSS Feed
- Mark Article as New
- Mark Article as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
This iKBA is valid for CYW2073x devices