MR16/User/module/config.h

41 lines
1.0 KiB
C

/*
* 配置相关
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include "device/sx1281_driver/sx1281.h"
#include "module/mr16.h"
#include <stdbool.h>
typedef struct {
uint32_t earsed_count; // 擦除计数
MR16_Param_t mr16;
} Config_t;
/* Exported functions prototypes -------------------------------------------- */
/**
* @brief 获取机器人配置参数
* @return 机器人配置参数指针
*/
Config_t* Config_Get(void);
/* Try to load MR16 parameters from flash; returns pointer to loaded MR16 params
on success or NULL if flash data invalid/missing */
Config_t* Config_LoadMR16FromFlash(void);
/* Read MR16 params from flash and validate them. If valid, copy into runtime
config and return true. If invalid or missing, return false. */
bool Config_LoadMR16FromFlashBool(void);
/* Separated functions for better architecture */
void Config_LoadFromFlash(void); /* Load valid data from flash */
void Config_SetDefaults(void); /* Set default values */
#ifdef __cplusplus
}
#endif