simple_peripheral工程,预编译OSAL_SNV=1;然后直接使用osal_snv_read();osal_snv_write();操作,
snvState = osal_snv_read(0x81,BLE_DEVICENAME_LEN,(uint8_t *)SysInfor.DeviceName);//获取设备名称
if(snvState != SUCCESS)
{//没有保存的设备名
SysInfor.DeviceName = BLE_DEVICENAME;
snvState = osal_snv_write(0x81, BLE_DEVICENAME_LEN,(uint8_t *)SysInfor.DeviceName);//保存到snv
}
snvState = osal_snv_read(0x82,4,(uint8_t *)SysInfor.password);//获取蓝牙密码
if(snvState != SUCCESS)
{//没有保存的密码
SysInfor.password = BLE_PASSWORD;
snvState = osal_snv_write(0x82,4,(uint8_t *)SysInfor.password);//保存到snv
}
求助
Susan Yang:
回复 user4997147:
谢谢分享,很高兴您能解决问题!