dolphin_i.h 820 B

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