diff --git a/libraries/EEPROM/examples/Apollo_EEPROM/Apollo_EEPROM.ino b/libraries/EEPROM/examples/Apollo_EEPROM/Apollo_EEPROM.ino new file mode 100644 index 0000000..a1418ed --- /dev/null +++ b/libraries/EEPROM/examples/Apollo_EEPROM/Apollo_EEPROM.ino @@ -0,0 +1,167 @@ +/* + Reading and writing test of the EEPROM functions on the Artemis + By: Nathan Seidle + SparkFun Electronics + Date: June 24th, 2019 + This example code is in the public domain. + + SparkFun labored with love to create this code. Feel like supporting open source hardware? + Buy a board from SparkFun! https://www.sparkfun.com/products/15376 + + Page erase takes 15ms + Write byte takes 30ms - This is much longer than Arduino that takes 3.3ms + Float write across two words takes 30ms + Update (no write) takes 1ms +*/ + +#include + +void setup() +{ + Serial.begin(9600); + Serial.println("EEPROM Examples"); + + randomSeed(analogRead(A0)); + + long startTime; + long endTime; + uint16_t randomLocation; + + //Test erase time + startTime = millis(); + EEPROM.erase(); + endTime = millis(); + Serial.printf("Time to erase all EEPROM: %dms\n", endTime - startTime); + + //Byte sequential test + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + Serial.println(""); + Serial.println("8 bit tests"); + byte myValue1 = 200; + byte myValue2 = 23; + randomLocation = random(0, FLASH_EEPROM_SIZE); + + startTime = millis(); + EEPROM.write(randomLocation, myValue1); //(location, data) + endTime = millis(); + EEPROM.put(randomLocation + 1, myValue2); + + Serial.printf("Write byte time: %dms\n", endTime - startTime); + + byte response1 = EEPROM.read(randomLocation); + byte response2 = EEPROM.read(randomLocation + 1); + Serial.printf("Location %d should be %d: %d\n\r", randomLocation, myValue1, response1); + Serial.printf("Location %d should be %d: %d\n\r", randomLocation + 1, myValue2, response2); + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + Serial.println(""); + Serial.println("16 bit tests"); + + //int16_t and uint16_t sequential test + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + uint16_t myValue3 = 3411; + int16_t myValue4 = -366; + randomLocation = random(0, FLASH_EEPROM_SIZE); + + EEPROM.put(randomLocation, myValue3); + EEPROM.put(randomLocation + 2, myValue4); + + uint16_t response3; + int16_t response4; + EEPROM.get(randomLocation, response3); + EEPROM.get(randomLocation + 2, response4); + Serial.printf("Location %d should be %d: %d\n\r", randomLocation, myValue3, response3); + Serial.printf("Location %d should be %d: %d\n\r", randomLocation + 2, myValue4, response4); + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + Serial.println(""); + Serial.println("32 bit tests"); + + //int and unsigned int (32) sequential test + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + Serial.printf("Size of int: %d\n", sizeof(int)); + int myValue5 = -245000; + unsigned int myValue6 = 400123; + randomLocation = random(0, FLASH_EEPROM_SIZE); + + EEPROM.put(randomLocation, myValue5); + EEPROM.put(randomLocation + 4, myValue6); + + int response5; + unsigned int response6; + EEPROM.get(randomLocation, response5); + EEPROM.get(randomLocation + 4, response6); + Serial.printf("Location %d should be %d: %d\n\r", randomLocation, myValue5, response5); + Serial.printf("Location %d should be %d: %d\n\r", randomLocation + 4, myValue6, response6); + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + //int32_t and uint32_t sequential test + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + int32_t myValue7 = -341002; + uint32_t myValue8 = 241544; + randomLocation = random(0, FLASH_EEPROM_SIZE); + + EEPROM.update(randomLocation, myValue7); + EEPROM.update(randomLocation + 4, myValue8); + + int32_t response7; + uint32_t response8; + EEPROM.get(randomLocation, response7); + EEPROM.get(randomLocation + 4, response8); + Serial.printf("Location %d should be %d: %d\n\r", randomLocation, myValue7, response7); + Serial.printf("Location %d should be %d: %d\n\r", randomLocation + 4, myValue8, response8); + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + //float (32) sequential test + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + Serial.printf("Size of float: %d\n", sizeof(float)); + float myValue9 = -7.35; + float myValue10 = 5.22; + randomLocation = random(0, FLASH_EEPROM_SIZE); + + EEPROM.update(randomLocation, myValue9); + EEPROM.update(randomLocation + 4, myValue10); + + float response9; + float response10; + EEPROM.get(randomLocation, response9); + EEPROM.get(randomLocation + 4, response10); + Serial.printf("Location %d should be %f: %f\n\r", randomLocation, myValue9, response9); + Serial.printf("Location %d should be %f: %f\n\r", randomLocation + 4, myValue10, response10); + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + Serial.println(""); + Serial.println("64 bit tests"); + + //double (64) sequential test + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + Serial.printf("Size of double: %d\n", sizeof(double)); + double myValue11 = -290.3485723409857; + double myValue12 = 384.95734987; + randomLocation = random(0, FLASH_EEPROM_SIZE); + + EEPROM.update(randomLocation, myValue11); + EEPROM.update(randomLocation + 8, myValue12); + + double response11; + double response12; + EEPROM.get(randomLocation, response11); + EEPROM.get(randomLocation + 8, response12); + Serial.printf("Location %d should be %lf: %lf\n", randomLocation, myValue11, response11); + Serial.printf("Location %d should be %lf: %lf\n", randomLocation + 8, myValue12, response12); + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + Serial.println(); + Serial.print("Flash Contents:"); + for (uint16_t x = 0; x < 8 * 4; x += 4) + { + if (x % 32 == 0) + Serial.println(); + Serial.printf("0x%08X ", *(uint32_t *)(FLASH_EEPROM_START + x)); + } + Serial.println(); +} + +void loop() +{ +} \ No newline at end of file diff --git a/libraries/EEPROM/keywords.txt b/libraries/EEPROM/keywords.txt new file mode 100644 index 0000000..7987e9b --- /dev/null +++ b/libraries/EEPROM/keywords.txt @@ -0,0 +1,23 @@ +####################################### +# Syntax Coloring Map +####################################### + +####################################### +# Datatypes (KEYWORD1) +####################################### + +EEPROM KEYWORD1 + +####################################### +# Methods and Functions (KEYWORD2) +####################################### +read KEYWORD2 +write KEYWORD2 +get KEYWORD2 +put KEYWORD2 +update KEYWORD2 +erase KEYWORD2 + +####################################### +# Constants (LITERAL1) +####################################### diff --git a/libraries/EEPROM/library.properties b/libraries/EEPROM/library.properties new file mode 100644 index 0000000..3559ba4 --- /dev/null +++ b/libraries/EEPROM/library.properties @@ -0,0 +1,9 @@ +name=EEPROM +version=1.0 +author=SparkFun Electronics +maintainer=SparkFun Electronics +sentence=Flash based Pseudo EEPROM for Artemis +paragraph=Enables the writing of variables to a protected section of flash. These bytes will not be overwritten when new sketches are loaded and are useful when needing to record settings like calibration data or GPS waypoints that should not change between sketch updates. +category=Communication +url=http://www.arduino.cc/en/Reference/EEPROM +architectures=apollo3 diff --git a/libraries/EEPROM/src/EEPROM.cpp b/libraries/EEPROM/src/EEPROM.cpp new file mode 100644 index 0000000..034dc41 --- /dev/null +++ b/libraries/EEPROM/src/EEPROM.cpp @@ -0,0 +1,319 @@ +/* + This is a library written for the SparkFun Artemis + + SparkFun sells these at its website: www.sparkfun.com + Do you like this library? Help support open source hardware. Buy a board! + https://www.sparkfun.com/products/15332 + https://www.sparkfun.com/products/15376 + https://www.sparkfun.com/products/15411 + https://www.sparkfun.com/products/15412 + + Written by Nathan Seidle @ SparkFun Electronics, June 16th, 2019 + + Pseudo-EEPROM on the Cortex-M4F + + https://github.com/sparkfun/SparkFun_Apollo3 + + There is no EEPROM built into the Apollo3 Cortex-M4F but we have 1M of flash + so we carve out the last 8k of flash for EEPROM space. Pages are erased in + 8k chunks so 8k of EEPROM works. + + Flash is 0x00 to 0xFF000. EEPROM writes will start at 0xFF000 - 8192 = 0xF2000. + + Page erase takes 15ms + Writing a byte takes 30ms + Writing a float across two words takes 30ms + Update (no write) takes 1ms + + Development environment specifics: + Arduino IDE 1.8.x + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "EEPROM.h" +#include "Arduino.h" + +//Constructor +ap3_EEPROM::ap3_EEPROM() +{ +} + +//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +//Write a byte to a given "EEPROM" location +//Automatically masks user's byte into flash without +//affecting other bytes in this flash word +void ap3_EEPROM::write(uint16_t eepromLocation, uint8_t dataToWrite) +{ + uint32_t flashLocation = FLASH_EEPROM_START + eepromLocation; + writeWordToFlash(flashLocation, (uint32_t)dataToWrite | 0xFFFFFF00); +} + +//Read a byte from a given location in "EEPROM" +uint8_t ap3_EEPROM::read(uint16_t eepromLocation) +{ + uint32_t flashLocation = FLASH_EEPROM_START + eepromLocation; + return (*(uint8_t *)flashLocation); +} + +//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +//Get method is overloaded with the following variable types +//char, byte, int, unsigned int, long, unsigned long, float, double? + +void ap3_EEPROM::get(uint16_t eepromLocation, uint8_t &dataToGet) +{ + dataToGet = *(uint8_t *)(FLASH_EEPROM_START + eepromLocation); +} +void ap3_EEPROM::get(uint16_t eepromLocation, uint16_t &dataToGet) +{ + dataToGet = *(uint16_t *)(FLASH_EEPROM_START + eepromLocation); +} +void ap3_EEPROM::get(uint16_t eepromLocation, int16_t &dataToGet) +{ + dataToGet = *(int16_t *)(FLASH_EEPROM_START + eepromLocation); +} +void ap3_EEPROM::get(uint16_t eepromLocation, int &dataToGet) +{ + dataToGet = *(int *)(FLASH_EEPROM_START + eepromLocation); +} +void ap3_EEPROM::get(uint16_t eepromLocation, unsigned int &dataToGet) +{ + dataToGet = *(unsigned int *)(FLASH_EEPROM_START + eepromLocation); +} +void ap3_EEPROM::get(uint16_t eepromLocation, int32_t &dataToGet) +{ + dataToGet = *(int32_t *)(FLASH_EEPROM_START + eepromLocation); +} +void ap3_EEPROM::get(uint16_t eepromLocation, uint32_t &dataToGet) +{ + dataToGet = *(uint32_t *)(FLASH_EEPROM_START + eepromLocation); +} +void ap3_EEPROM::get(uint16_t eepromLocation, float &dataToGet) +{ + union { + float f; + uint32_t b; + } temp; + temp.b = *(uint32_t *)(FLASH_EEPROM_START + eepromLocation); + + dataToGet = temp.f; +} + +void ap3_EEPROM::get(uint16_t eepromLocation, double &dataToGet) +{ + union { + double lf; + uint32_t b[2]; + } temp; + temp.b[1] = *(uint32_t *)(FLASH_EEPROM_START + eepromLocation); //LSB; + temp.b[0] = *(uint32_t *)(FLASH_EEPROM_START + eepromLocation + 4) << 32; //MSB; + dataToGet = temp.lf; +} + +//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +//Put method is overloaded with the following variable types +//char, byte, int, unsigned int, long, unsigned long, float, double? + +void ap3_EEPROM::put(uint16_t eepromLocation, uint8_t dataToWrite) +{ + writeWordToFlash((FLASH_EEPROM_START + eepromLocation), (uint32_t)dataToWrite | 0xFFFFFF00); +} +void ap3_EEPROM::put(uint16_t eepromLocation, uint16_t dataToWrite) +{ + writeWordToFlash((FLASH_EEPROM_START + eepromLocation), (uint32_t)dataToWrite | 0xFFFF0000); +} +void ap3_EEPROM::put(uint16_t eepromLocation, int16_t dataToWrite) +{ + writeWordToFlash((FLASH_EEPROM_START + eepromLocation), (uint32_t)dataToWrite | 0xFFFF0000); +} +void ap3_EEPROM::put(uint16_t eepromLocation, int dataToWrite) //ints are 32 bit on M4F +{ + writeWordToFlash((FLASH_EEPROM_START + eepromLocation), (uint32_t)dataToWrite); +} +void ap3_EEPROM::put(uint16_t eepromLocation, unsigned int dataToWrite) //ints are 32 bit on M4F +{ + writeWordToFlash((FLASH_EEPROM_START + eepromLocation), (uint32_t)dataToWrite); +} +void ap3_EEPROM::put(uint16_t eepromLocation, int32_t dataToWrite) +{ + writeWordToFlash((FLASH_EEPROM_START + eepromLocation), (int32_t)dataToWrite); +} +void ap3_EEPROM::put(uint16_t eepromLocation, uint32_t dataToWrite) +{ + writeWordToFlash((FLASH_EEPROM_START + eepromLocation), (uint32_t)dataToWrite); +} +void ap3_EEPROM::put(uint16_t eepromLocation, float dataToWrite) +{ + union { + float f; + uint32_t b; + } temp; + temp.f = dataToWrite; + + writeWordToFlash((FLASH_EEPROM_START + eepromLocation), (uint32_t)temp.b); +} + +void ap3_EEPROM::put(uint16_t eepromLocation, double dataToWrite) //64 bits +{ + union { + double lf; + uint32_t b[2]; + } temp; + temp.lf = dataToWrite; + + writeWordToFlash((FLASH_EEPROM_START + eepromLocation), (uint32_t)temp.b[1]); //LSB + writeWordToFlash((FLASH_EEPROM_START + eepromLocation + 4), (uint32_t)temp.b[0]); //MSB +} + +//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +//The update functions simply call the put functions +//Put automatically checks to see if a spot needs updating +void ap3_EEPROM::update(uint16_t eepromLocation, uint8_t dataToWrite) +{ + put(eepromLocation, dataToWrite); +} +void ap3_EEPROM::update(uint16_t eepromLocation, uint16_t dataToWrite) +{ + put(eepromLocation, dataToWrite); +} +void ap3_EEPROM::update(uint16_t eepromLocation, int16_t dataToWrite) +{ + put(eepromLocation, dataToWrite); +} +void ap3_EEPROM::update(uint16_t eepromLocation, int dataToWrite) //ints are 32 bit on M4F +{ + put(eepromLocation, dataToWrite); +} +void ap3_EEPROM::update(uint16_t eepromLocation, unsigned int dataToWrite) //ints are 32 bit on M4F +{ + put(eepromLocation, dataToWrite); +} +void ap3_EEPROM::update(uint16_t eepromLocation, int32_t dataToWrite) +{ + put(eepromLocation, dataToWrite); +} +void ap3_EEPROM::update(uint16_t eepromLocation, uint32_t dataToWrite) +{ + put(eepromLocation, dataToWrite); +} +void ap3_EEPROM::update(uint16_t eepromLocation, float dataToWrite) +{ + put(eepromLocation, dataToWrite); +} +void ap3_EEPROM::update(uint16_t eepromLocation, double dataToWrite) //64 bits +{ + put(eepromLocation, dataToWrite); +} + +//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +//Erase 8k page encapsulating the EEPROM section +void ap3_EEPROM::erase() +{ + am_hal_flash_page_erase(AM_HAL_FLASH_PROGRAM_KEY, + AM_HAL_FLASH_ADDR2INST(FLASH_EEPROM_START), + AM_HAL_FLASH_ADDR2PAGE(FLASH_EEPROM_START)); +} + +//This is the main helper function +//Reprogram a given location with 32-bits +//Flash is written to in words at locations that are %4=0 +//Span words if necessary +//1) Make copy of current flash contents into SRAM +//2) Turn user's requested spot into 0xFFs +//3) Erase flash page (8k) +//4) Write SRAM back into flash +//5) Write user's data onto the spot with recently created 0xFFs +//Note - this code assumes EEPROM temp space is contained in one page +void ap3_EEPROM::writeWordToFlash(uint32_t flashLocation, uint32_t dataToWrite) +{ + //Error check + if (flashLocation >= FLASH_EEPROM_START + FLASH_EEPROM_SIZE) + { + return; + } + if (flashLocation < FLASH_EEPROM_START) + { + return; + } + + //Check to see if location needs updating + if (*(uint32_t *)(flashLocation) == dataToWrite) + { + return; + } + + //First we have to read the contents of current "EEPROM" to SRAM + uint32_t tempContents[FLASH_EEPROM_SIZE / 4]; + uint16_t spot = 0; + for (uint16_t x = 0; x < FLASH_EEPROM_SIZE; x += 4) + { + tempContents[spot++] = *(uint32_t *)(FLASH_EEPROM_START + x); + } + + //Then we erase an 8K page + am_hal_flash_page_erase(AM_HAL_FLASH_PROGRAM_KEY, + AM_HAL_FLASH_ADDR2INST(flashLocation), + AM_HAL_FLASH_ADDR2PAGE(flashLocation)); + + //Zero out this word(s) + uint8_t byteOffset = (flashLocation % 4); + uint16_t wordLocation = (flashLocation - FLASH_EEPROM_START) / 4; + if (byteOffset == 0) + { + //Easy - reset this word to 1s + tempContents[wordLocation] = 0xFFFFFFFF; + } + else + { + //Reset the upper bytes of the first word to 1s + tempContents[wordLocation] |= 0xFFFFFFFF << (byteOffset * 8); + + //Reset the lower bytes of the second word to 1s + tempContents[wordLocation + 1] |= 0xFFFFFFFF >> ((4 - byteOffset) * 8); + } + + //Then we write the contents of the array back + am_hal_flash_program_main(AM_HAL_FLASH_PROGRAM_KEY, + tempContents, + (uint32_t *)FLASH_EEPROM_START, + FLASH_EEPROM_SIZE); + + if (byteOffset == 0) + { + //Easy - update this word with new word + am_hal_flash_reprogram_ui32(AM_HAL_FLASH_PROGRAM_KEY, + dataToWrite, + (uint32_t *)flashLocation); + } + else + { + //Update the upper bytes of this word with new data + uint32_t dataToWriteFirstWord = dataToWrite << (byteOffset * 8); + dataToWriteFirstWord |= 0xFFFFFFFF >> ((4 - byteOffset) * 8); + + //Update the lower bytes of the following word with new data + uint32_t dataToWriteSecondWord = dataToWrite >> ((4 - byteOffset) * 8); + dataToWriteSecondWord |= 0xFFFFFFFF << (byteOffset * 8); + + am_hal_flash_reprogram_ui32(AM_HAL_FLASH_PROGRAM_KEY, + dataToWriteFirstWord, + (uint32_t *)(flashLocation - byteOffset)); + + am_hal_flash_reprogram_ui32(AM_HAL_FLASH_PROGRAM_KEY, + dataToWriteSecondWord, + (uint32_t *)(flashLocation + (4 - byteOffset))); + } +} + +ap3_EEPROM EEPROM; \ No newline at end of file diff --git a/libraries/EEPROM/src/EEPROM.h b/libraries/EEPROM/src/EEPROM.h new file mode 100644 index 0000000..603e1fd --- /dev/null +++ b/libraries/EEPROM/src/EEPROM.h @@ -0,0 +1,137 @@ +/* + This is a library written for the SparkFun Artemis + + SparkFun sells these at its website: www.sparkfun.com + Do you like this library? Help support open source hardware. Buy a board! + https://www.sparkfun.com/products/15332 + https://www.sparkfun.com/products/15376 + https://www.sparkfun.com/products/15411 + https://www.sparkfun.com/products/15412 + + Written by Nathan Seidle @ SparkFun Electronics, June 16th, 2019 + + Pseudo-EEPROM on the Cortex-M4F + + https://github.com/sparkfun/SparkFun_Apollo3 + + There is no EEPROM built into the Apollo3 Cortex-M4F but we have 1M of flash + so we carve out the last 8k of flash for EEPROM space. Pages are erased in + 8k chunks so 8k of EEPROM works. + + Flash is 0x00 to 0xFFFFF. We will do EEPROM writes in the last page of flash: + 0xFFFFF - 8192 = 0xFDFFF. Pages start on 8192 bytes so EEPROM section will start + at 0xFE000; + + Page erase takes 15ms + Writing a byte takes 30ms + Writing a float across two words takes 30ms + Update (no write) takes 1ms + + Development environment specifics: + Arduino IDE 1.8.x + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _EEPROM_H +#define _EEPROM_H +#include "Arduino.h" + +//EEPROM is arbitrarily located at 0xFE000. This will avoid things that use the +//user code space from 0xC000 to 0xFE000. +//The SparkFun Apollo3 linker script has been modified to limit user code space to less than 0xFE000 + +#define FLASH_EEPROM_START 0xFE000 + +#if FLASH_EEPROM_START % 8192 +Error : EEPROM start address must be divisble by 8192 +#endif + +//By limiting EEPROM size to 1024, we reduce the amount of SRAM required and +//time needed to mask in individual bytes and words into flash. It can be increased +//to 8096 if needed +#define FLASH_EEPROM_SIZE 1024 + + //class TwoWire : public Stream, public IOMaster{} + + class ap3_EEPROM +{ +public: + ap3_EEPROM(); + + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + //8 bit + uint8_t read(uint16_t eepromLocation); + void write(uint16_t eepromLocation, uint8_t dataToWrite); + void get(uint16_t eepromLocation, uint8_t &dataToGet); + + //16 bit + void get(uint16_t eepromLocation, uint16_t &dataToGet); + void get(uint16_t eepromLocation, int16_t &dataToGet); + + //32 bit + void get(uint16_t eepromLocation, int &dataToGet); + void get(uint16_t eepromLocation, unsigned int &dataToGet); + void get(uint16_t eepromLocation, int32_t &dataToGet); + void get(uint16_t eepromLocation, uint32_t &dataToGet); + void get(uint16_t eepromLocation, float &dataToGet); + + //64 bit + void get(uint16_t eepromLocation, double &dataToGet); + + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + //8 bit + void put(uint16_t eepromLocation, uint8_t dataToWrite); + + //16 bit + void put(uint16_t eepromLocation, uint16_t dataToWrite); + void put(uint16_t eepromLocation, int16_t dataToWrite); + + // 32 bit + void put(uint16_t eepromLocation, int dataToWrite); + void put(uint16_t eepromLocation, unsigned int dataToWrite); + void put(uint16_t eepromLocation, int32_t dataToWrite); + void put(uint16_t eepromLocation, uint32_t dataToWrite); + void put(uint16_t eepromLocation, float dataToWrite); + + //64 bit + void put(uint16_t eepromLocation, double dataToWrite); + + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + //8 bit + void update(uint16_t eepromLocation, uint8_t dataToWrite); + + //16 bit + void update(uint16_t eepromLocation, uint16_t dataToWrite); + void update(uint16_t eepromLocation, int16_t dataToWrite); + + // 32 bit + void update(uint16_t eepromLocation, int dataToWrite); + void update(uint16_t eepromLocation, unsigned int dataToWrite); + void update(uint16_t eepromLocation, int32_t dataToWrite); + void update(uint16_t eepromLocation, uint32_t dataToWrite); + void update(uint16_t eepromLocation, float dataToWrite); + + //64 bit + void update(uint16_t eepromLocation, double dataToWrite); + + //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + + void erase(); //Erase entire EEPROM + +private: + void writeWordToFlash(uint32_t flashLocation, uint32_t dataToWrite); +}; + +extern ap3_EEPROM EEPROM; + +#endif