PebbleOS
Loading...
Searching...
No Matches
Macros | Typedefs | Functions
new_timer.h File Reference
#include <stdbool.h>
#include <stdint.h>

Macros

#define TIMER_INVALID_ID   0
 Invalid timer id, never returned by new_timer_create().
 
#define TIMER_START_FLAG_REPEATING   0x01
 Re-arm the timer with the same timeout after each expiry.
 
#define TIMER_START_FLAG_FAIL_IF_EXECUTING   0x02
 Fail if the callback is executing.
 
#define TIMER_START_FLAG_FAIL_IF_SCHEDULED   0x04
 Fail if the timer is already scheduled, instead of rescheduling it.
 

Typedefs

typedef void(* NewTimerCallback) (void *data)
 Timer callback, run on the NewTimer task.
 
typedef uint32_t TimerID
 Timer handle; ids are used instead of pointers to avoid use-after-free.
 
typedef void(* NewTimerWorkCallback) (void *data)
 Work callback, run on the NewTimer task.
 

Functions

TimerID new_timer_create (void)
 Create a timer, initially stopped.
 
bool new_timer_start (TimerID timer, uint32_t timeout_ms, NewTimerCallback cb, void *cb_data, uint32_t flags)
 Schedule a timer.
 
bool new_timer_stop (TimerID timer)
 Stop a timer.
 
bool new_timer_scheduled (TimerID timer, uint32_t *expire_ms_p)
 Check whether a timer is scheduled.
 
void new_timer_delete (TimerID timer)
 Delete a timer, stopping it first.
 
void * new_timer_debug_get_current_callback (void)
 Get the callback being executed, for the watchdog.
 
void new_timer_add_work_callback_from_isr (NewTimerWorkCallback cb, void *data)
 Queue work on the NewTimer task from an ISR.
 
bool new_timer_add_work_callback (NewTimerWorkCallback cb, void *data)
 Queue work on the NewTimer task.