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