power_i.h 909 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #include "power.h"
  3. #include <stdint.h>
  4. #include <gui/view_dispatcher.h>
  5. #include <gui/gui.h>
  6. #include <gui/modules/popup.h>
  7. #include "views/power_off.h"
  8. #include "views/power_unplug_usb.h"
  9. #include <notification/notification_messages.h>
  10. #define POWER_BATTERY_HEALTHY_LEVEL 70
  11. typedef enum {
  12. PowerStateNotCharging,
  13. PowerStateCharging,
  14. PowerStateCharged,
  15. } PowerState;
  16. struct Power {
  17. ViewDispatcher* view_dispatcher;
  18. PowerOff* power_off;
  19. PowerUnplugUsb* power_unplug_usb;
  20. ViewPort* battery_view_port;
  21. Gui* gui;
  22. NotificationApp* notification;
  23. FuriPubSub* event_pubsub;
  24. PowerEvent event;
  25. PowerState state;
  26. PowerInfo info;
  27. bool battery_low;
  28. bool show_low_bat_level_message;
  29. uint8_t battery_level;
  30. uint8_t power_off_timeout;
  31. FuriMutex* api_mtx;
  32. };
  33. typedef enum {
  34. PowerViewOff,
  35. PowerViewUnplugUsb,
  36. } PowerView;