This commit is contained in:
RogueMaster
2022-11-17 23:48:40 -05:00
parent d686d7f650
commit 567f9f4585
39 changed files with 2007 additions and 1630 deletions
+21 -15
View File
@@ -4,17 +4,19 @@
#include <furi.h>
typedef struct {
void (*callback)(void *state); //Callback for when the item is dequeued
void (*render)(const void *state, Canvas *const canvas); //Callback for the rendering loop while this item is running
void (*start)(void *state); //Callback when this item is started running
void *next; //Pointer to the next item
uint32_t duration; //duration of the item
void (*callback)(void* state); //Callback for when the item is dequeued
void (*render)(
const void* state,
Canvas* const canvas); //Callback for the rendering loop while this item is running
void (*start)(void* state); //Callback when this item is started running
void* next; //Pointer to the next item
uint32_t duration; //duration of the item
} QueueItem;
typedef struct {
unsigned int start; //current queue item start time
QueueItem *current; //current queue item
bool running; //is the queue running
unsigned int start; //current queue item start time
QueueItem* current; //current queue item
bool running; //is the queue running
} QueueState;
/**
@@ -27,15 +29,19 @@ typedef struct {
* @param render Callback to render loop if needed
* @param duration Length of the item
*/
void enqueue(QueueState *queue_state, void *app_state,
void(*done)(void *state), void(*start)(void *state),
void (*render)(const void *state, Canvas *const canvas), uint32_t duration);
void enqueue(
QueueState* queue_state,
void* app_state,
void (*done)(void* state),
void (*start)(void* state),
void (*render)(const void* state, Canvas* const canvas),
uint32_t duration);
/**
* Clears all queue items
*
* @param queue_state The queue state pointer
*/
void queue_clear(QueueState *queue_state);
void queue_clear(QueueState* queue_state);
/**
* Dequeues the active queue item. Usually you don't need to call it directly.
@@ -43,7 +49,7 @@ void queue_clear(QueueState *queue_state);
* @param queue_state The queue state pointer
* @param app_state Your application state
*/
void dequeue(QueueState *queue_state, void *app_state);
void dequeue(QueueState* queue_state, void* app_state);
/**
* Runs the queue logic (place it in your tick function)
@@ -52,7 +58,7 @@ void dequeue(QueueState *queue_state, void *app_state);
* @param app_state Your application state
* @return FALSE when there is nothing to run, TRUE otherwise
*/
bool run_queue(QueueState *queue_state, void *app_state);
bool run_queue(QueueState* queue_state, void* app_state);
/**
* Calls the currently active queue items render callback (if there is any)
@@ -61,4 +67,4 @@ bool run_queue(QueueState *queue_state, void *app_state);
* @param app_state Your application state
* @param canvas Pointer to Flipper's canvas object
*/
void render_queue(const QueueState *queue_state, const void *app_state, Canvas *const canvas);
void render_queue(const QueueState* queue_state, const void* app_state, Canvas* const canvas);