dolphin_i.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. #define UNLOCK_RST_TIMEOUT 500 // keypress counter reset timeout (ms)
  14. #define HINT_TIMEOUT_L 3 // low refresh rate timeout (app ticks)
  15. #define HINT_TIMEOUT_H 40 // high refresh rate timeout (app ticks)
  16. typedef enum {
  17. DolphinEventTypeDeed,
  18. DolphinEventTypeSave,
  19. DolphinEventTypeTick,
  20. } DolphinEventType;
  21. typedef struct {
  22. DolphinEventType type;
  23. union {
  24. DolphinDeed deed;
  25. };
  26. } DolphinEvent;
  27. struct Dolphin {
  28. // Internal message queue
  29. osMessageQueueId_t event_queue;
  30. // State
  31. DolphinState* state;
  32. // Menu
  33. ValueMutex* menu_vm;
  34. // Scene
  35. FuriThread* scene_thread;
  36. // GUI
  37. Gui* gui;
  38. ViewDispatcher* idle_view_dispatcher;
  39. View* idle_view_first_start;
  40. View* idle_view_main;
  41. View* idle_view_dolphin_stats;
  42. View* idle_view_down;
  43. View* idle_view_meta;
  44. View* view_hw_mismatch;
  45. View* view_lockmenu;
  46. ViewPort* lock_viewport;
  47. IconAnimation* lock_icon;
  48. bool locked;
  49. uint8_t lock_count;
  50. uint32_t lock_lastpress;
  51. osTimerId_t timeout_timer;
  52. };
  53. Dolphin* dolphin_alloc();
  54. void dolphin_free(Dolphin* dolphin);
  55. /* Save Dolphin state (write to permanent memory)
  56. * Thread safe
  57. */
  58. void dolphin_save(Dolphin* dolphin);