Quantcast
Channel: Arduino Forum - Latest topics
Viewing all articles
Browse latest Browse all 15404

EEPROM put with part of an array

$
0
0

A simple EEPROM library question ...

I have data being sent to me as array of bytes.

byte data[6] = {0x10, 0x00, 0x1A, 0x1B, 0x1C, 0x1D};
//	DATABYTE0 = High memory address
//	DATABYTE1 = LOW memory address
//	DATABYTE2 = memory databyte1 to write
//	DATABYTE3 = memory databyte2 to write
//	DATABYTE4 = memory databyte3 to write
//	DATABYTE5 = memory databyte4 to write

I want to write the last 4 bytes into EEPROM at the address indicated by the first two bytes. So some psuedo code ...

  // get the destination address, will be 0x1000
  uint16_t address = data[0] << 8 + data[1];

  EEPROM.put(address, ??);

Do I need to copy the last 4 bytes of can I somehow have some type of struct that only accesses those last 4 bytes ?

Or just old school and iterate over the last 4 bytes and use EEPROM.update ?

6 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 15404

Trending Articles