clock_app.h 887 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #include <input/input.h>
  3. #include <locale/locale.h>
  4. #define TAG "Clock"
  5. #define CLOCK_ISO_DATE_FORMAT "%.4d-%.2d-%.2d"
  6. #define CLOCK_RFC_DATE_FORMAT "%.2d-%.2d-%.4d"
  7. #define CLOCK_TIME_FORMAT "%.2d:%.2d:%.2d"
  8. #define MERIDIAN_FORMAT "%s"
  9. #define MERIDIAN_STRING_AM "AM"
  10. #define MERIDIAN_STRING_PM "PM"
  11. #define TIME_LEN 12
  12. #define DATE_LEN 14
  13. #define MERIDIAN_LEN 3
  14. #define BATTERY_LEN 4
  15. #define DATE_PCT_LEN 21
  16. typedef enum {
  17. EventTypeTick,
  18. EventTypeKey,
  19. } EventType;
  20. typedef struct {
  21. EventType type;
  22. InputEvent input;
  23. } PluginEvent;
  24. typedef struct {
  25. LocaleDateFormat date_format;
  26. LocaleTimeFormat time_format;
  27. DateTime datetime;
  28. FuriMutex* mutex;
  29. FuriMessageQueue* event_queue;
  30. uint32_t timer_start_timestamp;
  31. uint32_t timer_stopped_seconds;
  32. bool timer_running;
  33. uint8_t battery_pct;
  34. } ClockState;