Skip to content

Add get and put functions to EEPROM #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 19, 2015
Merged

Add get and put functions to EEPROM #80

merged 3 commits into from
Apr 19, 2015

Conversation

boybundit
Copy link
Contributor

As available in http://www.arduino.cc/en/Reference/EEPROM
https://github.com/arduino/Arduino/tree/master/hardware/arduino/avr/libraries/EEPROM

EEPROM.get(address, data)
Read any data type or object from the EEPROM.

EEPROM.put(address, data)
Write any data type or object to the EEPROM.

Both functions return a reference to the object passed in.

return t;

uint8_t *ptr = (uint8_t*) &t;
for(int count = 0; count < sizeof(T); ++count) *ptr++ = _data[address + count];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just use memcpy(ptr, _data + address, count); here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated accordingly.

igrr added a commit that referenced this pull request Apr 19, 2015
Add get and put functions to EEPROM
@igrr igrr merged commit 1a233d6 into esp8266:esp8266 Apr 19, 2015
igrr added a commit that referenced this pull request Oct 29, 2015
Add get and put functions to EEPROM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants