Koduino
Public Member Functions | List of all members
EEPROMClass Class Reference

EEPROM library (call with global object EEPROM) More...

#include <EEPROM.h>

Detailed Description

EEPROM library (call with global object EEPROM)

Authors
Avik De avikd.nosp@m.e@gm.nosp@m.ail.c.nosp@m.om

This file is part of koduino https://github.com/avikde/koduino

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, see http://www.gnu.org/licenses/.

This class allows storing data / parameters in non-volatile memory that you may not want to hard-code in the source file, e.g. the zero-position for a motor. Note: unlike Arduino, in which each address corresponds to a byte, here each address from 0-31 corresponds to a 32-bit value (convenient for ints and floats).

Usage

  1. Call EEPROMClass::write() to store, and EEPROMClass::read() to retrieve values

Example: Write/read

#include <EEPROM.h>
void setup() {
Serial1.begin(115200);
EEPROM.write(0, 123);
EEPROM.write(1, 456);
}
void loop() {
Serial1 << "Expect 123, 456; read " << EEPROM.read(0) << ", " << EEPROM.read(1) << "\n";
delay(1000);
}

Public Member Functions

uint16_t read (uint16_t address)
 Read a 16-bit integer from EEPROM. More...
 
void write (uint16_t address, uint16_t data)
 Store a 16-bit integer in EEPROM. More...
 

Member Function Documentation

uint16_t EEPROMClass::read ( uint16_t  address)

Read a 16-bit integer from EEPROM.

Parameters
addressAddress between 0 and 31
Returns
void EEPROMClass::write ( uint16_t  address,
uint16_t  value 
)

Store a 16-bit integer in EEPROM.

Parameters
addressAddress between 0 and 31
value

The documentation for this class was generated from the following files: