diff --git a/extras/Documentation/html/_e_e_p_r_o_m_var_8h_source.html b/extras/Documentation/html/_e_e_p_r_o_m_var_8h_source.html index 644fb12..44de0d3 100644 --- a/extras/Documentation/html/_e_e_p_r_o_m_var_8h_source.html +++ b/extras/Documentation/html/_e_e_p_r_o_m_var_8h_source.html @@ -141,7 +141,7 @@ diff --git a/extras/Documentation/html/_e_e_p_r_o_mex_8h_source.html b/extras/Documentation/html/_e_e_p_r_o_mex_8h_source.html index 6875b8f..0c0039e 100644 --- a/extras/Documentation/html/_e_e_p_r_o_mex_8h_source.html +++ b/extras/Documentation/html/_e_e_p_r_o_mex_8h_source.html @@ -84,148 +84,152 @@ 00028 #include <inttypes.h> 00029 #include <avr/eeprom.h> 00030 -00031 // Boards with ATmega328, Duemilanove, Uno, UnoSMD, Lilypad - 1024 bytes (1 kilobyte) -00032 // Boards with ATmega1280 or 2560, Arduino Mega series – 4096 bytes (4 kilobytes) -00033 // Boards with ATmega168, Lilypad, old Nano, Diecimila – 512 bytes (1/2 kilobyte) -00034 -00035 #define EEPROMSizeATmega168 512 -00036 #define EEPROMSizeATmega328 1024 -00037 #define EEPROMSizeATmega1280 4096 -00038 #define EEPROMSizeATmega32u4 1024 -00039 #define EEPROMSizeAT90USB1286 4096 -00040 #define EEPROMSizeMK20DX128 2048 -00041 -00042 #define EEPROMSizeUno EEPROMSizeATmega328 -00043 #define EEPROMSizeUnoSMD EEPROMSizeATmega328 -00044 #define EEPROMSizeLilypad EEPROMSizeATmega328 -00045 #define EEPROMSizeDuemilanove EEPROMSizeATmega328 -00046 #define EEPROMSizeMega EEPROMSizeATmega1280 -00047 #define EEPROMSizeDiecimila EEPROMSizeATmega168 -00048 #define EEPROMSizeNano EEPROMSizeATmega168 -00049 #define EEPROMSizeTeensy2 EEPROMSizeATmega32u4 -00050 #define EEPROMSizeLeonardo EEPROMSizeATmega32u4 -00051 #define EEPROMSizeMicro EEPROMSizeATmega32u4 -00052 #define EEPROMSizeYun EEPROMSizeATmega32u4 -00053 #define EEPROMSizeTeensy2pp EEPROMSizeAT90USB1286 -00054 #define EEPROMSizeTeensy3 EEPROMSizeMK20DX128 -00055 -00056 class EEPROMClassEx -00057 { -00058 -00059 public: -00060 EEPROMClassEx(); -00061 bool isReady(); -00062 int writtenBytes(); -00063 void setMemPool(int base, int memSize); -00064 void setMaxAllowedWrites(int allowedWrites); -00065 int getAddress(int noOfBytes); -00066 -00067 uint8_t read(int); -00068 bool readBit(int, byte); -00069 uint8_t readByte(int); -00070 uint16_t readInt(int); -00071 uint32_t readLong(int); -00072 float readFloat(int); -00073 double readDouble(int); -00074 -00075 bool write(int, uint8_t); -00076 bool writeBit(int , uint8_t, bool); -00077 bool writeByte(int, uint8_t); -00078 bool writeInt(int, uint16_t); -00079 bool writeLong(int, uint32_t); -00080 bool writeFloat(int, float); -00081 bool writeDouble(int, double); -00082 -00083 bool update(int, uint8_t); -00084 bool updateBit(int , uint8_t, bool); -00085 bool updateByte(int, uint8_t); -00086 bool updateInt(int, uint16_t); -00087 bool updateLong(int, uint32_t); -00088 bool updateFloat(int, float); -00089 bool updateDouble(int, double); -00090 -00091 -00092 // Use template for other data formats -00093 -00097 template <class T> int readBlock(int address, const T value[], int items) -00098 { -00099 unsigned int i; -00100 for (i = 0; i < (unsigned int)items; i++) -00101 readBlock<T>(address+(i*sizeof(T)),value[i]); -00102 return i; -00103 } -00104 -00108 template <class T> int readBlock(int address, const T& value) -00109 { -00110 eeprom_read_block((void*)&value, (const void*)address, sizeof(value)); -00111 return sizeof(value); -00112 } -00113 -00117 template <class T> int writeBlock(int address, const T value[], int items) -00118 { -00119 if (!isWriteOk(address+items*sizeof(T))) return 0; -00120 unsigned int i; -00121 for (i = 0; i < (unsigned int)items; i++) -00122 writeBlock<T>(address+(i*sizeof(T)),value[i]); -00123 return i; -00124 } -00125 -00129 template <class T> int writeBlock(int address, const T& value) -00130 { -00131 if (!isWriteOk(address+sizeof(value))) return 0; -00132 eeprom_write_block((void*)&value, (void*)address, sizeof(value)); -00133 return sizeof(value); -00134 } -00135 -00140 template <class T> int updateBlock(int address, const T value[], int items) -00141 { -00142 int writeCount=0; -00143 if (!isWriteOk(address+items*sizeof(T))) return 0; -00144 unsigned int i; -00145 for (i = 0; i < (unsigned int)items; i++) -00146 writeCount+= updateBlock<T>(address+(i*sizeof(T)),value[i]); -00147 return writeCount; -00148 } -00149 -00154 template <class T> int updateBlock(int address, const T& value) -00155 { -00156 int writeCount=0; -00157 if (!isWriteOk(address+sizeof(value))) return 0; -00158 const byte* bytePointer = (const byte*)(const void*)&value; -00159 for (unsigned int i = 0; i < (unsigned int)sizeof(value); i++) { -00160 if (read(address)!=*bytePointer) { -00161 write(address, *bytePointer); -00162 writeCount++; -00163 } -00164 address++; -00165 bytePointer++; -00166 } -00167 return writeCount; -00168 } -00169 -00170 -00171 -00172 private: -00173 //Private variables -00174 static int _base; -00175 static int _memSize; -00176 static int _nextAvailableaddress; -00177 static int _writeCounts; -00178 int _allowedWrites; -00179 bool checkWrite(int base,int noOfBytes); -00180 bool isWriteOk(int address); -00181 bool isReadOk(int address); -00182 }; -00183 -00184 extern EEPROMClassEx EEPROM; -00185 -00186 #endif -00187 +00031 +00032 #define EEPROMSizeATmega168 512 +00033 #define EEPROMSizeATmega328 1024 +00034 #define EEPROMSizeATmega1280 4096 +00035 #define EEPROMSizeATmega32u4 1024 +00036 #define EEPROMSizeAT90USB1286 4096 +00037 #define EEPROMSizeMK20DX128 2048 +00038 #define EEPROMSizeMK20DX256 2048 +00039 #define EEPROMSizeATSAMD21G18 16384 +00040 +00041 #define EEPROMSizeUno EEPROMSizeATmega328 +00042 #define EEPROMSizeUnoSMD EEPROMSizeATmega328 +00043 #define EEPROMSizeLilypad EEPROMSizeATmega328 +00044 #define EEPROMSizeDuemilanove EEPROMSizeATmega328 +00045 #define EEPROMSizePro EEPROMSizeATmega328 +00046 #define EEPROMSizeFio EEPROMSizeATmega328 +00047 #define EEPROMSizeMega EEPROMSizeATmega1280 +00048 #define EEPROMSizeDiecimila EEPROMSizeATmega168 +00049 #define EEPROMSizeNano EEPROMSizeATmega168 +00050 #define EEPROMSizeTeensy2 EEPROMSizeATmega32u4 +00051 #define EEPROMSizeLeonardo EEPROMSizeATmega32u4 +00052 #define EEPROMSizeMicro EEPROMSizeATmega32u4 +00053 #define EEPROMSizeEsplora EEPROMSizeATmega32u4 +00054 #define EEPROMSizeYun EEPROMSizeATmega32u4 +00055 #define EEPROMSizeTre EEPROMSizeATmega32u4 +00056 #define EEPROMSizeZero EEPROMSizeATSAMD21G18 +00057 #define EEPROMSizeTeensy2pp EEPROMSizeAT90USB1286 +00058 #define EEPROMSizeTeensy3 EEPROMSizeMK20DX128 +00059 #define EEPROMSizeTeensy31 EEPROMSizeMK20DX256 +00060 class EEPROMClassEx +00061 { +00062 +00063 public: +00064 EEPROMClassEx(); +00065 bool isReady(); +00066 int writtenBytes(); +00067 void setMemPool(int base, int memSize); +00068 void setMaxAllowedWrites(int allowedWrites); +00069 int getAddress(int noOfBytes); +00070 +00071 uint8_t read(int); +00072 bool readBit(int, byte); +00073 uint8_t readByte(int); +00074 uint16_t readInt(int); +00075 uint32_t readLong(int); +00076 float readFloat(int); +00077 double readDouble(int); +00078 +00079 bool write(int, uint8_t); +00080 bool writeBit(int , uint8_t, bool); +00081 bool writeByte(int, uint8_t); +00082 bool writeInt(int, uint16_t); +00083 bool writeLong(int, uint32_t); +00084 bool writeFloat(int, float); +00085 bool writeDouble(int, double); +00086 +00087 bool update(int, uint8_t); +00088 bool updateBit(int , uint8_t, bool); +00089 bool updateByte(int, uint8_t); +00090 bool updateInt(int, uint16_t); +00091 bool updateLong(int, uint32_t); +00092 bool updateFloat(int, float); +00093 bool updateDouble(int, double); +00094 +00095 +00096 // Use template for other data formats +00097 +00101 template <class T> int readBlock(int address, const T value[], int items) +00102 { +00103 unsigned int i; +00104 for (i = 0; i < (unsigned int)items; i++) +00105 readBlock<T>(address+(i*sizeof(T)),value[i]); +00106 return i; +00107 } +00108 +00112 template <class T> int readBlock(int address, const T& value) +00113 { +00114 eeprom_read_block((void*)&value, (const void*)address, sizeof(value)); +00115 return sizeof(value); +00116 } +00117 +00121 template <class T> int writeBlock(int address, const T value[], int items) +00122 { +00123 if (!isWriteOk(address+items*sizeof(T))) return 0; +00124 unsigned int i; +00125 for (i = 0; i < (unsigned int)items; i++) +00126 writeBlock<T>(address+(i*sizeof(T)),value[i]); +00127 return i; +00128 } +00129 +00133 template <class T> int writeBlock(int address, const T& value) +00134 { +00135 if (!isWriteOk(address+sizeof(value))) return 0; +00136 eeprom_write_block((void*)&value, (void*)address, sizeof(value)); +00137 return sizeof(value); +00138 } +00139 +00144 template <class T> int updateBlock(int address, const T value[], int items) +00145 { +00146 int writeCount=0; +00147 if (!isWriteOk(address+items*sizeof(T))) return 0; +00148 unsigned int i; +00149 for (i = 0; i < (unsigned int)items; i++) +00150 writeCount+= updateBlock<T>(address+(i*sizeof(T)),value[i]); +00151 return writeCount; +00152 } +00153 +00158 template <class T> int updateBlock(int address, const T& value) +00159 { +00160 int writeCount=0; +00161 if (!isWriteOk(address+sizeof(value))) return 0; +00162 const byte* bytePointer = (const byte*)(const void*)&value; +00163 for (unsigned int i = 0; i < (unsigned int)sizeof(value); i++) { +00164 if (read(address)!=*bytePointer) { +00165 write(address, *bytePointer); +00166 writeCount++; +00167 } +00168 address++; +00169 bytePointer++; +00170 } +00171 return writeCount; +00172 } +00173 +00174 +00175 +00176 private: +00177 //Private variables +00178 static int _base; +00179 static int _memSize; +00180 static int _nextAvailableaddress; +00181 static int _writeCounts; +00182 int _allowedWrites; +00183 bool checkWrite(int base,int noOfBytes); +00184 bool isWriteOk(int address); +00185 bool isReadOk(int address); +00186 }; +00187 +00188 extern EEPROMClassEx EEPROM; +00189 +00190 #endif +00191 diff --git a/extras/Documentation/html/annotated.html b/extras/Documentation/html/annotated.html index e307911..6df930b 100644 --- a/extras/Documentation/html/annotated.html +++ b/extras/Documentation/html/annotated.html @@ -64,7 +64,7 @@ diff --git a/extras/Documentation/html/class_e_e_p_r_o_m_class_ex-members.html b/extras/Documentation/html/class_e_e_p_r_o_m_class_ex-members.html index 14be0b6..d01b713 100644 --- a/extras/Documentation/html/class_e_e_p_r_o_m_class_ex-members.html +++ b/extras/Documentation/html/class_e_e_p_r_o_m_class_ex-members.html @@ -94,7 +94,7 @@ diff --git a/extras/Documentation/html/class_e_e_p_r_o_m_class_ex.html b/extras/Documentation/html/class_e_e_p_r_o_m_class_ex.html index e245f9f..b734d42 100644 --- a/extras/Documentation/html/class_e_e_p_r_o_m_class_ex.html +++ b/extras/Documentation/html/class_e_e_p_r_o_m_class_ex.html @@ -955,7 +955,7 @@ diff --git a/extras/Documentation/html/class_e_e_p_r_o_m_var-members.html b/extras/Documentation/html/class_e_e_p_r_o_m_var-members.html index 82e6803..1c37d97 100644 --- a/extras/Documentation/html/class_e_e_p_r_o_m_var-members.html +++ b/extras/Documentation/html/class_e_e_p_r_o_m_var-members.html @@ -78,7 +78,7 @@ diff --git a/extras/Documentation/html/class_e_e_p_r_o_m_var.html b/extras/Documentation/html/class_e_e_p_r_o_m_var.html index e84ad0d..b69b6c2 100644 --- a/extras/Documentation/html/class_e_e_p_r_o_m_var.html +++ b/extras/Documentation/html/class_e_e_p_r_o_m_var.html @@ -113,7 +113,7 @@

template<typename T>
diff --git a/extras/Documentation/html/classes.html b/extras/Documentation/html/classes.html index 54c7eaf..ad844d3 100644 --- a/extras/Documentation/html/classes.html +++ b/extras/Documentation/html/classes.html @@ -69,7 +69,7 @@ diff --git a/extras/Documentation/html/files.html b/extras/Documentation/html/files.html index 205c886..6a4e9f8 100644 --- a/extras/Documentation/html/files.html +++ b/extras/Documentation/html/files.html @@ -62,7 +62,7 @@ diff --git a/extras/Documentation/html/functions.html b/extras/Documentation/html/functions.html index bd30fd0..883085a 100644 --- a/extras/Documentation/html/functions.html +++ b/extras/Documentation/html/functions.html @@ -180,7 +180,7 @@

- w -