Add VGM color settings backend

This commit is contained in:
Willy-JL
2024-03-07 21:34:22 +00:00
parent 99ce5a30ce
commit bf045ccf51
4 changed files with 55 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <furi_hal_serial_types.h>
#include <toolbox/colors.h>
#include <gui/canvas.h>
#ifdef __cplusplus
@@ -43,6 +44,13 @@ typedef enum {
SpiCount,
} SpiHandle;
typedef enum {
VgmColorModeDefault,
VgmColorModeRgbBacklight,
VgmColorModeCustom,
VgmColorModeCount,
} VgmColorMode;
typedef struct {
char asset_pack[ASSET_PACKS_NAME_LEN];
uint32_t anim_speed;
@@ -79,6 +87,9 @@ typedef struct {
FuriHalSerialId uart_esp_channel;
FuriHalSerialId uart_nmea_channel;
bool file_naming_prefix_after;
VgmColorMode vgm_color_mode;
Rgb565Color vgm_color_fg;
Rgb565Color vgm_color_bg;
} MomentumSettings;
typedef struct {

View File

@@ -41,6 +41,9 @@ MomentumSettings momentum_settings = {
.uart_esp_channel = FuriHalSerialIdUsart, // pin 13,14
.uart_nmea_channel = FuriHalSerialIdUsart, // pin 13,14
.file_naming_prefix_after = false, // Before
.vgm_color_mode = VgmColorModeDefault, // Default
.vgm_color_fg.value = 0xFC00, // Default Orange
.vgm_color_bg.value = 0x0000, // Default Black
};
typedef enum {
@@ -110,6 +113,9 @@ static const struct {
{setting_enum(uart_esp_channel, FuriHalSerialIdMax)},
{setting_enum(uart_nmea_channel, FuriHalSerialIdMax)},
{setting_bool(file_naming_prefix_after)},
{setting_enum(vgm_color_mode, VgmColorModeCount)},
{setting_uint(vgm_color_fg, 0x0000, 0xFFFF)},
{setting_uint(vgm_color_bg, 0x0000, 0xFFFF)},
};
void momentum_settings_load() {

View File

@@ -25,6 +25,15 @@ int hsvcmp(const HsvColor* a, const HsvColor* b);
void hsv2rgb(const HsvColor* hsv, RgbColor* rgb);
void rgb2hsv(const RgbColor* rgb, HsvColor* hsv);
typedef union {
uint16_t value;
struct {
uint8_t r : 5;
uint8_t g : 6;
uint8_t b : 5;
};
} Rgb565Color;
#ifdef __cplusplus
}
#endif

View File

@@ -86,6 +86,35 @@ void furi_hal_info_get(PropertyValueCallback out, char sep, void* context) {
property_value_out(&property_context, "%06X", 4, "hardware", "rgb", "led", id_string, __REV(led_value));
}
// VGM Settings
property_value_out(
&property_context,
"%d",
4,
"hardware",
"vgm",
"color",
"mode",
momentum_settings.vgm_color_mode);
property_value_out(
&property_context,
"%04X",
4,
"hardware",
"vgm",
"color",
"fg",
momentum_settings.vgm_color_fg.value);
property_value_out(
&property_context,
"%04X",
4,
"hardware",
"vgm",
"color",
"bg",
momentum_settings.vgm_color_bg.value);
if(sep == '.') {
property_value_out(
&property_context,