orcus
|
Timer. More...
#include <stdint.h>
Macros | |
#define | TIMER_NS_PER_TICK 135 |
Nanoseconds per timer tick. More... | |
Functions | |
uint32_t | timerGet () |
Get current timer tick. More... | |
unsigned long | timerNsSince (uint32_t lastTick, uint32_t *storeCurrent) |
Calculate nanoseconds elapsed since a given tick. More... | |
uint32_t | timerSet (uint32_t count) |
Reset timer to count from specific tick. More... | |
void | timerSleepNs (unsigned long ns) |
Wait for a given number of nanoseconds. More... | |
#define TIMER_NS_PER_TICK 135 |
Nanoseconds per timer tick. Timer ticks once every 0.135uS.
uint32_t timerGet | ( | ) |
Get current timer tick.
Timer ticks every 0.135uS and overflows at 0xFFFFFFFF then carries on counting.
unsigned long timerNsSince | ( | uint32_t | lastTick, |
uint32_t * | storeCurrent | ||
) |
Calculate nanoseconds elapsed since a given tick. Optionally store the current tick.
Useful for timeouts, or calculating time between frames.
uint32_t timerSet | ( | uint32_t | count | ) |
Reset timer to count from specific tick.
count | Tick to start counting from |
void timerSleepNs | ( | unsigned long | ns | ) |
Wait for a given number of nanoseconds.
ns | Nanoseconds to wait |