dolphin_i.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #pragma once
  2. #include "dolphin.h"
  3. #include "dolphin_state.h"
  4. #include "dolphin_views.h"
  5. #include <furi.h>
  6. #include <api-hal.h>
  7. #include <gui/gui.h>
  8. #include <gui/view_dispatcher.h>
  9. #include <gui/canvas.h>
  10. #include <menu/menu.h>
  11. #include <assets_icons.h>
  12. #include <stdint.h>
  13. typedef enum {
  14. DolphinEventTypeDeed,
  15. DolphinEventTypeSave,
  16. DolphinEventTypeTick,
  17. } DolphinEventType;
  18. typedef struct {
  19. DolphinEventType type;
  20. union {
  21. DolphinDeed deed;
  22. };
  23. } DolphinEvent;
  24. struct Dolphin {
  25. // Internal message queue
  26. osMessageQueueId_t event_queue;
  27. // State
  28. DolphinState* state;
  29. // Menu
  30. ValueMutex* menu_vm;
  31. // Scene
  32. FuriThread* scene_thread;
  33. // GUI
  34. Gui* gui;
  35. ViewDispatcher* idle_view_dispatcher;
  36. View* idle_view_first_start;
  37. View* idle_view_main;
  38. View* idle_view_dolphin_stats;
  39. View* idle_view_down;
  40. View* idle_view_meta;
  41. View* view_hw_mismatch;
  42. View* view_lockmenu;
  43. ViewPort* lock_viewport;
  44. Icon* lock_icon;
  45. bool locked;
  46. uint8_t lock_count;
  47. uint32_t lock_lastpress;
  48. osTimerId_t timeout_timer;
  49. };
  50. // Temporary
  51. const IconName idle_scenes[] = {A_Wink_128x64, A_WatchingTV_128x64};
  52. Dolphin* dolphin_alloc();
  53. void dolphin_free(Dolphin* dolphin);
  54. /* Save Dolphin state (write to permanent memory)
  55. * Thread safe
  56. */
  57. void dolphin_save(Dolphin* dolphin);