void read_frame_from_eeprom(uint8_t *frame) { eeprom_read_bytes(read_addr, FRAME_SIZE, frame); read_addr += FRAME_SIZE; if(read_addr + FRAME_SIZE > MAX_ADDR) read_addr = 0; }
void host_chip_id_read(uint8_t *dst, uint8_t len) { (void)eeprom_read_bytes(&host_addr_i2c, 0, dst, len); dst[0] = 0x11; dst[1] = 0x22; dst[2] = 0x33; dst[3] = 0x44; return; }
void IOToaster::loadConfiguration() { // Server port eeprom_read_bytes(2, (byte *)&_serverPort, sizeof(int)); // Server Address _serverIp = ""; int addr = sizeof(int) + 3; char c; do { c = eeprom_read_byte((unsigned char *)addr++); if (c != 0) _serverIp += c; } while (c != 0 && addr < 50); }
void eeprom_read(uint32_t addr,uint16_t num,uint8_t *p_data) { #ifdef SPIMARM eeprom_status = 1; SPIMRAM_ReadBuffer(p_data, addr, num); #else u16 temp_addr; u16 temp_num; eeprom_status = 1; if(addr&0x10000) { SEL_CHIP2; temp_addr = (addr&0xffff); temp_num = num; eeprom_read_bytes(temp_addr,temp_num,p_data); }else if((addr + num)&0x10000) { SEL_CHIP1; temp_addr = (addr&0xffff); temp_num = 0x10000 - temp_addr; eeprom_read_bytes(temp_addr,temp_num,p_data); SEL_CHIP2; eeprom_read_bytes(0,num-temp_num,p_data+temp_num); }else { SEL_CHIP1; temp_addr = (addr&0xffff); temp_num = num; eeprom_read_bytes(temp_addr,temp_num,p_data); } #endif eeprom_status = 0; if(wait_eeprom_idle == 1) { wait_eeprom_idle = 0; } }
int32_t pairing_list_addr_read(uint8_t rx_num, uint8_t *addr) { uint8_t eeprom_addr; if (rx_num >= PAIRING_LIST_MAX_ADDR_NUM) { printf("[%s, L%d] rx num(%d) excess max.\r\n", __FILE__, __LINE__, rx_num); return -1; } eeprom_addr = PAIRING_LIST_ADDR_LEN * rx_num; (void)eeprom_read_bytes(&eeprom_i2c, eeprom_addr, addr, PAIRING_LIST_ADDR_LEN); return 0; }
// // Reads an integer value at the specified address. // Returns true if the variable is successfully read. // Returns false if the specified address is outside the // allowed range or too close to the maximum vlaue // to hold all of the bytes (an int variable requires // more than one byte). // boolean EepromUtil::eeprom_read_int(int addr, int* value) { return (eeprom_read_bytes(addr, (byte*)value, sizeof(int))); }
void SkynetClient::getUuid(char *uuid) { eeprom_read_bytes(UUIDADDRESS, uuid, UUIDSIZE); uuid[UUIDSIZE-1]='\0'; //in case courrupted or not defined }
void SkynetClient::getToken(char *token) { eeprom_read_bytes(TOKENADDRESS, token, TOKENSIZE); token[TOKENSIZE-1]='\0'; //in case courrupted or not defined }