dolphin_i.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #pragma once
  2. #include "dolphin.h"
  3. #include "dolphin_state.h"
  4. #include "dolphin_views.h"
  5. #include <furi.h>
  6. #include <furi-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* view_hw_mismatch;
  43. View* view_lockmenu;
  44. ViewPort* lock_viewport;
  45. IconAnimation* lock_icon;
  46. bool locked;
  47. uint8_t lock_count;
  48. uint32_t lock_lastpress;
  49. osTimerId_t timeout_timer;
  50. };
  51. Dolphin* dolphin_alloc();
  52. void dolphin_free(Dolphin* dolphin);
  53. /* Save Dolphin state (write to permanent memory)
  54. * Thread safe
  55. */
  56. void dolphin_save(Dolphin* dolphin);