GEX core repository.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gex-core/framework/settings.h

74 lines
1.8 KiB

7 years ago
//
// Created by MightyPork on 2017/11/26.
//
// This module manages the INI and binary settings storage.
//
7 years ago
#ifndef GEX_SETTINGS_H
#define GEX_SETTINGS_H
#include "platform.h"
#include "utils/ini_writer.h"
/**
* Load settings from flash (system settings + units).
* Unit registry must be already initialized.
*
* This should happen only once, during the boot sequence.
*/
void settings_load(void);
/**
* Save all settings to flash.
* This may be called multiple times after user changes the config file.
*/
void settings_save(void);
/**
* Call this before any of the ini read stuff
*
* Resets everything to defaults so we have a clean start.
*
* NOTE: Should the file be received only partially, this may corrupt the settings.
* For this reason we don't commit it to flash immediately but require user to replace
* the LOCK jumper before unplugging the device.
7 years ago
*/
void settings_load_ini_begin(void);
7 years ago
/**
* Load settings from INI kv pair.
*/
void settings_load_ini_key(const char *restrict section, const char *restrict key, const char *restrict value);
7 years ago
/**
* Call this before any of the ini read stuff
*
* Resets everything to defaults so we have a clean start.
*
* NOTE: Should the file be received only partially, this may corrupt the settings.
* For this reason we don't commit it to flash immediately but require user to replace
* the LOCK jumper before unplugging the device.
7 years ago
*/
void settings_load_ini_end(void);
7 years ago
/**
* Write UNITS.INI to a iniwriter
7 years ago
* @param iw - writer handle
*/
void settings_build_units_ini(IniWriter *iw);
7 years ago
/**
* Write SYSTEM.INI to iniwriter
* @param iw - writer handle
*/
void settings_build_system_ini(IniWriter *iw);
/**
* Write UNITS.TXT to iniwriter
* @param iw - writer handle
*/
void settings_build_pinout_txt(IniWriter *iw);
7 years ago
#endif //GEX_SETTINGS_H