notification_app.h 1.4 KB

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