aboutsummaryrefslogtreecommitdiff
path: root/libraries/EEPROM/EEPROM.h
diff options
context:
space:
mode:
authorChris--A <chris@genx.biz>2015-03-19 17:13:32 +1000
committerChris--A <chris@genx.biz>2015-03-19 17:13:32 +1000
commitfd4323f360885725c736c90745ee57dbca20e8a0 (patch)
tree34b56149fb0c46a4b59366fab0fd1600dd755da8 /libraries/EEPROM/EEPROM.h
parentc9ec4eabdab373c756a624f42660acaf0ec6812d (diff)
Small tweaks to EEPROM lib and examples.
Diffstat (limited to 'libraries/EEPROM/EEPROM.h')
-rw-r--r--libraries/EEPROM/EEPROM.h30
1 files changed, 9 insertions, 21 deletions
diff --git a/libraries/EEPROM/EEPROM.h b/libraries/EEPROM/EEPROM.h
index ae2645e..cde75db 100644
--- a/libraries/EEPROM/EEPROM.h
+++ b/libraries/EEPROM/EEPROM.h
@@ -92,28 +92,16 @@ struct EEPtr{
operator const 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( this->index ); }
-
+ EERef operator*() { return index; }
- /** Prefix increment/decrement **/
+ /** Prefix & Postfix increment/decrement **/
EEPtr& operator++() { return ++index, *this; }
EEPtr& operator--() { return --index, *this; }
-
-
- /** Postfix increment/decrement **/
- EEPtr operator++ (int){
- int ret = index;
- return ++index, ret;
- }
+ EEPtr operator++ (int) { return index++; }
+ EEPtr operator-- (int) { return index--; }
- EEPtr operator-- (int){
- int ret = index;
- return --index, ret;
- }
-
int index; //Index of current EEPROM cell.
};
@@ -128,15 +116,15 @@ struct EEPtr{
struct EEPROMClass{
//Basic user access methods.
- EERef operator[]( const int index ) { return( index ); }
- uint8_t read( int idx ) { return (EERef( idx )); }
+ EERef operator[]( const int idx ) { return idx; }
+ 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 + 1; }
+ 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 + 1; }
//Functionality to 'get' and 'put' objects to and from EEPROM.
template< typename T > T &get( int idx, T &t ){