uint8_t addr; uint8_t s,t; uint16_t b; addr = dtuParameter.bus_addr; memset(encoding.pdata,0,8); EEPROM_READ(BLE_DTU_PARAMETER_NVID,&dtuParameter,sizeof(dtuParameter)); Data_flash[0] = dtuParameter.humi; Data_flash[1] = dtuParameter.temp; Data[0] = dtuParameter.baud; memcpy(Data + 1,dtuParameter.DEVICE_ID,10); Data[11] = dtuParameter.flag; //t = EEPROM_ERASE(BLE_DTU_PARAMETER_NVID,256); EEPROM_READ(BLE_DTU_PARAMETER_NVID,Test_Buf,256); for(b = 0;b < 10;b++) { PRINT("Test = %x \n",Test_Buf[b]); } // if(t == SUCCESS) { dtuParameter.bus_addr = decoding.pdata[0]; // dtuParameter.humi = Data_flash[0]; // dtuParameter.temp = Data_flash[1]; // dtuParameter.baud = Data[0]; // memcpy(dtuParameter.DEVICE_ID,Data + 1,10); // dtuParameter.flag = Data[11]; PRINT("bus_addr = %x\n humi = %d\n temp = %d\n baud = %x\n DEVICE_ID = %x\n flag = %x \n",dtuParameter.bus_addr,dtuParameter.humi,dtuParameter.temp,dtuParameter.baud,dtuParameter.DEVICE_ID,dtuParameter.flag); s = EEPROM_WRITE(BLE_DTU_PARAMETER_NVID,&dtuParameter,sizeof(dtuParameter)); if(s != SUCCESS) { encoding.pdata[0] = 1; dtuParameter.bus_addr = addr; } else { encoding.pdata[0] = 0; } encoding.num = 1; encoding.len = 8; send_flag = 0; dri_tick_mode = MODE_TICK_ENCODE; }
热门产品 :
CH397: 高集成度、低功耗USB网卡芯片