dolphin_i.h 771 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include <furi.h>
  3. #include <furi-hal.h>
  4. #include "dolphin.h"
  5. #include "helpers/dolphin_state.h"
  6. typedef enum {
  7. DolphinEventTypeDeed,
  8. DolphinEventTypeStats,
  9. DolphinEventTypeFlush,
  10. } DolphinEventType;
  11. typedef struct {
  12. DolphinEventType type;
  13. osEventFlagsId_t flag;
  14. union {
  15. DolphinDeed deed;
  16. DolphinStats* stats;
  17. };
  18. } DolphinEvent;
  19. struct Dolphin {
  20. // State
  21. DolphinState* state;
  22. // Queue
  23. osMessageQueueId_t event_queue;
  24. };
  25. Dolphin* dolphin_alloc();
  26. void dolphin_free(Dolphin* dolphin);
  27. void dolphin_event_send_async(Dolphin* dolphin, DolphinEvent* event);
  28. void dolphin_event_send_wait(Dolphin* dolphin, DolphinEvent* event);
  29. void dolphin_event_release(Dolphin* dolphin, DolphinEvent* event);