notification_app.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #include <furi.h>
  2. #include <furi_hal.h>
  3. #include "notification.h"
  4. #include "notification_messages.h"
  5. #define NOTIFICATION_LED_COUNT 3
  6. #define NOTIFICATION_EVENT_COMPLETE 0x00000001U
  7. typedef enum {
  8. NotificationLayerMessage,
  9. InternalLayerMessage,
  10. SaveSettingsMessage,
  11. } NotificationAppMessageType;
  12. typedef struct {
  13. const NotificationSequence* sequence;
  14. NotificationAppMessageType type;
  15. osEventFlagsId_t back_event;
  16. } NotificationAppMessage;
  17. typedef enum {
  18. LayerInternal = 0,
  19. LayerNotification = 1,
  20. LayerMAX = 2,
  21. } NotificationLedLayerIndex;
  22. typedef struct {
  23. uint8_t value[LayerMAX];
  24. NotificationLedLayerIndex index;
  25. Light light;
  26. } NotificationLedLayer;
  27. #define NOTIFICATION_SETTINGS_VERSION 0x01
  28. #define NOTIFICATION_SETTINGS_PATH "/int/notification.settings"
  29. typedef struct {
  30. uint8_t version;
  31. float display_brightness;
  32. float led_brightness;
  33. float speaker_volume;
  34. uint32_t display_off_delay_ms;
  35. bool vibro_on;
  36. } NotificationSettings;
  37. struct NotificationApp {
  38. osMessageQueueId_t queue;
  39. FuriPubSub* event_record;
  40. osTimerId_t display_timer;
  41. NotificationLedLayer display;
  42. NotificationLedLayer led[NOTIFICATION_LED_COUNT];
  43. uint8_t display_led_lock;
  44. NotificationSettings settings;
  45. };
  46. void notification_message_save_settings(NotificationApp* app);