mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-28 05:33:08 +00:00
3217f286f0
Co-authored-by: hedger <hedger@users.noreply.github.com>
44 lines
953 B
C
44 lines
953 B
C
#pragma once
|
|
|
|
#include <core/pubsub.h>
|
|
#include <furi.h>
|
|
#include <furi_hal.h>
|
|
|
|
#include "dolphin.h"
|
|
#include "helpers/dolphin_state.h"
|
|
|
|
typedef enum {
|
|
DolphinEventTypeDeed,
|
|
DolphinEventTypeStats,
|
|
DolphinEventTypeFlush,
|
|
DolphinEventTypeIncreaseButthurt,
|
|
DolphinEventTypeClearLimits,
|
|
} DolphinEventType;
|
|
|
|
typedef struct {
|
|
DolphinEventType type;
|
|
FuriEventFlag* flag;
|
|
union {
|
|
DolphinDeed deed;
|
|
DolphinStats* stats;
|
|
};
|
|
} DolphinEvent;
|
|
|
|
struct Dolphin {
|
|
// State
|
|
DolphinState* state;
|
|
// Queue
|
|
FuriMessageQueue* event_queue;
|
|
FuriPubSub* pubsub;
|
|
TimerHandle_t butthurt_timer;
|
|
TimerHandle_t flush_timer;
|
|
TimerHandle_t clear_limits_timer;
|
|
};
|
|
|
|
Dolphin* dolphin_alloc();
|
|
|
|
void dolphin_event_send_async(Dolphin* dolphin, DolphinEvent* event);
|
|
|
|
void dolphin_event_send_wait(Dolphin* dolphin, DolphinEvent* event);
|
|
|
|
void dolphin_event_release(Dolphin* dolphin, DolphinEvent* event);
|