[FL-1237] Notifications app (#476)
* Notification app: init * Notification app: separate message sequences * Notification app: rename notifications to notification * Notification app: rework api * Notification app: new sequences for charger * Power app: add state for better led handling * Power app: NotificationSequence type, notification led process * Blink app: use notifications * Notification app: sound and vibro notifications * Notification app: note messages * Notification app: more messages * Notification app: update note message generator * Blink app: fix state counter * Notification app: fix delay event * App sd-filesystem: notifications * App notifications: headers c++ compatibility * App notifications: Cmaj success chord sequence * App iButton: use notifications * App notification: display backlight notifications * App notification: add "display on" message to success and error sequences * App accessor: use notifications * App ibutton: guard onewire key read * Lib-RFAL: remove api_hal_light usage * App notification: add blocking mode, rework display api * Cli led command: use internal notification instead of direc access to leds. * App unit test: use notifications * App lfrfid: use notifications * Apps: close notification record * App subghz: rough use of notifications * App notificaton: ignore reset flag * App strobe: removed * Lib irda decoder: fix nec decoding * App irda: fix assert, use notifications * Apps: use notifications * Fix IRDA tests * Cli: better var naming * App notification: readable sources Co-authored-by: Albert Kharisov <albert@flipperdevices.com> Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
37
applications/notification/notification-app-api.c
Normal file
37
applications/notification/notification-app-api.c
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include "notification.h"
|
||||
#include "notification-messages.h"
|
||||
#include "notification-app.h"
|
||||
|
||||
void notification_message(NotificationApp* app, const NotificationSequence* sequence) {
|
||||
NotificationAppMessage m = {
|
||||
.type = NotificationLayerMessage, .sequence = sequence, .back_event = NULL};
|
||||
furi_check(osMessageQueuePut(app->queue, &m, 0, osWaitForever) == osOK);
|
||||
};
|
||||
|
||||
void notification_internal_message(NotificationApp* app, const NotificationSequence* sequence) {
|
||||
NotificationAppMessage m = {
|
||||
.type = InternalLayerMessage, .sequence = sequence, .back_event = NULL};
|
||||
furi_check(osMessageQueuePut(app->queue, &m, 0, osWaitForever) == osOK);
|
||||
};
|
||||
|
||||
void notification_message_block(NotificationApp* app, const NotificationSequence* sequence) {
|
||||
NotificationAppMessage m = {
|
||||
.type = NotificationLayerMessage,
|
||||
.sequence = sequence,
|
||||
.back_event = osEventFlagsNew(NULL)};
|
||||
furi_check(osMessageQueuePut(app->queue, &m, 0, osWaitForever) == osOK);
|
||||
osEventFlagsWait(m.back_event, NOTIFICATION_EVENT_COMPLETE, osFlagsWaitAny, osWaitForever);
|
||||
osEventFlagsDelete(m.back_event);
|
||||
};
|
||||
|
||||
void notification_internal_message_block(
|
||||
NotificationApp* app,
|
||||
const NotificationSequence* sequence) {
|
||||
NotificationAppMessage m = {
|
||||
.type = InternalLayerMessage, .sequence = sequence, .back_event = osEventFlagsNew(NULL)};
|
||||
furi_check(osMessageQueuePut(app->queue, &m, 0, osWaitForever) == osOK);
|
||||
osEventFlagsWait(m.back_event, NOTIFICATION_EVENT_COMPLETE, osFlagsWaitAny, osWaitForever);
|
||||
osEventFlagsDelete(m.back_event);
|
||||
};
|
371
applications/notification/notification-app.c
Normal file
371
applications/notification/notification-app.c
Normal file
@@ -0,0 +1,371 @@
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include "notification.h"
|
||||
#include "notification-messages.h"
|
||||
#include "notification-app.h"
|
||||
|
||||
static const uint8_t minimal_delay = 100;
|
||||
static const uint8_t led_off_values[NOTIFICATION_LED_COUNT] = {0x00, 0x00, 0x00};
|
||||
|
||||
static const uint8_t reset_red_mask = 1 << 0;
|
||||
static const uint8_t reset_green_mask = 1 << 1;
|
||||
static const uint8_t reset_blue_mask = 1 << 2;
|
||||
static const uint8_t reset_vibro_mask = 1 << 3;
|
||||
static const uint8_t reset_sound_mask = 1 << 4;
|
||||
static const uint8_t reset_display_mask = 1 << 5;
|
||||
|
||||
void notification_vibro_on();
|
||||
void notification_vibro_off();
|
||||
void notification_sound_on(float pwm, float freq);
|
||||
void notification_sound_off();
|
||||
|
||||
uint8_t notification_settings_get_display_brightness(NotificationApp* app, uint8_t value);
|
||||
uint8_t notification_settings_get_rgb_led_brightness(NotificationApp* app, uint8_t value);
|
||||
uint32_t notification_settings_display_off_delay_ticks(NotificationApp* app);
|
||||
|
||||
// internal layer
|
||||
void notification_apply_internal_led_layer(NotificationLedLayer* layer, uint8_t layer_value) {
|
||||
furi_assert(layer);
|
||||
furi_assert(layer->index < LayerMAX);
|
||||
|
||||
// set value
|
||||
layer->value[LayerInternal] = layer_value;
|
||||
|
||||
// apply if current layer is internal
|
||||
if(layer->index == LayerInternal) {
|
||||
api_hal_light_set(layer->light, layer->value[LayerInternal]);
|
||||
}
|
||||
}
|
||||
|
||||
bool notification_is_any_led_layer_internal_and_not_empty(NotificationApp* app) {
|
||||
bool result = false;
|
||||
if((app->led[0].index == LayerInternal) || (app->led[1].index == LayerInternal) ||
|
||||
(app->led[2].index == LayerInternal)) {
|
||||
if((app->led[0].value[LayerInternal] != 0x00) ||
|
||||
(app->led[1].value[LayerInternal] != 0x00) ||
|
||||
(app->led[2].value[LayerInternal] != 0x00)) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// notification layer
|
||||
void notification_apply_notification_led_layer(
|
||||
NotificationLedLayer* layer,
|
||||
const uint8_t layer_value) {
|
||||
furi_assert(layer);
|
||||
furi_assert(layer->index < LayerMAX);
|
||||
|
||||
// set value
|
||||
layer->index = LayerNotification;
|
||||
// set layer
|
||||
layer->value[LayerNotification] = layer_value;
|
||||
// apply
|
||||
api_hal_light_set(layer->light, layer->value[LayerNotification]);
|
||||
}
|
||||
|
||||
void notification_reset_notification_led_layer(NotificationLedLayer* layer) {
|
||||
furi_assert(layer);
|
||||
furi_assert(layer->index < LayerMAX);
|
||||
|
||||
// set value
|
||||
layer->value[LayerNotification] = 0;
|
||||
// set layer
|
||||
layer->index = LayerInternal;
|
||||
|
||||
// apply
|
||||
api_hal_light_set(layer->light, layer->value[LayerInternal]);
|
||||
}
|
||||
|
||||
void notification_reset_notification_layer(NotificationApp* app, uint8_t reset_mask) {
|
||||
if(reset_mask & reset_red_mask) {
|
||||
notification_reset_notification_led_layer(&app->led[0]);
|
||||
}
|
||||
if(reset_mask & reset_green_mask) {
|
||||
notification_reset_notification_led_layer(&app->led[1]);
|
||||
}
|
||||
if(reset_mask & reset_blue_mask) {
|
||||
notification_reset_notification_led_layer(&app->led[2]);
|
||||
}
|
||||
if(reset_mask & reset_vibro_mask) {
|
||||
notification_vibro_off();
|
||||
}
|
||||
if(reset_mask & reset_sound_mask) {
|
||||
notification_sound_off();
|
||||
}
|
||||
if(reset_mask & reset_display_mask) {
|
||||
osTimerStart(app->display_timer, notification_settings_display_off_delay_ticks(app));
|
||||
}
|
||||
}
|
||||
|
||||
static void notification_apply_notification_leds(NotificationApp* app, const uint8_t* values) {
|
||||
for(uint8_t i = 0; i < NOTIFICATION_LED_COUNT; i++) {
|
||||
notification_apply_notification_led_layer(
|
||||
&app->led[i], notification_settings_get_display_brightness(app, values[i]));
|
||||
}
|
||||
}
|
||||
|
||||
// settings
|
||||
uint8_t notification_settings_get_display_brightness(NotificationApp* app, uint8_t value) {
|
||||
return (value * app->settings.display_brightness);
|
||||
}
|
||||
|
||||
uint8_t notification_settings_get_rgb_led_brightness(NotificationApp* app, uint8_t value) {
|
||||
return (value * app->settings.led_brightness);
|
||||
}
|
||||
|
||||
uint32_t notification_settings_display_off_delay_ticks(NotificationApp* app) {
|
||||
return ((float)(app->settings.display_off_delay_ms) / (1000.0f / osKernelGetTickFreq()));
|
||||
}
|
||||
|
||||
// generics
|
||||
void notification_vibro_on() {
|
||||
api_hal_vibro_on(true);
|
||||
}
|
||||
|
||||
void notification_vibro_off() {
|
||||
api_hal_vibro_on(false);
|
||||
}
|
||||
|
||||
void notification_sound_on(float pwm, float freq) {
|
||||
hal_pwm_set(pwm, freq, &SPEAKER_TIM, SPEAKER_CH);
|
||||
}
|
||||
|
||||
void notification_sound_off() {
|
||||
hal_pwm_stop(&SPEAKER_TIM, SPEAKER_CH);
|
||||
}
|
||||
|
||||
// display timer
|
||||
static void notification_display_timer(void* ctx) {
|
||||
furi_assert(ctx);
|
||||
NotificationApp* app = ctx;
|
||||
notification_message(app, &sequence_display_off);
|
||||
}
|
||||
|
||||
// message processing
|
||||
void notification_process_notification_message(
|
||||
NotificationApp* app,
|
||||
NotificationAppMessage* message) {
|
||||
uint32_t notification_message_index = 0;
|
||||
const NotificationMessage* notification_message;
|
||||
notification_message = (*message->sequence)[notification_message_index];
|
||||
|
||||
bool led_active = false;
|
||||
uint8_t led_values[NOTIFICATION_LED_COUNT] = {0x00, 0x00, 0x00};
|
||||
bool reset_notifications = true;
|
||||
|
||||
uint8_t reset_mask = 0;
|
||||
|
||||
while(notification_message != NULL) {
|
||||
switch(notification_message->type) {
|
||||
case NotificationMessageTypeLedDisplay:
|
||||
// if on - switch on and start timer
|
||||
// if off - switch off and stop timer
|
||||
// on timer - switch off
|
||||
if(notification_message->data.led.value > 0x00) {
|
||||
notification_apply_notification_led_layer(
|
||||
&app->display,
|
||||
notification_settings_get_display_brightness(
|
||||
app, notification_message->data.led.value));
|
||||
} else {
|
||||
notification_reset_notification_led_layer(&app->display);
|
||||
if(osTimerIsRunning(app->display_timer)) {
|
||||
osTimerStop(app->display_timer);
|
||||
}
|
||||
}
|
||||
reset_mask |= reset_display_mask;
|
||||
break;
|
||||
case NotificationMessageTypeLedRed:
|
||||
// store and send on delay or after seq
|
||||
led_active = true;
|
||||
led_values[0] = notification_message->data.led.value;
|
||||
reset_mask |= reset_red_mask;
|
||||
break;
|
||||
case NotificationMessageTypeLedGreen:
|
||||
// store and send on delay or after seq
|
||||
led_active = true;
|
||||
led_values[1] = notification_message->data.led.value;
|
||||
reset_mask |= reset_green_mask;
|
||||
break;
|
||||
case NotificationMessageTypeLedBlue:
|
||||
// store and send on delay or after seq
|
||||
led_active = true;
|
||||
led_values[2] = notification_message->data.led.value;
|
||||
reset_mask |= reset_blue_mask;
|
||||
break;
|
||||
case NotificationMessageTypeVibro:
|
||||
if(notification_message->data.vibro.on) {
|
||||
notification_vibro_on();
|
||||
} else {
|
||||
notification_vibro_off();
|
||||
}
|
||||
reset_mask |= reset_vibro_mask;
|
||||
break;
|
||||
case NotificationMessageTypeSoundOn:
|
||||
notification_sound_on(
|
||||
notification_message->data.sound.pwm, notification_message->data.sound.frequency);
|
||||
reset_mask |= reset_sound_mask;
|
||||
break;
|
||||
case NotificationMessageTypeSoundOff:
|
||||
notification_sound_off();
|
||||
reset_mask |= reset_sound_mask;
|
||||
break;
|
||||
case NotificationMessageTypeDelay:
|
||||
if(led_active) {
|
||||
if(notification_is_any_led_layer_internal_and_not_empty(app)) {
|
||||
notification_apply_notification_leds(app, led_off_values);
|
||||
delay(minimal_delay);
|
||||
}
|
||||
|
||||
led_active = false;
|
||||
|
||||
notification_apply_notification_leds(app, led_values);
|
||||
reset_mask |= reset_red_mask;
|
||||
reset_mask |= reset_green_mask;
|
||||
reset_mask |= reset_blue_mask;
|
||||
}
|
||||
|
||||
delay(notification_message->data.delay.length);
|
||||
break;
|
||||
case NotificationMessageTypeDoNotReset:
|
||||
reset_notifications = false;
|
||||
break;
|
||||
}
|
||||
notification_message_index++;
|
||||
notification_message = (*message->sequence)[notification_message_index];
|
||||
};
|
||||
|
||||
// send and do minimal delay
|
||||
if(led_active) {
|
||||
bool need_minimal_delay = false;
|
||||
if(notification_is_any_led_layer_internal_and_not_empty(app)) {
|
||||
need_minimal_delay = true;
|
||||
}
|
||||
|
||||
led_active = false;
|
||||
notification_apply_notification_leds(app, led_values);
|
||||
reset_mask |= reset_red_mask;
|
||||
reset_mask |= reset_green_mask;
|
||||
reset_mask |= reset_blue_mask;
|
||||
|
||||
if(need_minimal_delay) {
|
||||
notification_apply_notification_leds(app, led_off_values);
|
||||
delay(minimal_delay);
|
||||
}
|
||||
}
|
||||
|
||||
if(reset_notifications) {
|
||||
notification_reset_notification_layer(app, reset_mask);
|
||||
}
|
||||
|
||||
if(message->back_event != NULL) {
|
||||
osEventFlagsSet(message->back_event, NOTIFICATION_EVENT_COMPLETE);
|
||||
}
|
||||
}
|
||||
|
||||
void notification_process_internal_message(NotificationApp* app, NotificationAppMessage* message) {
|
||||
uint32_t notification_message_index = 0;
|
||||
const NotificationMessage* notification_message;
|
||||
notification_message = (*message->sequence)[notification_message_index];
|
||||
|
||||
while(notification_message != NULL) {
|
||||
switch(notification_message->type) {
|
||||
case NotificationMessageTypeLedDisplay:
|
||||
notification_apply_internal_led_layer(
|
||||
&app->display,
|
||||
notification_settings_get_display_brightness(
|
||||
app, notification_message->data.led.value));
|
||||
break;
|
||||
case NotificationMessageTypeLedRed:
|
||||
notification_apply_internal_led_layer(
|
||||
&app->led[0],
|
||||
notification_settings_get_rgb_led_brightness(
|
||||
app, notification_message->data.led.value));
|
||||
break;
|
||||
case NotificationMessageTypeLedGreen:
|
||||
notification_apply_internal_led_layer(
|
||||
&app->led[1],
|
||||
notification_settings_get_rgb_led_brightness(
|
||||
app, notification_message->data.led.value));
|
||||
break;
|
||||
case NotificationMessageTypeLedBlue:
|
||||
notification_apply_internal_led_layer(
|
||||
&app->led[2],
|
||||
notification_settings_get_rgb_led_brightness(
|
||||
app, notification_message->data.led.value));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
notification_message_index++;
|
||||
notification_message = (*message->sequence)[notification_message_index];
|
||||
}
|
||||
|
||||
if(message->back_event != NULL) {
|
||||
osEventFlagsSet(message->back_event, NOTIFICATION_EVENT_COMPLETE);
|
||||
}
|
||||
}
|
||||
|
||||
// App alloc
|
||||
static NotificationApp* notification_app_alloc() {
|
||||
NotificationApp* app = furi_alloc(sizeof(NotificationApp));
|
||||
app->queue = osMessageQueueNew(8, sizeof(NotificationAppMessage), NULL);
|
||||
app->display_timer = osTimerNew(notification_display_timer, osTimerOnce, app, NULL);
|
||||
|
||||
app->settings.display_brightness = 1.0f;
|
||||
app->settings.led_brightness = 1.0f;
|
||||
app->settings.display_off_delay_ms = 30000;
|
||||
|
||||
app->display.value[LayerInternal] = 0x00;
|
||||
app->display.value[LayerNotification] = 0x00;
|
||||
app->display.index = LayerInternal;
|
||||
app->display.light = LightBacklight;
|
||||
|
||||
app->led[0].value[LayerInternal] = 0x00;
|
||||
app->led[0].value[LayerNotification] = 0x00;
|
||||
app->led[0].index = LayerInternal;
|
||||
app->led[0].light = LightRed;
|
||||
|
||||
app->led[1].value[LayerInternal] = 0x00;
|
||||
app->led[1].value[LayerNotification] = 0x00;
|
||||
app->led[1].index = LayerInternal;
|
||||
app->led[1].light = LightGreen;
|
||||
|
||||
app->led[2].value[LayerInternal] = 0x00;
|
||||
app->led[2].value[LayerNotification] = 0x00;
|
||||
app->led[2].index = LayerInternal;
|
||||
app->led[2].light = LightBlue;
|
||||
|
||||
return app;
|
||||
};
|
||||
|
||||
// App
|
||||
int32_t notification_app(void* p) {
|
||||
NotificationApp* app = notification_app_alloc();
|
||||
|
||||
notification_vibro_off();
|
||||
notification_sound_off();
|
||||
notification_apply_internal_led_layer(&app->display, 0x00);
|
||||
notification_apply_internal_led_layer(&app->led[0], 0x00);
|
||||
notification_apply_internal_led_layer(&app->led[1], 0x00);
|
||||
notification_apply_internal_led_layer(&app->led[2], 0x00);
|
||||
|
||||
furi_record_create("notification", app);
|
||||
|
||||
NotificationAppMessage message;
|
||||
while(1) {
|
||||
furi_check(osMessageQueueGet(app->queue, &message, NULL, osWaitForever) == osOK);
|
||||
|
||||
switch(message.type) {
|
||||
case NotificationLayerMessage:
|
||||
notification_process_notification_message(app, &message);
|
||||
break;
|
||||
case InternalLayerMessage:
|
||||
notification_process_internal_message(app, &message);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
46
applications/notification/notification-app.h
Normal file
46
applications/notification/notification-app.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#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,
|
||||
} 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;
|
||||
|
||||
typedef struct {
|
||||
float display_brightness;
|
||||
float led_brightness;
|
||||
uint32_t display_off_delay_ms;
|
||||
} NotificationSettings;
|
||||
|
||||
struct NotificationApp {
|
||||
osMessageQueueId_t queue;
|
||||
osTimerId_t display_timer;
|
||||
|
||||
NotificationLedLayer display;
|
||||
NotificationLedLayer led[NOTIFICATION_LED_COUNT];
|
||||
|
||||
NotificationSettings settings;
|
||||
};
|
568
applications/notification/notification-messages-notes.c
Normal file
568
applications/notification/notification-messages-notes.c
Normal file
@@ -0,0 +1,568 @@
|
||||
#include "notification.h"
|
||||
|
||||
/*
|
||||
Python script for note messages generation
|
||||
|
||||
# coding: utf-8
|
||||
# Python script for note messages generation
|
||||
from typing import List
|
||||
|
||||
note_names: List = ['c', 'cs', 'd', 'ds', 'e', 'f', 'fs', 'g', 'gs', 'a', 'as', 'b']
|
||||
base_note: float = 16.3515979
|
||||
cf: float = 2 ** (1.0 / 12)
|
||||
|
||||
note: float = base_note
|
||||
for octave in range(9):
|
||||
for name in note_names:
|
||||
print(f"const NotificationMessage message_note_{name}{octave}" + " = {\n"
|
||||
"\t.type = NotificationMessageTypeSoundOn,\n"
|
||||
f"\t.data.sound.frequency = {round(note, 2)}f,\n"
|
||||
"\t.data.sound.pwm = 0.5f,\n"
|
||||
"};")
|
||||
note = note * cf
|
||||
|
||||
for octave in range(9):
|
||||
for name in note_names:
|
||||
print(f"extern const NotificationMessage message_note_{name}{octave};")
|
||||
*/
|
||||
|
||||
const NotificationMessage message_note_c0 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 16.35f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_cs0 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 17.32f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_d0 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 18.35f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_ds0 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 19.45f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_e0 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 20.6f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_f0 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 21.83f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_fs0 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 23.12f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_g0 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 24.5f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_gs0 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 25.96f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_a0 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 27.5f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_as0 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 29.14f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_b0 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 30.87f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_c1 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 32.7f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_cs1 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 34.65f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_d1 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 36.71f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_ds1 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 38.89f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_e1 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 41.2f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_f1 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 43.65f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_fs1 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 46.25f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_g1 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 49.0f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_gs1 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 51.91f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_a1 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 55.0f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_as1 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 58.27f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_b1 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 61.74f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_c2 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 65.41f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_cs2 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 69.3f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_d2 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 73.42f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_ds2 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 77.78f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_e2 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 82.41f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_f2 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 87.31f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_fs2 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 92.5f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_g2 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 98.0f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_gs2 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 103.83f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_a2 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 110.0f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_as2 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 116.54f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_b2 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 123.47f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_c3 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 130.81f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_cs3 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 138.59f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_d3 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 146.83f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_ds3 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 155.56f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_e3 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 164.81f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_f3 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 174.61f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_fs3 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 185.0f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_g3 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 196.0f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_gs3 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 207.65f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_a3 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 220.0f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_as3 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 233.08f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_b3 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 246.94f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_c4 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 261.63f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_cs4 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 277.18f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_d4 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 293.66f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_ds4 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 311.13f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_e4 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 329.63f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_f4 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 349.23f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_fs4 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 369.99f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_g4 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 392.0f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_gs4 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 415.3f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_a4 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 440.0f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_as4 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 466.16f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_b4 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 493.88f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_c5 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 523.25f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_cs5 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 554.37f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_d5 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 587.33f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_ds5 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 622.25f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_e5 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 659.26f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_f5 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 698.46f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_fs5 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 739.99f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_g5 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 783.99f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_gs5 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 830.61f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_a5 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 880.0f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_as5 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 932.33f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_b5 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 987.77f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_c6 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 1046.5f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_cs6 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 1108.73f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_d6 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 1174.66f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_ds6 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 1244.51f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_e6 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 1318.51f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_f6 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 1396.91f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_fs6 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 1479.98f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_g6 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 1567.98f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_gs6 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 1661.22f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_a6 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 1760.0f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_as6 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 1864.66f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_b6 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 1975.53f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_c7 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 2093.0f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_cs7 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 2217.46f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_d7 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 2349.32f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_ds7 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 2489.02f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_e7 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 2637.02f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_f7 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 2793.83f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_fs7 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 2959.96f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_g7 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 3135.96f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_gs7 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 3322.44f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_a7 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 3520.0f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_as7 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 3729.31f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_b7 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 3951.07f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_c8 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 4186.01f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_cs8 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 4434.92f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_d8 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 4698.64f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_ds8 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 4978.03f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_e8 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 5274.04f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_f8 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 5587.65f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_fs8 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 5919.91f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_g8 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 6271.93f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_gs8 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 6644.88f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_a8 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 7040.0f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_as8 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 7458.62f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
||||
const NotificationMessage message_note_b8 = {
|
||||
.type = NotificationMessageTypeSoundOn,
|
||||
.data.sound.frequency = 7902.13f,
|
||||
.data.sound.pwm = 0.5f,
|
||||
};
|
119
applications/notification/notification-messages-notes.h
Normal file
119
applications/notification/notification-messages-notes.h
Normal file
@@ -0,0 +1,119 @@
|
||||
#pragma once
|
||||
#include "notification.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const NotificationMessage message_note_c0;
|
||||
extern const NotificationMessage message_note_cs0;
|
||||
extern const NotificationMessage message_note_d0;
|
||||
extern const NotificationMessage message_note_ds0;
|
||||
extern const NotificationMessage message_note_e0;
|
||||
extern const NotificationMessage message_note_f0;
|
||||
extern const NotificationMessage message_note_fs0;
|
||||
extern const NotificationMessage message_note_g0;
|
||||
extern const NotificationMessage message_note_gs0;
|
||||
extern const NotificationMessage message_note_a0;
|
||||
extern const NotificationMessage message_note_as0;
|
||||
extern const NotificationMessage message_note_b0;
|
||||
extern const NotificationMessage message_note_c1;
|
||||
extern const NotificationMessage message_note_cs1;
|
||||
extern const NotificationMessage message_note_d1;
|
||||
extern const NotificationMessage message_note_ds1;
|
||||
extern const NotificationMessage message_note_e1;
|
||||
extern const NotificationMessage message_note_f1;
|
||||
extern const NotificationMessage message_note_fs1;
|
||||
extern const NotificationMessage message_note_g1;
|
||||
extern const NotificationMessage message_note_gs1;
|
||||
extern const NotificationMessage message_note_a1;
|
||||
extern const NotificationMessage message_note_as1;
|
||||
extern const NotificationMessage message_note_b1;
|
||||
extern const NotificationMessage message_note_c2;
|
||||
extern const NotificationMessage message_note_cs2;
|
||||
extern const NotificationMessage message_note_d2;
|
||||
extern const NotificationMessage message_note_ds2;
|
||||
extern const NotificationMessage message_note_e2;
|
||||
extern const NotificationMessage message_note_f2;
|
||||
extern const NotificationMessage message_note_fs2;
|
||||
extern const NotificationMessage message_note_g2;
|
||||
extern const NotificationMessage message_note_gs2;
|
||||
extern const NotificationMessage message_note_a2;
|
||||
extern const NotificationMessage message_note_as2;
|
||||
extern const NotificationMessage message_note_b2;
|
||||
extern const NotificationMessage message_note_c3;
|
||||
extern const NotificationMessage message_note_cs3;
|
||||
extern const NotificationMessage message_note_d3;
|
||||
extern const NotificationMessage message_note_ds3;
|
||||
extern const NotificationMessage message_note_e3;
|
||||
extern const NotificationMessage message_note_f3;
|
||||
extern const NotificationMessage message_note_fs3;
|
||||
extern const NotificationMessage message_note_g3;
|
||||
extern const NotificationMessage message_note_gs3;
|
||||
extern const NotificationMessage message_note_a3;
|
||||
extern const NotificationMessage message_note_as3;
|
||||
extern const NotificationMessage message_note_b3;
|
||||
extern const NotificationMessage message_note_c4;
|
||||
extern const NotificationMessage message_note_cs4;
|
||||
extern const NotificationMessage message_note_d4;
|
||||
extern const NotificationMessage message_note_ds4;
|
||||
extern const NotificationMessage message_note_e4;
|
||||
extern const NotificationMessage message_note_f4;
|
||||
extern const NotificationMessage message_note_fs4;
|
||||
extern const NotificationMessage message_note_g4;
|
||||
extern const NotificationMessage message_note_gs4;
|
||||
extern const NotificationMessage message_note_a4;
|
||||
extern const NotificationMessage message_note_as4;
|
||||
extern const NotificationMessage message_note_b4;
|
||||
extern const NotificationMessage message_note_c5;
|
||||
extern const NotificationMessage message_note_cs5;
|
||||
extern const NotificationMessage message_note_d5;
|
||||
extern const NotificationMessage message_note_ds5;
|
||||
extern const NotificationMessage message_note_e5;
|
||||
extern const NotificationMessage message_note_f5;
|
||||
extern const NotificationMessage message_note_fs5;
|
||||
extern const NotificationMessage message_note_g5;
|
||||
extern const NotificationMessage message_note_gs5;
|
||||
extern const NotificationMessage message_note_a5;
|
||||
extern const NotificationMessage message_note_as5;
|
||||
extern const NotificationMessage message_note_b5;
|
||||
extern const NotificationMessage message_note_c6;
|
||||
extern const NotificationMessage message_note_cs6;
|
||||
extern const NotificationMessage message_note_d6;
|
||||
extern const NotificationMessage message_note_ds6;
|
||||
extern const NotificationMessage message_note_e6;
|
||||
extern const NotificationMessage message_note_f6;
|
||||
extern const NotificationMessage message_note_fs6;
|
||||
extern const NotificationMessage message_note_g6;
|
||||
extern const NotificationMessage message_note_gs6;
|
||||
extern const NotificationMessage message_note_a6;
|
||||
extern const NotificationMessage message_note_as6;
|
||||
extern const NotificationMessage message_note_b6;
|
||||
extern const NotificationMessage message_note_c7;
|
||||
extern const NotificationMessage message_note_cs7;
|
||||
extern const NotificationMessage message_note_d7;
|
||||
extern const NotificationMessage message_note_ds7;
|
||||
extern const NotificationMessage message_note_e7;
|
||||
extern const NotificationMessage message_note_f7;
|
||||
extern const NotificationMessage message_note_fs7;
|
||||
extern const NotificationMessage message_note_g7;
|
||||
extern const NotificationMessage message_note_gs7;
|
||||
extern const NotificationMessage message_note_a7;
|
||||
extern const NotificationMessage message_note_as7;
|
||||
extern const NotificationMessage message_note_b7;
|
||||
extern const NotificationMessage message_note_c8;
|
||||
extern const NotificationMessage message_note_cs8;
|
||||
extern const NotificationMessage message_note_d8;
|
||||
extern const NotificationMessage message_note_ds8;
|
||||
extern const NotificationMessage message_note_e8;
|
||||
extern const NotificationMessage message_note_f8;
|
||||
extern const NotificationMessage message_note_fs8;
|
||||
extern const NotificationMessage message_note_g8;
|
||||
extern const NotificationMessage message_note_gs8;
|
||||
extern const NotificationMessage message_note_a8;
|
||||
extern const NotificationMessage message_note_as8;
|
||||
extern const NotificationMessage message_note_b8;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
323
applications/notification/notification-messages.c
Normal file
323
applications/notification/notification-messages.c
Normal file
@@ -0,0 +1,323 @@
|
||||
#include "notification.h"
|
||||
#include "notification-messages-notes.h"
|
||||
#include <stddef.h>
|
||||
|
||||
/*********************************** Messages **********************************/
|
||||
|
||||
// Display
|
||||
const NotificationMessage message_display_on = {
|
||||
.type = NotificationMessageTypeLedDisplay,
|
||||
.data.led.value = 0xFF,
|
||||
};
|
||||
|
||||
const NotificationMessage message_display_off = {
|
||||
.type = NotificationMessageTypeLedDisplay,
|
||||
.data.led.value = 0x00,
|
||||
};
|
||||
|
||||
// Led ON
|
||||
const NotificationMessage message_red_255 = {
|
||||
.type = NotificationMessageTypeLedRed,
|
||||
.data.led.value = 0xFF,
|
||||
};
|
||||
|
||||
const NotificationMessage message_green_255 = {
|
||||
.type = NotificationMessageTypeLedGreen,
|
||||
.data.led.value = 0xFF,
|
||||
};
|
||||
|
||||
const NotificationMessage message_blue_255 = {
|
||||
.type = NotificationMessageTypeLedBlue,
|
||||
.data.led.value = 0xFF,
|
||||
};
|
||||
|
||||
// Led OFF
|
||||
const NotificationMessage message_red_0 = {
|
||||
.type = NotificationMessageTypeLedRed,
|
||||
.data.led.value = 0x00,
|
||||
};
|
||||
|
||||
const NotificationMessage message_green_0 = {
|
||||
.type = NotificationMessageTypeLedGreen,
|
||||
.data.led.value = 0x00,
|
||||
};
|
||||
|
||||
const NotificationMessage message_blue_0 = {
|
||||
.type = NotificationMessageTypeLedBlue,
|
||||
.data.led.value = 0x00,
|
||||
};
|
||||
|
||||
// Delay
|
||||
const NotificationMessage message_delay_10 = {
|
||||
.type = NotificationMessageTypeDelay,
|
||||
.data.delay.length = 10,
|
||||
};
|
||||
|
||||
const NotificationMessage message_delay_25 = {
|
||||
.type = NotificationMessageTypeDelay,
|
||||
.data.delay.length = 25,
|
||||
};
|
||||
|
||||
const NotificationMessage message_delay_50 = {
|
||||
.type = NotificationMessageTypeDelay,
|
||||
.data.delay.length = 50,
|
||||
};
|
||||
|
||||
const NotificationMessage message_delay_100 = {
|
||||
.type = NotificationMessageTypeDelay,
|
||||
.data.delay.length = 100,
|
||||
};
|
||||
|
||||
const NotificationMessage message_delay_250 = {
|
||||
.type = NotificationMessageTypeDelay,
|
||||
.data.delay.length = 250,
|
||||
};
|
||||
|
||||
const NotificationMessage message_delay_500 = {
|
||||
.type = NotificationMessageTypeDelay,
|
||||
.data.delay.length = 500,
|
||||
};
|
||||
|
||||
const NotificationMessage message_delay_1000 = {
|
||||
.type = NotificationMessageTypeDelay,
|
||||
.data.delay.length = 1000,
|
||||
};
|
||||
|
||||
// Sound
|
||||
const NotificationMessage message_sound_off = {
|
||||
.type = NotificationMessageTypeSoundOff,
|
||||
};
|
||||
|
||||
// Vibro
|
||||
const NotificationMessage message_vibro_on = {
|
||||
.type = NotificationMessageTypeVibro,
|
||||
.data.vibro.on = true,
|
||||
};
|
||||
|
||||
const NotificationMessage message_vibro_off = {
|
||||
.type = NotificationMessageTypeVibro,
|
||||
.data.vibro.on = false,
|
||||
};
|
||||
|
||||
// Reset
|
||||
const NotificationMessage message_do_not_reset = {
|
||||
.type = NotificationMessageTypeDoNotReset,
|
||||
};
|
||||
|
||||
/****************************** Message sequences ******************************/
|
||||
|
||||
// Reset
|
||||
const NotificationSequence sequence_reset_red = {
|
||||
&message_red_0,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_reset_green = {
|
||||
&message_blue_0,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_reset_blue = {
|
||||
&message_green_0,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_reset_rgb = {
|
||||
&message_red_0,
|
||||
&message_blue_0,
|
||||
&message_green_0,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_reset_display = {
|
||||
&message_display_off,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_reset_sound = {
|
||||
&message_sound_off,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_reset_vibro = {
|
||||
&message_vibro_off,
|
||||
NULL,
|
||||
};
|
||||
|
||||
// Vibro
|
||||
const NotificationSequence sequence_set_vibro_on = {
|
||||
&message_vibro_on,
|
||||
&message_do_not_reset,
|
||||
NULL,
|
||||
};
|
||||
|
||||
// Display
|
||||
const NotificationSequence sequence_display_on = {
|
||||
&message_display_on,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_display_off = {
|
||||
&message_display_off,
|
||||
NULL,
|
||||
};
|
||||
|
||||
// Charging
|
||||
const NotificationSequence sequence_charging = {
|
||||
&message_red_255,
|
||||
&message_green_0,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_charged = {
|
||||
&message_green_255,
|
||||
&message_red_0,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_not_charging = {
|
||||
&message_red_0,
|
||||
&message_green_0,
|
||||
NULL,
|
||||
};
|
||||
|
||||
// Light up
|
||||
const NotificationSequence sequence_set_only_red_255 = {
|
||||
&message_red_255,
|
||||
&message_green_0,
|
||||
&message_blue_0,
|
||||
&message_do_not_reset,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_set_only_green_255 = {
|
||||
&message_red_0,
|
||||
&message_green_255,
|
||||
&message_blue_0,
|
||||
&message_do_not_reset,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_set_only_blue_255 = {
|
||||
&message_red_0,
|
||||
&message_green_0,
|
||||
&message_blue_255,
|
||||
&message_do_not_reset,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_set_red_255 = {
|
||||
&message_red_255,
|
||||
&message_do_not_reset,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_set_green_255 = {
|
||||
&message_green_255,
|
||||
&message_do_not_reset,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_set_blue_255 = {
|
||||
&message_blue_255,
|
||||
&message_do_not_reset,
|
||||
NULL,
|
||||
};
|
||||
|
||||
// Blink
|
||||
const NotificationSequence sequence_blink_red_10 = {
|
||||
&message_red_255,
|
||||
&message_delay_10,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_blink_green_10 = {
|
||||
&message_green_255,
|
||||
&message_delay_10,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_blink_yellow_10 = {
|
||||
&message_red_255,
|
||||
&message_green_255,
|
||||
&message_delay_10,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_blink_red_100 = {
|
||||
&message_red_255,
|
||||
&message_delay_100,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_blink_green_100 = {
|
||||
&message_green_255,
|
||||
&message_delay_100,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_blink_blue_100 = {
|
||||
&message_blue_255,
|
||||
&message_delay_100,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_blink_yellow_100 = {
|
||||
&message_red_255,
|
||||
&message_green_255,
|
||||
&message_delay_100,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_blink_cyan_100 = {
|
||||
&message_green_255,
|
||||
&message_blue_255,
|
||||
&message_delay_100,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_blink_magenta_100 = {
|
||||
&message_red_255,
|
||||
&message_blue_255,
|
||||
&message_delay_100,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_blink_white_100 = {
|
||||
&message_red_255,
|
||||
&message_green_255,
|
||||
&message_blue_255,
|
||||
&message_delay_100,
|
||||
NULL,
|
||||
};
|
||||
|
||||
// General
|
||||
const NotificationSequence sequence_success = {
|
||||
&message_display_on,
|
||||
&message_green_255,
|
||||
&message_vibro_on,
|
||||
&message_note_c5,
|
||||
&message_delay_50,
|
||||
&message_vibro_off,
|
||||
&message_note_e5,
|
||||
&message_delay_50,
|
||||
&message_note_g5,
|
||||
&message_delay_50,
|
||||
&message_note_c6,
|
||||
&message_delay_50,
|
||||
&message_sound_off,
|
||||
NULL,
|
||||
};
|
||||
|
||||
const NotificationSequence sequence_error = {
|
||||
&message_display_on,
|
||||
&message_red_255,
|
||||
&message_vibro_on,
|
||||
&message_delay_50,
|
||||
&message_vibro_off,
|
||||
&message_delay_100,
|
||||
&message_vibro_on,
|
||||
&message_delay_50,
|
||||
&message_vibro_off,
|
||||
NULL,
|
||||
};
|
94
applications/notification/notification-messages.h
Normal file
94
applications/notification/notification-messages.h
Normal file
@@ -0,0 +1,94 @@
|
||||
#pragma once
|
||||
#include "notification.h"
|
||||
#include "notification-messages-notes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************************** Messages **********************************/
|
||||
|
||||
// Display
|
||||
extern const NotificationMessage message_display_on;
|
||||
extern const NotificationMessage message_display_off;
|
||||
|
||||
// Led ON
|
||||
extern const NotificationMessage message_red_255;
|
||||
extern const NotificationMessage message_green_255;
|
||||
extern const NotificationMessage message_blue_255;
|
||||
|
||||
// Led OFF
|
||||
extern const NotificationMessage message_red_0;
|
||||
extern const NotificationMessage message_green_0;
|
||||
extern const NotificationMessage message_blue_0;
|
||||
|
||||
// Delay
|
||||
extern const NotificationMessage message_delay_10;
|
||||
extern const NotificationMessage message_delay_25;
|
||||
extern const NotificationMessage message_delay_50;
|
||||
extern const NotificationMessage message_delay_100;
|
||||
extern const NotificationMessage message_delay_250;
|
||||
extern const NotificationMessage message_delay_500;
|
||||
extern const NotificationMessage message_delay_1000;
|
||||
|
||||
// Sound
|
||||
extern const NotificationMessage message_sound_off;
|
||||
|
||||
// Vibro
|
||||
extern const NotificationMessage message_vibro_on;
|
||||
extern const NotificationMessage message_vibro_off;
|
||||
|
||||
// Reset
|
||||
extern const NotificationMessage message_do_not_reset;
|
||||
|
||||
/****************************** Message sequences ******************************/
|
||||
|
||||
// Reset
|
||||
extern const NotificationSequence sequence_reset_red;
|
||||
extern const NotificationSequence sequence_reset_green;
|
||||
extern const NotificationSequence sequence_reset_blue;
|
||||
extern const NotificationSequence sequence_reset_rgb;
|
||||
extern const NotificationSequence sequence_reset_display;
|
||||
extern const NotificationSequence sequence_reset_sound;
|
||||
extern const NotificationSequence sequence_reset_vibro;
|
||||
|
||||
// Vibro
|
||||
extern const NotificationSequence sequence_set_vibro_on;
|
||||
|
||||
// Display
|
||||
extern const NotificationSequence sequence_display_on;
|
||||
extern const NotificationSequence sequence_display_off;
|
||||
|
||||
// Charging
|
||||
extern const NotificationSequence sequence_charging;
|
||||
extern const NotificationSequence sequence_charged;
|
||||
extern const NotificationSequence sequence_not_charging;
|
||||
|
||||
// Light up
|
||||
extern const NotificationSequence sequence_set_only_red_255;
|
||||
extern const NotificationSequence sequence_set_only_green_255;
|
||||
extern const NotificationSequence sequence_set_only_blue_255;
|
||||
extern const NotificationSequence sequence_set_red_255;
|
||||
extern const NotificationSequence sequence_set_green_255;
|
||||
extern const NotificationSequence sequence_set_blue_255;
|
||||
|
||||
// Blink
|
||||
extern const NotificationSequence sequence_blink_red_10;
|
||||
extern const NotificationSequence sequence_blink_green_10;
|
||||
extern const NotificationSequence sequence_blink_yellow_10;
|
||||
|
||||
extern const NotificationSequence sequence_blink_red_100;
|
||||
extern const NotificationSequence sequence_blink_green_100;
|
||||
extern const NotificationSequence sequence_blink_blue_100;
|
||||
extern const NotificationSequence sequence_blink_yellow_100;
|
||||
extern const NotificationSequence sequence_blink_cyan_100;
|
||||
extern const NotificationSequence sequence_blink_magenta_100;
|
||||
extern const NotificationSequence sequence_blink_white_100;
|
||||
|
||||
// General
|
||||
extern const NotificationSequence sequence_success;
|
||||
extern const NotificationSequence sequence_error;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
76
applications/notification/notification.h
Normal file
76
applications/notification/notification.h
Normal file
@@ -0,0 +1,76 @@
|
||||
#pragma once
|
||||
#include "stdint.h"
|
||||
#include "stdbool.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct NotificationApp NotificationApp;
|
||||
typedef struct {
|
||||
float frequency;
|
||||
float pwm;
|
||||
} NotificationMessageDataSound;
|
||||
|
||||
typedef struct {
|
||||
uint8_t value;
|
||||
} NotificationMessageDataLed;
|
||||
|
||||
typedef struct {
|
||||
bool on;
|
||||
} NotificationMessageDataVibro;
|
||||
|
||||
typedef struct {
|
||||
uint32_t length;
|
||||
} NotificationMessageDataDelay;
|
||||
|
||||
typedef union {
|
||||
NotificationMessageDataSound sound;
|
||||
NotificationMessageDataLed led;
|
||||
NotificationMessageDataVibro vibro;
|
||||
NotificationMessageDataDelay delay;
|
||||
} NotificationMessageData;
|
||||
|
||||
typedef enum {
|
||||
NotificationMessageTypeVibro,
|
||||
NotificationMessageTypeSoundOn,
|
||||
NotificationMessageTypeSoundOff,
|
||||
NotificationMessageTypeLedRed,
|
||||
NotificationMessageTypeLedGreen,
|
||||
NotificationMessageTypeLedBlue,
|
||||
NotificationMessageTypeDelay,
|
||||
NotificationMessageTypeLedDisplay,
|
||||
NotificationMessageTypeDoNotReset,
|
||||
} NotificationMessageType;
|
||||
|
||||
typedef struct {
|
||||
NotificationMessageType type;
|
||||
NotificationMessageData data;
|
||||
} NotificationMessage;
|
||||
|
||||
typedef const NotificationMessage* NotificationSequence[];
|
||||
|
||||
void notification_message(NotificationApp* app, const NotificationSequence* sequence);
|
||||
void notification_message_block(NotificationApp* app, const NotificationSequence* sequence);
|
||||
|
||||
/**
|
||||
* @brief Send internal (apply to permanent layer) notification message. Think twice before use.
|
||||
*
|
||||
* @param app notification record content
|
||||
* @param sequence notification sequence
|
||||
*/
|
||||
void notification_internal_message(NotificationApp* app, const NotificationSequence* sequence);
|
||||
|
||||
/**
|
||||
* @brief Send internal (apply to permanent layer) notification message and wait for notification end. Think twice before use.
|
||||
*
|
||||
* @param app notification record content
|
||||
* @param sequence notification sequence
|
||||
*/
|
||||
void notification_internal_message_block(
|
||||
NotificationApp* app,
|
||||
const NotificationSequence* sequence);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user