cun
This commit is contained in:
44
apps/earphone/remote_control/nvs.h
Normal file
44
apps/earphone/remote_control/nvs.h
Normal file
@ -0,0 +1,44 @@
|
||||
#ifndef __NVS_H__
|
||||
#define __NVS_H__
|
||||
|
||||
#include "typedef.h"
|
||||
|
||||
// 定义出厂信息数据结构
|
||||
typedef struct {
|
||||
char product_id[16]; // 产品ID
|
||||
char serial_number[32]; // 序列号
|
||||
u16 hw_version; // 硬件版本
|
||||
u16 cal_data; // 某个校准数据
|
||||
u32 manufacture_date; // 生产日期 (Unix时间戳)
|
||||
} factory_info_t;
|
||||
|
||||
/**
|
||||
* @brief 将出厂信息写入Flash
|
||||
*
|
||||
* @param info 指向要写入的出厂信息结构体的指针
|
||||
* @return 实际写入的长度, <0: 失败
|
||||
*/
|
||||
int nvs_write_factory_info(const factory_info_t *info);
|
||||
|
||||
/**
|
||||
* @brief 从Flash读取出厂信息
|
||||
*
|
||||
* @param info 指向用于存储读取数据的出厂信息结构体的指针
|
||||
* @return 实际读取的长度, <0: 失败 (例如尚未写入过)
|
||||
*/
|
||||
int nvs_read_factory_info(factory_info_t *info);
|
||||
|
||||
/**
|
||||
* @brief 清空Flash中的出厂信息
|
||||
*
|
||||
* @return 0: 成功, <0: 失败
|
||||
*/
|
||||
int nvs_clear_factory_info(void);
|
||||
|
||||
/**
|
||||
* @brief 用于测试NVS读写功能的函数
|
||||
*
|
||||
*/
|
||||
void nvs_test_factory_info(void);
|
||||
|
||||
#endif // __NVS_H__
|
||||
Reference in New Issue
Block a user