使用正点原子的Flash库
现在读写数值永远都不变,麻烦大家帮忙看看是什么情况?
[mw_shl_code=c,true]while (1) {
static u8 id = 1;
static u8 cha = 1;
device_info.Device_id = id++;
device_info.channel = cha++;
STMFLASH_Write(FLASH_SAVE_ADDR, (u32*)&device_info, SIZE);
delay_ms(500);
//memset(&device_info, '\0', sizeof(struct_device_info));
device_info.Device_id = 0;
device_info.channel= 0;
STMFLASH_Read(FLASH_SAVE_ADDR,(u32*)&device_info, sizeof(struct_device_info));
print("ID = %d\r\n", device_info.Device_id);
printf("Channle = %d\r\n", device_info.channel);
delay_ms(500);
}[/mw_shl_code]
FLASH_SAVE_ADDR这个改成什么都没用,读出来的数值要么就是255,要么就是一个常数,永远都不变 |