2024-01-19 20:22:48 +00:00
|
|
|
#include "expansion_settings.h"
|
|
|
|
|
|
|
|
#include <storage/storage.h>
|
|
|
|
#include <toolbox/saved_struct.h>
|
2024-01-27 16:05:52 +00:00
|
|
|
#include <furi_hal_serial.h>
|
2024-01-19 20:22:48 +00:00
|
|
|
|
|
|
|
#include "expansion_settings_filename.h"
|
|
|
|
|
|
|
|
#define EXPANSION_SETTINGS_PATH INT_PATH(EXPANSION_SETTINGS_FILE_NAME)
|
|
|
|
#define EXPANSION_SETTINGS_VERSION (0)
|
|
|
|
#define EXPANSION_SETTINGS_MAGIC (0xEA)
|
|
|
|
|
|
|
|
bool expansion_settings_load(ExpansionSettings* settings) {
|
|
|
|
furi_assert(settings);
|
2024-01-27 16:05:52 +00:00
|
|
|
if(!saved_struct_load(
|
|
|
|
EXPANSION_SETTINGS_PATH,
|
|
|
|
settings,
|
|
|
|
sizeof(ExpansionSettings),
|
|
|
|
EXPANSION_SETTINGS_MAGIC,
|
|
|
|
EXPANSION_SETTINGS_VERSION)) {
|
|
|
|
settings->uart_index = FuriHalSerialIdMax;
|
|
|
|
}
|
|
|
|
return true;
|
2024-01-19 20:22:48 +00:00
|
|
|
}
|
|
|
|
|
2024-03-25 18:48:18 +00:00
|
|
|
bool expansion_settings_save(const ExpansionSettings* settings) {
|
2024-01-19 20:22:48 +00:00
|
|
|
furi_assert(settings);
|
|
|
|
return saved_struct_save(
|
|
|
|
EXPANSION_SETTINGS_PATH,
|
|
|
|
settings,
|
|
|
|
sizeof(ExpansionSettings),
|
|
|
|
EXPANSION_SETTINGS_MAGIC,
|
|
|
|
EXPANSION_SETTINGS_VERSION);
|
|
|
|
}
|