Appiko
us_timer.h
1 
30 #ifndef CODEBASE_PERIPHERAL_MODULES_US_TIMER_H_
31 #define CODEBASE_PERIPHERAL_MODULES_US_TIMER_H_
32 
33 #include <stdint.h>
34 #include <stdbool.h>
35 #include "nrf.h"
36 #include "nrf_peripherals.h"
37 #include "common_util.h"
38 
39 #if SYS_CFG_PRESENT == 1
40 #include "sys_config.h"
41 #endif
42 #ifndef TIMER_USED_US_TIMER
43 #define TIMER_USED_US_TIMER 3
44 #endif
45 
46 
48 #define US_TIMER_USED TIMER_USED_US_TIMER
49 
51 #define US_TIMER_CC_COUNT CONCAT_3(TIMER, US_TIMER_USED, _CC_NUM)
52 
56 typedef enum {
61 #if (US_TIMER_CC_COUNT == 6)
62  US_TIMER4,
63  US_TIMER5,
64 #endif
67 
71 typedef enum {
75 
81 void us_timer_init(uint32_t irq_priority);
82 
93 void us_timer_start(us_timer_num id, us_timer_mode mode, uint32_t time_us, void (*handler)(void));
94 
101 void us_timer_stop(us_timer_num id);
102 
109 
110 #endif /* CODEBASE_PERIPHERAL_MODULES_US_TIMER_H_ */
111 
us_timer_num
Enumeration used for specifying the timers that can be used with this TIMER peripheral.
Definition: us_timer.h:56
void us_timer_start(us_timer_num id, us_timer_mode mode, uint32_t time_us, void(*handler)(void))
Definition: us_timer.c:74
Microsecond Timer 3.
Definition: us_timer.h:60
void us_timer_init(uint32_t irq_priority)
Initialize the TIMER peripheral to use as a micro-second timer.
Definition: us_timer.c:56
Microsecond Timer 1.
Definition: us_timer.h:58
One shot call of the timer.
Definition: us_timer.h:72
bool us_timer_get_on_status(us_timer_num id)
Definition: us_timer.c:111
Not a timer, just used to find the number of timers.
Definition: us_timer.h:65
void us_timer_stop(us_timer_num id)
Definition: us_timer.c:97
Repeated call of the timer.
Definition: us_timer.h:73
Microsecond Timer 0.
Definition: us_timer.h:57
us_timer_mode
Enumeration to specify the mode of operation of the timer.
Definition: us_timer.h:71
Microsecond Timer 2.
Definition: us_timer.h:59