Flipper Zero Firmware
Loading...
Searching...
No Matches
event_loop.h
Go to the documentation of this file.
1
15#pragma once
16
17#include "base.h"
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
101
104
115
120void furi_event_loop_free(FuriEventLoop* instance);
121
128void furi_event_loop_run(FuriEventLoop* instance);
129
134void furi_event_loop_stop(FuriEventLoop* instance);
135
136/*
137 * Tick related API
138 */
139
144typedef void (*FuriEventLoopTickCallback)(void* context);
145
159 FuriEventLoop* instance,
160 uint32_t interval,
162 void* context);
163
164/*
165 * Deferred function call API
166 */
167
174typedef void (*FuriEventLoopPendingCallback)(void* context);
175
186 FuriEventLoop* instance,
188 void* context);
189
190/*
191 * Event subscription/notification APIs
192 */
193
194typedef void FuriEventLoopObject;
195
203typedef bool (*FuriEventLoopEventCallback)(FuriEventLoopObject* object, void* context);
204
207
219 FuriEventLoop* instance,
220 FuriMessageQueue* message_queue,
221 FuriEventLoopEvent event,
223 void* context);
224
227
239 FuriEventLoop* instance,
240 FuriStreamBuffer* stream_buffer,
241 FuriEventLoopEvent event,
243 void* context);
244
247
259 FuriEventLoop* instance,
260 FuriSemaphore* semaphore,
261 FuriEventLoopEvent event,
263 void* context);
264
266typedef struct FuriMutex FuriMutex;
267
279 FuriEventLoop* instance,
280 FuriMutex* mutex,
281 FuriEventLoopEvent event,
283 void* context);
284
290void furi_event_loop_unsubscribe(FuriEventLoop* instance, FuriEventLoopObject* object);
291
292#ifdef __cplusplus
293}
294#endif
void furi_event_loop_subscribe_stream_buffer(FuriEventLoop *instance, FuriStreamBuffer *stream_buffer, FuriEventLoopEvent event, FuriEventLoopEventCallback callback, void *context)
Subscribe to stream buffer events.
Definition event_loop.c:343
void furi_event_loop_subscribe_semaphore(FuriEventLoop *instance, FuriSemaphore *semaphore, FuriEventLoopEvent event, FuriEventLoopEventCallback callback, void *context)
Subscribe to semaphore events.
Definition event_loop.c:355
void furi_event_loop_run(FuriEventLoop *instance)
Continuously poll for events.
Definition event_loop.c:185
void furi_event_loop_pend_callback(FuriEventLoop *instance, FuriEventLoopPendingCallback callback, void *context)
Call a function when all preceding timer commands are processed.
Definition event_loop.c:256
void furi_event_loop_unsubscribe(FuriEventLoop *instance, FuriEventLoopObject *object)
Unsubscribe from events (common)
Definition event_loop.c:383
void furi_event_loop_free(FuriEventLoop *instance)
Free Event Loop instance.
Definition event_loop.c:81
void furi_event_loop_stop(FuriEventLoop *instance)
Stop Event Loop instance.
Definition event_loop.c:242
FuriEventLoop * furi_event_loop_alloc(void)
Allocate Event Loop instance.
Definition event_loop.c:62
void furi_event_loop_subscribe_mutex(FuriEventLoop *instance, FuriMutex *mutex, FuriEventLoopEvent event, FuriEventLoopEventCallback callback, void *context)
Subscribe to mutex events.
Definition event_loop.c:367
void furi_event_loop_subscribe_message_queue(FuriEventLoop *instance, FuriMessageQueue *message_queue, FuriEventLoopEvent event, FuriEventLoopEventCallback callback, void *context)
Subscribe to message queue events.
Definition event_loop.c:331
void(* FuriEventLoopPendingCallback)(void *context)
Timer callback type for functions to be called in a deferred manner.
Definition event_loop.h:174
FuriEventLoopEvent
Enumeration of event types, flags and masks.
Definition event_loop.h:32
@ FuriEventLoopEventFlagEdge
Use edge triggered events.
Definition event_loop.h:83
@ FuriEventLoopEventIn
Subscribe to In events.
Definition event_loop.h:42
@ FuriEventLoopEventFlagMask
Special value containing the event flag bits, used internally.
Definition event_loop.h:95
@ FuriEventLoopEventOut
Subscribe to Out events.
Definition event_loop.h:52
@ FuriEventLoopEventFlagOnce
Automatically unsubscribe from events after one time.
Definition event_loop.h:91
@ FuriEventLoopEventMask
Special value containing the event direction bits, used internally.
Definition event_loop.h:56
@ FuriEventLoopEventReserved
Special value to force the enum to 32-bit values.
Definition event_loop.h:99
bool(* FuriEventLoopEventCallback)(FuriEventLoopObject *object, void *context)
Callback type for event loop events.
Definition event_loop.h:203
void(* FuriEventLoopTickCallback)(void *context)
Tick callback type.
Definition event_loop.h:144
void furi_event_loop_tick_set(FuriEventLoop *instance, uint32_t interval, FuriEventLoopTickCallback callback, void *context)
Set Event Loop tick callback.
Definition event_loop_tick.c:56
Definition event_loop_i.h:79
Definition message_queue.c:16
Definition mutex.c:13
Definition semaphore.c:15
Definition stream_buffer.c:14