2021-05-24 13:44:14 +00:00
|
|
|
#include <furi.h>
|
2022-01-05 16:10:18 +00:00
|
|
|
#include <furi_hal.h>
|
2021-05-24 13:44:14 +00:00
|
|
|
#include "notification.h"
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "notification_messages.h"
|
2022-07-26 12:21:51 +00:00
|
|
|
#include "notification_settings_filename.h"
|
2021-05-24 13:44:14 +00:00
|
|
|
|
2024-07-15 04:38:49 +00:00
|
|
|
#define NOTIFICATION_LED_COUNT 3
|
2021-05-24 13:44:14 +00:00
|
|
|
#define NOTIFICATION_EVENT_COMPLETE 0x00000001U
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
NotificationLayerMessage,
|
|
|
|
InternalLayerMessage,
|
2021-07-04 22:03:56 +00:00
|
|
|
SaveSettingsMessage,
|
2024-08-04 09:54:02 +00:00
|
|
|
LoadSettingsMessage,
|
2021-05-24 13:44:14 +00:00
|
|
|
} NotificationAppMessageType;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
const NotificationSequence* sequence;
|
|
|
|
NotificationAppMessageType type;
|
2022-07-20 10:56:33 +00:00
|
|
|
FuriEventFlag* back_event;
|
2021-05-24 13:44:14 +00:00
|
|
|
} NotificationAppMessage;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
LayerInternal = 0,
|
|
|
|
LayerNotification = 1,
|
|
|
|
LayerMAX = 2,
|
|
|
|
} NotificationLedLayerIndex;
|
|
|
|
|
|
|
|
typedef struct {
|
2022-04-21 12:33:03 +00:00
|
|
|
uint8_t value_last[LayerMAX];
|
2021-05-24 13:44:14 +00:00
|
|
|
uint8_t value[LayerMAX];
|
|
|
|
NotificationLedLayerIndex index;
|
|
|
|
Light light;
|
|
|
|
} NotificationLedLayer;
|
|
|
|
|
2023-06-06 17:46:01 +00:00
|
|
|
#define NOTIFICATION_SETTINGS_VERSION 0x02
|
2024-07-15 04:38:49 +00:00
|
|
|
#define NOTIFICATION_SETTINGS_PATH INT_PATH(NOTIFICATION_SETTINGS_FILE_NAME)
|
2021-07-04 22:03:56 +00:00
|
|
|
|
2021-05-24 13:44:14 +00:00
|
|
|
typedef struct {
|
2021-07-04 22:03:56 +00:00
|
|
|
uint8_t version;
|
2021-05-24 13:44:14 +00:00
|
|
|
float display_brightness;
|
|
|
|
float led_brightness;
|
2021-06-28 14:42:30 +00:00
|
|
|
float speaker_volume;
|
2021-05-24 13:44:14 +00:00
|
|
|
uint32_t display_off_delay_ms;
|
2023-06-06 17:46:01 +00:00
|
|
|
int8_t contrast;
|
2021-07-04 22:03:56 +00:00
|
|
|
bool vibro_on;
|
2021-05-24 13:44:14 +00:00
|
|
|
} NotificationSettings;
|
|
|
|
|
|
|
|
struct NotificationApp {
|
2022-07-20 10:56:33 +00:00
|
|
|
FuriMessageQueue* queue;
|
2021-11-01 20:35:54 +00:00
|
|
|
FuriPubSub* event_record;
|
2022-07-20 10:56:33 +00:00
|
|
|
FuriTimer* display_timer;
|
2021-05-24 13:44:14 +00:00
|
|
|
|
|
|
|
NotificationLedLayer display;
|
|
|
|
NotificationLedLayer led[NOTIFICATION_LED_COUNT];
|
2022-04-14 14:05:40 +00:00
|
|
|
uint8_t display_led_lock;
|
2021-05-24 13:44:14 +00:00
|
|
|
|
|
|
|
NotificationSettings settings;
|
2021-07-04 22:03:56 +00:00
|
|
|
};
|
|
|
|
|
2022-02-24 00:17:40 +00:00
|
|
|
void notification_message_save_settings(NotificationApp* app);
|