2021-05-24 16:44:14 +03:00
|
|
|
#include <furi.h>
|
|
|
|
#include <api-hal.h>
|
|
|
|
#include "notification.h"
|
|
|
|
#include "notification-messages.h"
|
|
|
|
|
|
|
|
#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;
|
|
|
|
osEventFlagsId_t back_event;
|
|
|
|
} NotificationAppMessage;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
LayerInternal = 0,
|
|
|
|
LayerNotification = 1,
|
|
|
|
LayerMAX = 2,
|
|
|
|
} NotificationLedLayerIndex;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint8_t value[LayerMAX];
|
|
|
|
NotificationLedLayerIndex index;
|
|
|
|
Light light;
|
|
|
|
} NotificationLedLayer;
|
|
|
|
|
2021-07-05 01:03:56 +03:00
|
|
|
#define NOTIFICATION_SETTINGS_VERSION 0x01
|
|
|
|
#define NOTIFICATION_SETTINGS_PATH "notification_settings"
|
|
|
|
|
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 {
|
|
|
|
osMessageQueueId_t queue;
|
2021-07-05 01:03:56 +03:00
|
|
|
PubSub* event_record;
|
2021-05-24 16:44:14 +03:00
|
|
|
osTimerId_t display_timer;
|
|
|
|
|
|
|
|
NotificationLedLayer display;
|
|
|
|
NotificationLedLayer led[NOTIFICATION_LED_COUNT];
|
|
|
|
|
|
|
|
NotificationSettings settings;
|
2021-07-05 01:03:56 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
void notification_message_save_settings(NotificationApp* app);
|