dolphin_i.h 946 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. DolphinEventTypeAnimationStartNewIdle,
  12. DolphinEventTypeAnimationCheckBlocking,
  13. DolphinEventTypeAnimationInteract,
  14. } DolphinEventType;
  15. typedef struct {
  16. DolphinEventType type;
  17. osEventFlagsId_t flag;
  18. union {
  19. DolphinDeed deed;
  20. DolphinStats* stats;
  21. };
  22. } DolphinEvent;
  23. struct Dolphin {
  24. // State
  25. DolphinState* state;
  26. // Queue
  27. osMessageQueueId_t event_queue;
  28. FuriPubSub* pubsub;
  29. };
  30. Dolphin* dolphin_alloc();
  31. void dolphin_free(Dolphin* dolphin);
  32. void dolphin_event_send_async(Dolphin* dolphin, DolphinEvent* event);
  33. void dolphin_event_send_wait(Dolphin* dolphin, DolphinEvent* event);
  34. void dolphin_event_release(Dolphin* dolphin, DolphinEvent* event);