0
mirror of https://github.com/gusmanb/logicanalyzer.git synced 2025-03-12 16:34:33 +00:00
gusmanb-logicanalyzer/Firmware/LogicAnalyzer_V2/Event_Machine.h
Agustín Gimenez 34793d9a3c Added new interface functionalities
Added first version of firmware for the Pico 2
2024-08-27 12:45:24 +02:00

27 lines
861 B
C

#ifndef __EVENTMACHINE__
#define __EVENTMACHINE__
#include "pico/stdlib.h"
#include "pico/util/queue.h"
//Event handler function declaration
typedef void(*EVENT_HANDLER)(void*);
//Event machine struct
typedef struct _EVENT_MACHINE
{
//Queue to store events
queue_t queue;
//Function to process the events
EVENT_HANDLER handler;
} EVENT_MACHINE;
void event_machine_init(EVENT_MACHINE* machine, EVENT_HANDLER handler, uint8_t args_size, uint8_t queue_depth);
bool event_has_events(EVENT_MACHINE* machine);
void event_push(EVENT_MACHINE* machine, void* event);
void event_process_queue(EVENT_MACHINE* machine, void* event_buffer, uint8_t max_events);
void event_clear(EVENT_MACHINE* machine);
void event_free(EVENT_MACHINE* machine);
#endif