diff --git a/libraries/EEPROM/library.properties b/libraries/EEPROM/library.properties index 95e1e4ad86..2d8a7685ad 100644 --- a/libraries/EEPROM/library.properties +++ b/libraries/EEPROM/library.properties @@ -1,9 +1,9 @@ name=EEPROM -version=2.0 +version=2.0.1 author=Arduino, Christopher Andrews -maintainer=Arduino -sentence=Enables reading and writing to the permanent board storage. For all Arduino boards BUT Arduino DUE and Arduino ZERO. -paragraph= +maintainer=stm32duino +sentence=Enables reading and writing to the permanent board storage. +paragraph=This library allows to read and write data in a memory type, the EEPROM, that keeps its content also when the board is powered off. The amount of EEPROM available depends on the microcontroller type. category=Data Storage url=http://www.arduino.cc/en/Reference/EEPROM architectures=stm32 diff --git a/libraries/EEPROM/EEPROM.h b/libraries/EEPROM/src/EEPROM.h similarity index 94% rename from libraries/EEPROM/EEPROM.h rename to libraries/EEPROM/src/EEPROM.h index d1ecbfa56e..0c029f8202 100644 --- a/libraries/EEPROM/EEPROM.h +++ b/libraries/EEPROM/src/EEPROM.h @@ -25,7 +25,7 @@ /*** EERef class. - + This object references an EEPROM cell. Its purpose is to mimic a typical byte of RAM, however its storage is the EEPROM. This class has an overhead of two bytes, similar to storing a pointer to an EEPROM cell. @@ -35,11 +35,11 @@ struct EERef{ EERef( const int index ) : index( index ) {} - + //Access/read members. uint8_t operator*() const { return eeprom_read_byte( /*(uint8_t*)*/ index ); } - operator const uint8_t() const { return **this; } - + operator uint8_t() const { return **this; } + //Assignment/write members. EERef &operator=( const EERef &ref ) { return *this = *ref; } EERef &operator=( uint8_t in ) { return eeprom_write_byte( /*(uint8_t*)*/ index, in ), *this; } @@ -53,32 +53,32 @@ struct EERef{ EERef &operator |=( uint8_t in ) { return *this = **this | in; } EERef &operator <<=( uint8_t in ) { return *this = **this << in; } EERef &operator >>=( uint8_t in ) { return *this = **this >> in; } - + EERef &update( uint8_t in ) { return in != *this ? *this = in : *this; } - + /** Prefix increment/decrement **/ EERef& operator++() { return *this += 1; } EERef& operator--() { return *this -= 1; } - + /** Postfix increment/decrement **/ - uint8_t operator++ (int){ + uint8_t operator++ (int){ uint8_t ret = **this; return ++(*this), ret; } - uint8_t operator-- (int){ + uint8_t operator-- (int){ uint8_t ret = **this; return --(*this), ret; } - + int index; //Index of current EEPROM cell. }; /*** EEPtr class. - + This object is a bidirectional pointer to EEPROM cells represented by EERef objects. - Just like a normal pointer type, this can be dereferenced and repositioned using + Just like a normal pointer type, this can be dereferenced and repositioned using increment/decrement operators. ***/ @@ -86,14 +86,14 @@ struct EEPtr{ EEPtr( const int index ) : index( index ) {} - - operator const int() const { return index; } + + operator int() const { return index; } EEPtr &operator=( int in ) { return index = in, *this; } - + //Iterator functionality. bool operator!=( const EEPtr &ptr ) { return index != ptr.index; } EERef operator*() { return index; } - + /** Prefix & Postfix increment/decrement **/ EEPtr& operator++() { return ++index, *this; } EEPtr& operator--() { return --index, *this; } @@ -105,7 +105,7 @@ struct EEPtr{ /*** EEPROMClass class. - + This object represents the entire EEPROM space. It wraps the functionality of EEPtr and EERef into a basic interface. This class is also 100% backwards compatible with earlier Arduino core releases. @@ -118,12 +118,12 @@ struct EEPROMClass{ uint8_t read( int idx ) { return EERef( idx ); } void write( int idx, uint8_t val ) { (EERef( idx )) = val; } void update( int idx, uint8_t val ) { EERef( idx ).update( val ); } - + //STL and C++11 iteration capability. EEPtr begin() { return 0x00; } EEPtr end() { return length(); } //Standards requires this to be the item after the last valid entry. The returned pointer is invalid. uint16_t length() { return E2END; } - + //Functionality to 'get' and 'put' objects to and from EEPROM. template< typename T > T &get( int idx, T &t ){ EEPtr e = idx; @@ -131,7 +131,7 @@ struct EEPROMClass{ for( int count = sizeof(T) ; count ; --count, ++e ) *ptr++ = *e; return t; } - + template< typename T > const T &put( int idx, const T &t ){ EEPtr e = idx; const uint8_t *ptr = (const uint8_t*) &t;