BSB Developer Docs
Loading...
Searching...
No Matches
timers.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <stdint.h>
10#include <stdbool.h>
11
12#include <core/common_defines.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
50typedef bool (*TimerConditionCallback)(void* context);
51
64typedef struct {
66 uint32_t data[2];
68
77CoarseTimer FURI_WARN_UNUSED coarse_timer_create(uint32_t timeout_ms);
78
85uint32_t coarse_timer_get_elapsed(const CoarseTimer timer);
86
93bool coarse_timer_is_expired(const CoarseTimer timer);
94
117typedef struct {
119 uint32_t data[2];
121
130PreciseTimer FURI_WARN_UNUSED precise_timer_create(uint32_t timeout_us);
131
138uint32_t precise_timer_get_elapsed(const PreciseTimer timer);
139
146bool precise_timer_is_expired(const PreciseTimer timer);
147
153void precise_timer_wait(const PreciseTimer timer);
154
167 const PreciseTimer timer,
168 TimerConditionCallback condition_cb,
169 void* context);
170
175#ifdef __cplusplus
176}
177#endif
CoarseTimer FURI_WARN_UNUSED coarse_timer_create(uint32_t timeout_ms)
Create a coarse timer with the designated timeout.
Definition timers.c:16
uint32_t coarse_timer_get_elapsed(const CoarseTimer timer)
Get the time elapsed since the timer creation, in milliseconds.
Definition timers.c:24
bool coarse_timer_is_expired(const CoarseTimer timer)
Check whether a coarse timer is past its timeout.
Definition timers.c:28
bool precise_timer_wait_for(const PreciseTimer timer, TimerConditionCallback condition_cb, void *context)
Block the caller until the timer is expired OR a condition is reached.
Definition timers.c:56
uint32_t precise_timer_get_elapsed(const PreciseTimer timer)
Get the time elapsed since the timer creation, in microseconds.
Definition timers.c:41
void precise_timer_wait(const PreciseTimer timer)
Block the current execution context until the timer is expired.
Definition timers.c:50
bool precise_timer_is_expired(const PreciseTimer timer)
Check whether a precise timer is past its timeout.
Definition timers.c:46
PreciseTimer FURI_WARN_UNUSED precise_timer_create(uint32_t timeout_us)
Create a precise timer with the designated timeout.
Definition timers.c:32
bool(* TimerConditionCallback)(void *context)
Condition test function type.
Definition timers.h:50
CoarseTimer structure definition.
Definition timers.h:64
PreciseTimer structure definition.
Definition timers.h:117