Documentation error for EEPROM library

Documentation says default value for EEPROM.get() is “The default value of bytes in the EEPROM is 255 (hexadecimal 0xFF)”, while the code example uses 0xFFFF (65535) as the default. It is actually 0xFFFF just to let everyone know.

But you might have problems to cram 0xFFFF in one byte - but the docs talk about bytes since the EEPROM is first of all byte-organiced unlike the default 32bit layout for RAM variables and code and const var segment in flash.

You will only get 0xFFFF from EEPROM.get() when your target parameter is a two byte numeric, but if you retrieved a uint8_t you’d get 0xFF and for an int you’d get 0xFFFFFFFF.
But the statement that the default of each individual byte will be 0xFF holds true in any case :wink:

Hence the introductory comment to the sample

// EXAMPLE USAGE
// Read a value (2 bytes in this case) from EEPROM address

Ok that makes more sense. Documentation is still confusing though, should just be value with all bits set instead of just 255, correct?

Edit: just noticed that it goes on to say “Photon will return an object filled with 0xFF”. So i guess it does say that. Just tripped me up a little bit.

1 Like

No confusion there - all bits set in a single byte equals to 255 / 0xFF / 0b11111111.
Who wouldn’t know that would probably not get any wiser with the term “all bits set” either.


Just seen your edit :+1:

Yep, thanks for clarification.