Appiko
|
Driver to use micro-second timers using the TIMER peripheral. More...
Macros | |
#define | US_TIMER_USED TIMER_USED_US_TIMER |
#define | US_TIMER_CC_COUNT CONCAT_3(TIMER, US_TIMER_USED, _CC_NUM) |
The number of CC registers in the TIMER peripheral used for us timer. | |
Enumerations | |
enum | us_timer_num { US_TIMER0, US_TIMER1, US_TIMER2, US_TIMER3, US_TIMER_MAX } |
Enumeration used for specifying the timers that can be used with this TIMER peripheral. More... | |
enum | us_timer_mode { US_SINGLE_CALL, US_REPEATED_CALL } |
Enumeration to specify the mode of operation of the timer. More... | |
Functions | |
void | us_timer_init (uint32_t irq_priority) |
Initialize the TIMER peripheral to use as a micro-second timer. More... | |
void | us_timer_start (us_timer_num id, us_timer_mode mode, uint32_t time_us, void(*handler)(void)) |
void | us_timer_stop (us_timer_num id) |
bool | us_timer_get_on_status (us_timer_num id) |
#define US_TIMER_USED TIMER_USED_US_TIMER |
Specify which TIMER peripheral would be used for the us timer module
Definition at line 48 of file us_timer.h.
enum us_timer_mode |
Enumerator | |
---|---|
US_SINGLE_CALL | One shot call of the timer. |
US_REPEATED_CALL | Repeated call of the timer. |
Definition at line 71 of file us_timer.h.
enum us_timer_num |
Enumerator | |
---|---|
US_TIMER0 | Microsecond Timer 0. |
US_TIMER1 | Microsecond Timer 1. |
US_TIMER2 | Microsecond Timer 2. |
US_TIMER3 | Microsecond Timer 3. |
US_TIMER_MAX | Not a timer, just used to find the number of timers. |
Definition at line 56 of file us_timer.h.
bool us_timer_get_on_status | ( | us_timer_num | id | ) |
Returns if a timer is on
id | ID of timer being enquired |
Definition at line 111 of file us_timer.c.
void us_timer_init | ( | uint32_t | irq_priority | ) |
irq_priority | The priority of the interrupt level at which the callback function is called |
Definition at line 56 of file us_timer.c.
References US_SINGLE_CALL, US_TIMER0, and US_TIMER_MAX.
void us_timer_start | ( | us_timer_num | id, |
us_timer_mode | mode, | ||
uint32_t | time_us, | ||
void(*)(void) | handler | ||
) |
Start a micro-second timer
id | ID of the timer to be used from us_timer_num |
mode | Mode of the timer as specified in us_timer_mode |
time_us | The number microseconds after which the timer expires |
handler | Pointer to a function which needs to be called when the timer expires |
Definition at line 74 of file us_timer.c.
References US_SINGLE_CALL.
void us_timer_stop | ( | us_timer_num | id | ) |
Stop a micro-second timer
id | ID of the timer to be stopped |
Definition at line 97 of file us_timer.c.
References US_SINGLE_CALL.