notification_app.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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_last[LayerMAX];
  24. uint8_t value[LayerMAX];
  25. NotificationLedLayerIndex index;
  26. Light light;
  27. } NotificationLedLayer;
  28. #define NOTIFICATION_SETTINGS_VERSION 0x01
  29. #define NOTIFICATION_SETTINGS_PATH "/int/notification.settings"
  30. typedef struct {
  31. uint8_t version;
  32. float display_brightness;
  33. float led_brightness;
  34. float speaker_volume;
  35. uint32_t display_off_delay_ms;
  36. bool vibro_on;
  37. } NotificationSettings;
  38. struct NotificationApp {
  39. osMessageQueueId_t queue;
  40. FuriPubSub* event_record;
  41. osTimerId_t display_timer;
  42. NotificationLedLayer display;
  43. NotificationLedLayer led[NOTIFICATION_LED_COUNT];
  44. uint8_t display_led_lock;
  45. NotificationSettings settings;
  46. };
  47. void notification_message_save_settings(NotificationApp* app);