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.
38 lines
1.0 KiB
38 lines
1.0 KiB
#include "config_service.hpp"
|
|
#if 0
|
|
|
|
static config_t _config;
|
|
static config_t _default_val_config;
|
|
|
|
#define TAG "config"
|
|
static void dump_config(config_t *pcfg) {
|
|
ZLOGI(TAG, "=============== config ===============");
|
|
ZLOGI(TAG, "configMark : %08x", pcfg->configMark);
|
|
ZLOGI(TAG, "placeHolder: %08x", pcfg->placeHolder);
|
|
ZLOGI(TAG, "=");
|
|
}
|
|
//static void create_default_config(config_t *default_cfg) { //
|
|
// default_cfg->configMark = FLASH_MASK_VAL;
|
|
// default_cfg->placeHolder = 0; // dhcp
|
|
//}
|
|
|
|
void config_init(void) {
|
|
ZLOGI(TAG, "config_init");
|
|
|
|
_default_val_config.configMark = FLASH_MASK_VAL;
|
|
_default_val_config.placeHolder = 0;
|
|
|
|
zflash_init((uint32_t *)&_config, sizeof(config_t) / 4);
|
|
zflash_set_default_data((uint32_t *)&_default_val_config);
|
|
|
|
if (!zflash_check()) {
|
|
zflash_factory_reset();
|
|
}
|
|
|
|
dump_config(&_config);
|
|
}
|
|
config_t *config_get(void) { return &_config; }
|
|
void config_flush(void) { zflash_flush(); }
|
|
void config_factory_reset(void) { zflash_factory_reset(); }
|
|
|
|
#endif
|