picofuse

timer.h
Go to the documentation of this file.
1 
31 #pragma once
32 #include <stdbool.h>
33 #include <stdint.h>
34 
40 #ifndef SYS_TIMER_CAPACITY
41 #define SYS_TIMER_CAPACITY 8
42 #endif
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
49 // TYPES
50 
56 typedef struct sys_timer_t sys_timer_t;
57 
59 // LIFECYCLE
60 
80 sys_timer_t *sys_timer_init(uint32_t interval_ms,
81  void (*callback)(sys_timer_t *), void *userdata);
82 
93 void sys_timer_deinit(sys_timer_t *timer);
94 
97 // METHODS
99 
110 bool sys_timer_start(sys_timer_t *timer);
111 
118 void *sys_timer_userdata(sys_timer_t *timer);
119 
122 #ifdef __cplusplus
123 }
124 #endif
sys_timer_t * sys_timer_init(uint32_t interval_ms, void(*callback)(sys_timer_t *), void *userdata)
Allocate and configure a timer from the pool.
struct sys_timer_t sys_timer_t
Timer.
Definition: timer.h:56
bool sys_timer_start(sys_timer_t *timer)
Start a timer.
void * sys_timer_userdata(sys_timer_t *timer)
Return user data associated with a timer.
void sys_timer_deinit(sys_timer_t *timer)
Stop and release a timer back to the pool.