mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-27 15:22:29 +03:00
cbc0231461
there is no expansion modules yet, so we can disable uart listen for them being enabled 24/7 p.s. some parts of code was taken from Willy-JL's solution todo: revert force reset part if there are real use cases for expansion protocol appears
35 lines
960 B
C
35 lines
960 B
C
#include "expansion_settings.h"
|
|
|
|
#include <storage/storage.h>
|
|
#include <toolbox/saved_struct.h>
|
|
#include <furi_hal_serial.h>
|
|
|
|
#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);
|
|
if(!saved_struct_load(
|
|
EXPANSION_SETTINGS_PATH,
|
|
settings,
|
|
sizeof(ExpansionSettings),
|
|
EXPANSION_SETTINGS_MAGIC,
|
|
EXPANSION_SETTINGS_VERSION)) {
|
|
settings->uart_index = FuriHalSerialIdMax;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool expansion_settings_save(ExpansionSettings* settings) {
|
|
furi_assert(settings);
|
|
return saved_struct_save(
|
|
EXPANSION_SETTINGS_PATH,
|
|
settings,
|
|
sizeof(ExpansionSettings),
|
|
EXPANSION_SETTINGS_MAGIC,
|
|
EXPANSION_SETTINGS_VERSION);
|
|
}
|