├── extras ├── Documentation │ ├── html │ │ ├── bc_s.png │ │ ├── open.png │ │ ├── closed.png │ │ ├── doxygen.png │ │ ├── nav_f.png │ │ ├── nav_h.png │ │ ├── tab_a.png │ │ ├── tab_b.png │ │ ├── tab_h.png │ │ ├── tab_s.png │ │ ├── tabs.css │ │ ├── index.html │ │ ├── files.html │ │ ├── annotated.html │ │ ├── classes.html │ │ ├── class_e_e_p_r_o_m_var-members.html │ │ ├── functions_func.html │ │ ├── functions.html │ │ ├── class_e_e_p_r_o_m_var.html │ │ ├── _e_e_p_r_o_m_var_8h_source.html │ │ ├── class_e_e_p_r_o_m_class_ex-members.html │ │ ├── doxygen.css │ │ ├── _e_e_p_r_o_mex_8h_source.html │ │ └── class_e_e_p_r_o_m_class_ex.html │ └── Documentation.html └── EEPROM wear calculations.ods ├── library.properties ├── library.json ├── .travis.yml ├── LICENSE.md ├── keywords.txt ├── EEPROMVar.h ├── examples ├── EEPROMVar │ └── EEPROMVar.ino └── EEPROMEx │ └── EEPROMEx.ino ├── EEPROMex.h ├── README.md └── EEPROMex.cpp /extras/Documentation/html/bc_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thijse/Arduino-EEPROMEx/HEAD/extras/Documentation/html/bc_s.png -------------------------------------------------------------------------------- /extras/Documentation/html/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thijse/Arduino-EEPROMEx/HEAD/extras/Documentation/html/open.png -------------------------------------------------------------------------------- /extras/Documentation/html/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thijse/Arduino-EEPROMEx/HEAD/extras/Documentation/html/closed.png -------------------------------------------------------------------------------- /extras/Documentation/html/doxygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thijse/Arduino-EEPROMEx/HEAD/extras/Documentation/html/doxygen.png -------------------------------------------------------------------------------- /extras/Documentation/html/nav_f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thijse/Arduino-EEPROMEx/HEAD/extras/Documentation/html/nav_f.png -------------------------------------------------------------------------------- /extras/Documentation/html/nav_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thijse/Arduino-EEPROMEx/HEAD/extras/Documentation/html/nav_h.png -------------------------------------------------------------------------------- /extras/Documentation/html/tab_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thijse/Arduino-EEPROMEx/HEAD/extras/Documentation/html/tab_a.png -------------------------------------------------------------------------------- /extras/Documentation/html/tab_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thijse/Arduino-EEPROMEx/HEAD/extras/Documentation/html/tab_b.png -------------------------------------------------------------------------------- /extras/Documentation/html/tab_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thijse/Arduino-EEPROMEx/HEAD/extras/Documentation/html/tab_h.png -------------------------------------------------------------------------------- /extras/Documentation/html/tab_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thijse/Arduino-EEPROMEx/HEAD/extras/Documentation/html/tab_s.png -------------------------------------------------------------------------------- /extras/EEPROM wear calculations.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thijse/Arduino-EEPROMEx/HEAD/extras/EEPROM wear calculations.ods -------------------------------------------------------------------------------- /extras/Documentation/Documentation.html: -------------------------------------------------------------------------------- 1 |
Browse the EEPROMEx documentation
3 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=EEPROMEx 2 | version=1.0.0 3 | author=Thijs Elenbaas 4 | maintainer=Thijs Elenbaas 5 | sentence=Extension of the standard Arduino EEPROM library. 6 | paragraph=Extended for reading and writing basic types, structs, strings, arrays and more. 7 | category=Data Storage 8 | url=http://playground.arduino.cc/Code/EEPROMex 9 | architectures=* 10 | -------------------------------------------------------------------------------- /library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "EEPROMEx", 3 | "keywords": "eeprom", 4 | "description": "Extension of the standard Arduino EEPROM library for reading and writing basic types, structs, strings, arrays and more.", 5 | "authors": 6 | [ 7 | { 8 | "name": "Thijs Elenbaas" 9 | } 10 | ], 11 | "repository": 12 | { 13 | "type": "git", 14 | "url": "https://github.com/thijse/Arduino-EEPROMEx.git" 15 | }, 16 | "frameworks": "arduino" 17 | } 18 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | before_install: 3 | - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16" 4 | - sleep 3 5 | - export DISPLAY=:1.0 6 | - wget http://downloads.arduino.cc/arduino-1.8.1-linux64.tar.xz 7 | - tar xf arduino-1.8.1-linux64.tar.xz 8 | - sudo mv arduino-1.8.1 /usr/local/share/arduino 9 | - sudo ln -s /usr/local/share/arduino/arduino /usr/local/bin/arduino 10 | install: 11 | - ln -s $PWD /usr/local/share/arduino/libraries/EEPROMEx 12 | script: 13 | - arduino --verify --board arduino:avr:uno $PWD/examples/EEPROMEx/EEPROMEx.ino 14 | notifications: 15 | email: 16 | on_success: change 17 | on_failure: change 18 | 19 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # LGPL License 2 | -------------- 3 | Copyright (c) 2012 4 | Thijs Elenbaas 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -------------------------------------------------------------------------------- /keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For EEPROMEx 3 | ####################################### 4 | 5 | ####################################### 6 | # Methods and Functions EEPROMEx (KEYWORD2) 7 | ####################################### 8 | 9 | isReady KEYWORD2 10 | setMemPool KEYWORD2 11 | setMaxAllowedWrites KEYWORD2 12 | getAddress KEYWORD2 13 | 14 | read KEYWORD2 15 | readByte KEYWORD2 16 | readInt KEYWORD2 17 | readLong KEYWORD2 18 | readFloat KEYWORD2 19 | readDouble KEYWORD2 20 | readBlock KEYWORD2 21 | 22 | write KEYWORD2 23 | writeByte KEYWORD2 24 | writeInt KEYWORD2 25 | writeLong KEYWORD2 26 | writeFloat KEYWORD2 27 | writeDouble KEYWORD2 28 | writeBlock KEYWORD2 29 | 30 | update KEYWORD2 31 | updateByte KEYWORD2 32 | updateInt KEYWORD2 33 | updateLong KEYWORD2 34 | updateFloat KEYWORD2 35 | updateDouble KEYWORD2 36 | updateBlock KEYWORD2 37 | 38 | ####################################### 39 | # Instances (KEYWORD2) 40 | ####################################### 41 | 42 | EEPROMEx KEYWORD2 43 | 44 | ####################################### 45 | # Constants (LITERAL1) 46 | ####################################### 47 | 48 | -------------------------------------------------------------------------------- /extras/Documentation/html/tabs.css: -------------------------------------------------------------------------------- 1 | .tabs, .tabs2, .tabs3 { 2 | background-image: url('tab_b.png'); 3 | width: 100%; 4 | z-index: 101; 5 | font-size: 13px; 6 | } 7 | 8 | .tabs2 { 9 | font-size: 10px; 10 | } 11 | .tabs3 { 12 | font-size: 9px; 13 | } 14 | 15 | .tablist { 16 | margin: 0; 17 | padding: 0; 18 | display: table; 19 | } 20 | 21 | .tablist li { 22 | float: left; 23 | display: table-cell; 24 | background-image: url('tab_b.png'); 25 | line-height: 36px; 26 | list-style: none; 27 | } 28 | 29 | .tablist a { 30 | display: block; 31 | padding: 0 20px; 32 | font-weight: bold; 33 | background-image:url('tab_s.png'); 34 | background-repeat:no-repeat; 35 | background-position:right; 36 | color: #283A5D; 37 | text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); 38 | text-decoration: none; 39 | outline: none; 40 | } 41 | 42 | .tabs3 .tablist a { 43 | padding: 0 10px; 44 | } 45 | 46 | .tablist a:hover { 47 | background-image: url('tab_h.png'); 48 | background-repeat:repeat-x; 49 | color: #fff; 50 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); 51 | text-decoration: none; 52 | } 53 | 54 | .tablist li.current a { 55 | background-image: url('tab_a.png'); 56 | background-repeat:repeat-x; 57 | color: #fff; 58 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); 59 | } 60 | -------------------------------------------------------------------------------- /extras/Documentation/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 ||
25 | EEPROMEx
26 | 1.0.0
27 |
28 | EEPROMEX is an extension of the standard Arduino EEPROM library for reading and writing basic types, structs, strings, arrays and more.
29 | |
30 |
31 |
32 |
33 |
58 | 1.7.6.1
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/EEPROMVar.h:
--------------------------------------------------------------------------------
1 | #include |
25 | EEPROMEx
26 | 1.0.0
27 |
28 | EEPROMEX is an extension of the standard Arduino EEPROM library for reading and writing basic types, structs, strings, arrays and more.
29 | |
30 |
31 |
32 |
33 |
| D:/My Documents/Github/Arduino/Own Arduino libraries/EEPROMEx/Arduino-EEPROMEx/EEPROMex.h [code] | |
| D:/My Documents/Github/Arduino/Own Arduino libraries/EEPROMEx/Arduino-EEPROMEx/EEPROMVar.h [code] |
67 | 1.7.6.1
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/extras/Documentation/html/annotated.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | |
25 | EEPROMEx
26 | 1.0.0
27 |
28 | EEPROMEX is an extension of the standard Arduino EEPROM library for reading and writing basic types, structs, strings, arrays and more.
29 | |
30 |
31 |
32 |
33 |
| EEPROMClassEx | |
| EEPROMVar< T > |
69 | 1.7.6.1
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/extras/Documentation/html/classes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | |
25 | EEPROMEx
26 | 1.0.0
27 |
28 | EEPROMEX is an extension of the standard Arduino EEPROM library for reading and writing basic types, structs, strings, arrays and more.
29 | |
30 |
31 |
32 |
33 |
74 | 1.7.6.1
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/extras/Documentation/html/class_e_e_p_r_o_m_var-members.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | |
25 | EEPROMEx
26 | 1.0.0
27 |
28 | EEPROMEX is an extension of the standard Arduino EEPROM library for reading and writing basic types, structs, strings, arrays and more.
29 | |
30 |
31 |
32 |
33 |
| address (defined in EEPROMVar< T >) | EEPROMVar< T > | [protected] |
| EEPROMVar(T init) (defined in EEPROMVar< T >) | EEPROMVar< T > | [inline] |
| getAddress() (defined in EEPROMVar< T >) | EEPROMVar< T > | [inline] |
| operator T() (defined in EEPROMVar< T >) | EEPROMVar< T > | [inline] |
| operator*=(V multiplicator) (defined in EEPROMVar< T >) | EEPROMVar< T > | [inline] |
| operator++(int) (defined in EEPROMVar< T >) | EEPROMVar< T > | [inline] |
| operator++() (defined in EEPROMVar< T >) | EEPROMVar< T > | [inline] |
| operator+=(T val) (defined in EEPROMVar< T >) | EEPROMVar< T > | [inline] |
| operator--(int) (defined in EEPROMVar< T >) | EEPROMVar< T > | [inline] |
| operator--() (defined in EEPROMVar< T >) | EEPROMVar< T > | [inline] |
| operator-=(T val) (defined in EEPROMVar< T >) | EEPROMVar< T > | [inline] |
| operator/=(V divisor) (defined in EEPROMVar< T >) | EEPROMVar< T > | [inline] |
| operator=(T val) (defined in EEPROMVar< T >) | EEPROMVar< T > | [inline] |
| restore() (defined in EEPROMVar< T >) | EEPROMVar< T > | [inline] |
| save() (defined in EEPROMVar< T >) | EEPROMVar< T > | [inline] |
| update() (defined in EEPROMVar< T >) | EEPROMVar< T > | [inline] |
| var (defined in EEPROMVar< T >) | EEPROMVar< T > | [protected] |
83 | 1.7.6.1
84 |
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/EEPROMex.h:
--------------------------------------------------------------------------------
1 | /*
2 | EEPROMEx.h - Extended EEPROM library
3 | Copyright (c) 2012 Thijs Elenbaas. All right reserved.
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) any later version.
9 |
10 | This library is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | Lesser General Public License for more details.
14 |
15 | You should have received a copy of the GNU Lesser General Public
16 | License along with this library; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 | */
19 |
20 | #ifndef EEPROMEX_h
21 | #define EEPROMEX_h
22 |
23 | #if ARDUINO >= 100
24 | #include |
25 | EEPROMEx
26 | 1.0.0
27 |
28 | EEPROMEX is an extension of the standard Arduino EEPROM library for reading and writing basic types, structs, strings, arrays and more.
29 | |
30 |
31 |
32 |
33 |
185 | 1.7.6.1
186 |
187 |
188 |
189 |
190 |
--------------------------------------------------------------------------------
/extras/Documentation/html/functions.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | |
25 | EEPROMEx
26 | 1.0.0
27 |
28 | EEPROMEX is an extension of the standard Arduino EEPROM library for reading and writing basic types, structs, strings, arrays and more.
29 | |
30 |
31 |
32 |
33 |
185 | 1.7.6.1
186 |
187 |
188 |
189 |
190 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Arduino EEPROMEx library
2 | [](https://travis-ci.org/thijse/Arduino-EEPROMEx)
3 | [](https://img.shields.io/badge/License-LGPL%20v2.1-blue.svg)
4 |
5 | The EEPROMex library is an extension of the standard Arduino EEPROM library. It extends the functionality of the original Arduino EEPROM library with:
6 |
7 | * Reading, writing to basic types. This includes bytes, longs, ints, floats and doubles.
8 | * Reading, writing to single bits. This helps efficient usage of the limited EEPROM memory.
9 | * Reading, writing of any data format. This can be for example structs, strings, etc.
10 | * Reading, writing of arrays of any format. By storing, for example, arrays of structs one can create a database like structure.
11 | * Update functions. The function similar to write functions, but only update changed bytes. If structures have only changed partly, updating instead of writing can save a lot EEPROM wear and significantly increase speed.
12 | * Basic memory allocation functionality. This is basically a counter of the first unallocated byte, and helps giving unique addresses to variables.
13 | * Enabling write limitation: In theory one can burn out a memory cell in a few minutes: a write/erase cycle takes approximately 4 ms, so writing 100.000 times to a single cell takes 6 1/2 min. Limiting the number of writes during the debug phase helps prevent this.
14 | * Debugging of writing out of memory range.
15 |
16 |
17 | And find detailed explanation and samples of the functionality here:
18 | [http://thijs.elenbaas.net/2012/07/extended-eeprom-library-for-arduino](http://thijs.elenbaas.net/2012/07/extended-eeprom-library-for-arduino)
19 |
20 | ## Downloading
21 |
22 | This package can be downloaded in different manners
23 |
24 |
25 | - The Arduino Library Manager: [see here how to use it](http://www.arduino.cc/en/guide/libraries#toc3).
26 | - The PlatformIO Library Manager: [see here how to use it](http://docs.platformio.org/en/latest/ide/arduino.html).
27 | - By directly loading fetching the Archive from GitHub:
28 | 1. Go to [https://github.com/thijse/Arduino-EEPROMEx](https://github.com/thijse/Arduino-EEPROMEx)
29 | 2. Click the DOWNLOAD ZIP button in the panel on the
30 | 3. Rename the uncompressed folder **Arduino-EEPROMEx-master** to **EEPROMEx**.
31 | 4. You may need to create the libraries subfolder if its your first library.
32 | 5. Place the **EEPROMEx** library folder in your **arduinosketchfolder/libraries/** folder.
33 | 5. Restart the IDE.
34 | 6. For more information, [read this extended manual](http://thijs.elenbaas.net/2012/07/installing-an-arduino-library/)
35 | - If you want to have a package that includes all referenced libraries, use the pre-packaged library
36 | 1. Download the package as a zipfile [here](https://github.com/thijse/Zipballs/blob/master/EEPROMEx/EEPROMEx.zip?raw=true) or as a tarball [here ](https://github.com/thijse/Zipballs/blob/master/EEPROMEx/EEPROMEx.tar.gz?raw=true).
37 | 2. Copy the folders inside the **libraries** folder to you your **arduinosketchfolder/libraries/** folder.
38 | 3. Restart the IDE.
39 | 3. For more information, [read this extended manual](http://thijs.elenbaas.net/2012/07/installing-an-arduino-library/)
40 |
41 |
42 |
43 | ### Using different data formats
44 |
45 | The aim of the library is to also support other standard data types: it currently implements writing and reading to int, long, float and double.
46 |
47 | ### For reading:
48 | ```
49 | uint8_t read(int address);
50 | bool readBit(int address, byte bit)
51 | uint8_t readByte(int address);
52 | uint16_t readInt(int address);
53 | uint32_t readLong(int address);
54 | float readFloat(int address);
55 | double readDouble(int address);
56 | ```
57 |
58 | Where address is the starting position in EEPROM, and the return value the value read from EEPROM.
59 |
60 | ### For writing:
61 | ```
62 | bool write(int address, uint8_t value);
63 | bool writeByte(int address, uint8_t value);
64 | bool writeInt(int address, uint16_t value);
65 | bool writeLong(int address, uint32_t value);
66 | bool writeFloat(int address, float value);
67 | bool writeDouble(int address, double value);
68 | ```
69 | The update functions are different from the write functions: they will check per byte if the current value differs and only update the the cell with a different value. This will not only reduce wear, and can also significantly reduce write time.
70 |
71 | ```
72 | bool update(int address, uint8_t value);
73 | bool updateByte(int address, uint8_t value);
74 | bool updateInt(int address, uint16_t value);
75 | bool updateLong(int address, uint32_t value);
76 | bool updateFloat(int address, float value);
77 | bool updateDouble(int address, double);
78 | ```
79 |
80 | ### Manipulating Single bits
81 |
82 | The following functions implements reading and writing single bits:
83 |
84 | ```
85 | bool readBit(int address, byte bit)
86 | ```
87 | Where bit is the write position in the byte, ranging from [0..7], with bit 0 being the right-most. The return value is the read bit.
88 |
89 | ```
90 | bool writeBit(int address, uint8_t bit, bool value)
91 | bool updateBit(int address, uint8_t bit, bool value)
92 | ```
93 |
94 | ### Data blocks
95 |
96 | Using the block functions any data can be read, written and updated:
97 |
98 | ```
99 | int readBlock(int address, const T& value)
100 | int writeBlock(int address, const T& value)
101 | int updateBlock(int address, const T& value)
102 | ```
103 |
104 | where T is the type of the data to read/write/update. This can be a basic type, but also a more complex type like a struct. The return value gives the number of bytes that have been read, written or updated.
105 |
106 | One can also read/write arrays of data-blocks:
107 |
108 | ```
109 | int readBlock(int address, const T[]; value, int items)
110 | int writeBlock(int address, const T[]; value, int items)
111 | int updateBlock(int address, const T[]; value, int items)
112 | ```
113 |
114 | ### Debugging EEPROM applications
115 |
116 | It is easy to burn out a memory cell in few minutes, so during debugging it would be very useful to limit the number of allowed writes. It is easy to put a bracket at the wrong location, and placing an EEPROM write inside of a loop, rather than outside, and introduce extensive writing causing wear. The following function helps limit the number of writes.
117 |
118 | ```
119 | setMaxAllowedWrites(int allowedWrites);
120 | ```
121 |
122 | More writes than allowed will be refused and result in an error message. You can also set the address range used by the library:
123 |
124 | ```
125 | setMemPool(int base, int memSize);
126 | ```
127 |
128 | The lower value is used by the getAddress function, the upper value is used for setting the EEPROM size. Writing outside the maximum size will result in an error message. The following EEPROM sizes are predefined
129 |
130 | Based on processor:
131 | ```
132 | *EEPROMSizeATmega168
133 | *EEPROMSizeATmega328
134 | *EEPROMSizeATmega1280
135 | *EEPROMSizeATmega32u4
136 | *EEPROMSizeAT90USB1286
137 | *EEPROMSizeMK20DX128
138 | ```
139 | Based on board:
140 | ```
141 | *EEPROMSizeUno
142 | *EEPROMSizeUnoSMD
143 | *EEPROMSizeLilypad
144 | *EEPROMSizeDuemilanove
145 | *EEPROMSizeMega
146 | *EEPROMSizeDiecimila
147 | *EEPROMSizeNano
148 | *EEPROMSizeTeensy2
149 | *EEPROMSizeLeonardo
150 | *EEPROMSizeMicro
151 | *EEPROMSizeYun
152 | *EEPROMSizeTeensy2pp
153 | *EEPROMSizeTeensy3
154 | ```
155 |
156 | ### EEPROM performance
157 |
158 | All of the read/write functions make sure the EEPROM is ready to be accessed. Since this may cause a delay of max 4ms, time-critical applications should first poll the EEPROM e. g. using the isReady function before attempting any actual I/O:
159 |
160 | ```
161 | bool isReady();
162 | ```
163 |
164 | ## On using and modifying libraries
165 |
166 | - [http://www.arduino.cc/en/Main/Libraries](http://www.arduino.cc/en/Main/Libraries)
167 | - [http://www.arduino.cc/en/Reference/Libraries](http://www.arduino.cc/en/Reference/Libraries)
168 |
169 |
170 | ## Copyright
171 |
172 | EEPROMEx is provided Copyright © 2013-2017 under LGPL License.
173 |
--------------------------------------------------------------------------------
/extras/Documentation/html/class_e_e_p_r_o_m_var.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | |
25 | EEPROMEx
26 | 1.0.0
27 |
28 | EEPROMEX is an extension of the standard Arduino EEPROM library for reading and writing basic types, structs, strings, arrays and more.
29 | |
30 |
31 |
32 |
33 |
66 | Public Member Functions | |
| 68 | | EEPROMVar (T init) |
| 70 | | operator T () |
| 72 | EEPROMVar & | operator= (T val) |
| 74 | void | operator+= (T val) |
| 76 | void | operator-= (T val) |
| 78 | void | operator++ (int) |
| 80 | void | operator-- (int) |
| 82 | void | operator++ () |
| 84 | void | operator-- () |
| 86 | template<typename V > | |
| void | operator/= (V divisor) |
| 89 | template<typename V > | |
| void | operator*= (V multiplicator) |
| 92 | void | save () |
| 94 | void | update () |
| 96 | int | getAddress () |
| 98 | void | restore () |
100 | Protected Attributes | |
| 102 | T | var |
| 104 | int | address |
118 | 1.7.6.1
119 |
120 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/extras/Documentation/html/_e_e_p_r_o_m_var_8h_source.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | |
25 | EEPROMEx
26 | 1.0.0
27 |
28 | EEPROMEX is an extension of the standard Arduino EEPROM library for reading and writing basic types, structs, strings, arrays and more.
29 | |
30 |
31 |
32 |
33 |
00001 #include <EEPROMex.h> 58 | 00002 59 | 00003 /* 60 | 00004 EEPROMvar.h - EEPROM variable library 61 | 00005 Copyright (c) 2012 Thijs Elenbaas. All right reserved. 62 | 00006 63 | 00007 based on class by AlphaBeta 64 | 00008 65 | 00009 This library is free software; you can redistribute it and/or 66 | 00010 modify it under the terms of the GNU Lesser General Public 67 | 00011 License as published by the Free Software Foundation; either 68 | 00012 version 2.1 of the License, or (at your option) any later version. 69 | 00013 70 | 00014 This library is distributed in the hope that it will be useful, 71 | 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 72 | 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 73 | 00017 Lesser General Public License for more details. 74 | 00018 75 | 00019 You should have received a copy of the GNU Lesser General Public 76 | 00020 License along with this library; if not, write to the Free Software 77 | 00021 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 78 | 00022 */ 79 | 00023 80 | 00024 template<typename T> class EEPROMVar 81 | 00025 { 82 | 00026 public: 83 | 00027 EEPROMVar(T init) { 84 | 00028 address = EEPROM.getAddress(sizeof(T)); 85 | 00029 var = init; 86 | 00030 } 87 | 00031 operator T () { 88 | 00032 return var; 89 | 00033 } 90 | 00034 EEPROMVar &operator=(T val) { 91 | 00035 var = val; 92 | 00036 return *this; 93 | 00037 } 94 | 00038 95 | 00039 void operator+=(T val) { 96 | 00040 var += T(val); 97 | 00041 } 98 | 00042 void operator-=(T val) { 99 | 00043 var -= T(val); 100 | 00044 } 101 | 00045 void operator++(int) { 102 | 00046 var += T(1); 103 | 00047 } 104 | 00048 void operator--(int) { 105 | 00049 var -= T(1); 106 | 00050 } 107 | 00051 void operator++() { 108 | 00052 var += T(1); 109 | 00053 } 110 | 00054 void operator--() { 111 | 00055 var -= T(1); 112 | 00056 } 113 | 00057 template<typename V> 114 | 00058 void operator /= (V divisor) { 115 | 00059 var = var / divisor; 116 | 00060 } 117 | 00061 template<typename V> 118 | 00062 void operator *= (V multiplicator) { 119 | 00063 var = var * multiplicator; 120 | 00064 } 121 | 00065 void save(){ 122 | 00066 EEPROM.writeBlock<T>(address, var); 123 | 00067 } 124 | 00068 125 | 00069 void update(){ 126 | 00070 EEPROM.updateBlock<T>(address, var); 127 | 00071 } 128 | 00072 129 | 00073 int getAddress(){ 130 | 00074 return address; 131 | 00075 } 132 | 00076 133 | 00077 void restore(){ 134 | 00078 EEPROM.readBlock<T>(address, var); 135 | 00079 } 136 | 00080 protected: 137 | 00081 T var; 138 | 00082 int address; 139 | 00083 }; 140 |
146 | 1.7.6.1
147 |
148 |
149 |
150 |
151 |
--------------------------------------------------------------------------------
/extras/Documentation/html/class_e_e_p_r_o_m_class_ex-members.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | |
25 | EEPROMEx
26 | 1.0.0
27 |
28 | EEPROMEX is an extension of the standard Arduino EEPROM library for reading and writing basic types, structs, strings, arrays and more.
29 | |
30 |
31 |
32 |
33 |
| EEPROMClassEx() (defined in EEPROMClassEx) | EEPROMClassEx | |
| getAddress(int noOfBytes) | EEPROMClassEx | |
| isReady() | EEPROMClassEx | |
| read(int) | EEPROMClassEx | |
| readBit(int, byte) | EEPROMClassEx | |
| readBlock(int address, const T value[], int items) | EEPROMClassEx | [inline] |
| readBlock(int address, const T &value) | EEPROMClassEx | [inline] |
| readByte(int) | EEPROMClassEx | |
| readDouble(int) | EEPROMClassEx | |
| readFloat(int) | EEPROMClassEx | |
| readInt(int) | EEPROMClassEx | |
| readLong(int) | EEPROMClassEx | |
| setMaxAllowedWrites(int allowedWrites) | EEPROMClassEx | |
| setMemPool(int base, int memSize) | EEPROMClassEx | |
| update(int, uint8_t) | EEPROMClassEx | |
| updateBit(int, uint8_t, bool) | EEPROMClassEx | |
| updateBlock(int address, const T value[], int items) | EEPROMClassEx | [inline] |
| updateBlock(int address, const T &value) | EEPROMClassEx | [inline] |
| updateByte(int, uint8_t) | EEPROMClassEx | |
| updateDouble(int, double) | EEPROMClassEx | |
| updateFloat(int, float) | EEPROMClassEx | |
| updateInt(int, uint16_t) | EEPROMClassEx | |
| updateLong(int, uint32_t) | EEPROMClassEx | |
| write(int, uint8_t) | EEPROMClassEx | |
| writeBit(int, uint8_t, bool) | EEPROMClassEx | |
| writeBlock(int address, const T value[], int items) | EEPROMClassEx | [inline] |
| writeBlock(int address, const T &value) | EEPROMClassEx | [inline] |
| writeByte(int, uint8_t) | EEPROMClassEx | |
| writeDouble(int, double) | EEPROMClassEx | |
| writeFloat(int, float) | EEPROMClassEx | |
| writeInt(int, uint16_t) | EEPROMClassEx | |
| writeLong(int, uint32_t) | EEPROMClassEx | |
| writtenBytes() (defined in EEPROMClassEx) | EEPROMClassEx |
99 | 1.7.6.1
100 |
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/EEPROMex.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | EEPROMEx.cpp - Extended EEPROM library
3 | Copyright (c) 2012 Thijs Elenbaas. All right reserved.
4 |
5 | This library is free software; you can redistribute it and/or
6 | modify it under the terms of the GNU Lesser General Public
7 | License as published by the Free Software Foundation; either
8 | version 2.1 of the License, or (at your option) any later version.
9 |
10 | This library is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | Lesser General Public License for more details.
14 |
15 | You should have received a copy of the GNU Lesser General Public
16 | License along with this library; if not, write to the Free Software
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 | */
19 |
20 | /******************************************************************************
21 | * Includes
22 | ******************************************************************************/
23 | #include "EEPROMex.h"
24 |
25 | /******************************************************************************
26 | * Definitions
27 | ******************************************************************************/
28 |
29 | #define _EEPROMEX_VERSION 1_0_0 // software version of this library
30 | //#define _EEPROMEX_DEBUG // Enables logging of maximum of writes and out-of-memory
31 | /******************************************************************************
32 | * Constructors
33 | ******************************************************************************/
34 |
35 | // Boards with ATmega328, Duemilanove, Uno, Uno SMD, Lilypad - 1024 bytes (1 kilobyte)
36 | // Boards with ATmega1280 or 2560, Arduino Mega series – 4096 bytes (4 kilobytes)
37 | // Boards with ATmega168, Lilypad, old Nano, Diecimila – 512 bytes
38 | // By default we choose conservative settings
39 | EEPROMClassEx::EEPROMClassEx()
40 | : _allowedWrites(100)
41 | {
42 | }
43 |
44 | /******************************************************************************
45 | * User API
46 | ******************************************************************************/
47 |
48 | /**
49 | * Set starting position and memory size that EEPROMEx may manage
50 | */
51 | void EEPROMClassEx::setMemPool(int base, int memSize) {
52 | //Base can only be adjusted if no addresses have already been issued
53 | if (_nextAvailableaddress == _base)
54 | _base = base;
55 | _nextAvailableaddress=_base;
56 |
57 | //Ceiling can only be adjusted if not below issued addresses
58 | if (memSize >= _nextAvailableaddress )
59 | _memSize = memSize;
60 |
61 | #ifdef _EEPROMEX_DEBUG
62 | if (_nextAvailableaddress != _base)
63 | Serial.println("Cannot change base, addresses have been issued");
64 |
65 | if (memSize < _nextAvailableaddress )
66 | Serial.println("Cannot change ceiling, below issued addresses");
67 | #endif
68 |
69 | }
70 |
71 | /**
72 | * Set global maximum of allowed writes
73 | */
74 | void EEPROMClassEx::setMaxAllowedWrites(int allowedWrites) {
75 | #ifdef _EEPROMEX_DEBUG
76 | _allowedWrites = allowedWrites;
77 | #endif
78 | }
79 |
80 | /**
81 | * Get a new starting address to write to. Adress is negative if not enough space is available
82 | */
83 | int EEPROMClassEx::getAddress(int noOfBytes){
84 | int availableaddress = _nextAvailableaddress;
85 | _nextAvailableaddress += noOfBytes;
86 |
87 | #ifdef _EEPROMEX_DEBUG
88 | if (_nextAvailableaddress > _memSize) {
89 | Serial.println("Attempt to write outside of EEPROM memory");
90 | return -availableaddress;
91 | } else {
92 | return availableaddress;
93 | }
94 | #endif
95 | return availableaddress;
96 | }
97 |
98 | /**
99 | * Check if EEPROM memory is ready to be accessed
100 | */
101 | bool EEPROMClassEx::isReady() {
102 | return eeprom_is_ready();
103 | }
104 |
105 | /**
106 | * Read a single byte
107 | * This function performs as readByte and is added to be similar to the EEPROM library
108 | */
109 | uint8_t EEPROMClassEx::read(int address)
110 | {
111 | return readByte(address);
112 | }
113 |
114 | /**
115 | * Read a single bit
116 | */
117 | bool EEPROMClassEx::readBit(int address, byte bit) {
118 | if (bit> 7) return false;
119 | if (!isReadOk(address+sizeof(uint8_t))) return false;
120 | byte byteVal = eeprom_read_byte((unsigned char *) address);
121 | byte bytePos = (1 << bit);
122 | return (byteVal & bytePos);
123 | }
124 |
125 | /**
126 | * Read a single byte
127 | */
128 | uint8_t EEPROMClassEx::readByte(int address)
129 | {
130 | if (!isReadOk(address+sizeof(uint8_t))) return 0;
131 | return eeprom_read_byte((unsigned char *) address);
132 | }
133 |
134 | /**
135 | * Read a single 16 bits integer
136 | */
137 | uint16_t EEPROMClassEx::readInt(int address)
138 | {
139 | if (!isReadOk(address+sizeof(uint16_t))) return 0;
140 | return eeprom_read_word((uint16_t *) address);
141 | }
142 |
143 | /**
144 | * Read a single 32 bits integer
145 | */
146 | uint32_t EEPROMClassEx::readLong(int address)
147 | {
148 | if (!isReadOk(address+sizeof(uint32_t))) return 0;
149 | return eeprom_read_dword((unsigned long *) address);
150 | }
151 |
152 | /**
153 | * Read a single float value
154 | */
155 | float EEPROMClassEx::readFloat(int address)
156 | {
157 | if (!isReadOk(address+sizeof(float))) return 0;
158 | float _value;
159 | readBlock|
25 | EEPROMEx
26 | 1.0.0
27 |
28 | EEPROMEX is an extension of the standard Arduino EEPROM library for reading and writing basic types, structs, strings, arrays and more.
29 | |
30 |
31 |
32 |
33 |
00001 /* 58 | 00002 EEPROMEx.h - Extended EEPROM library 59 | 00003 Copyright (c) 2012 Thijs Elenbaas. All right reserved. 60 | 00004 61 | 00005 This library is free software; you can redistribute it and/or 62 | 00006 modify it under the terms of the GNU Lesser General Public 63 | 00007 License as published by the Free Software Foundation; either 64 | 00008 version 2.1 of the License, or (at your option) any later version. 65 | 00009 66 | 00010 This library is distributed in the hope that it will be useful, 67 | 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 68 | 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 69 | 00013 Lesser General Public License for more details. 70 | 00014 71 | 00015 You should have received a copy of the GNU Lesser General Public 72 | 00016 License along with this library; if not, write to the Free Software 73 | 00017 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 74 | 00018 */ 75 | 00019 76 | 00020 #ifndef EEPROMEX_h 77 | 00021 #define EEPROMEX_h 78 | 00022 79 | 00023 #if ARDUINO >= 100 80 | 00024 #include <Arduino.h> 81 | 00025 #else 82 | 00026 #include <WProgram.h> 83 | 00027 #endif 84 | 00028 #include <inttypes.h> 85 | 00029 #include <avr/eeprom.h> 86 | 00030 87 | 00031 88 | 00032 #define EEPROMSizeATmega168 512 89 | 00033 #define EEPROMSizeATmega328 1024 90 | 00034 #define EEPROMSizeATmega1280 4096 91 | 00035 #define EEPROMSizeATmega32u4 1024 92 | 00036 #define EEPROMSizeAT90USB1286 4096 93 | 00037 #define EEPROMSizeMK20DX128 2048 94 | 00038 #define EEPROMSizeMK20DX256 2048 95 | 00039 #define EEPROMSizeATSAMD21G18 16384 96 | 00040 97 | 00041 #define EEPROMSizeUno EEPROMSizeATmega328 98 | 00042 #define EEPROMSizeUnoSMD EEPROMSizeATmega328 99 | 00043 #define EEPROMSizeLilypad EEPROMSizeATmega328 100 | 00044 #define EEPROMSizeDuemilanove EEPROMSizeATmega328 101 | 00045 #define EEPROMSizePro EEPROMSizeATmega328 102 | 00046 #define EEPROMSizeFio EEPROMSizeATmega328 103 | 00047 #define EEPROMSizeMega EEPROMSizeATmega1280 104 | 00048 #define EEPROMSizeDiecimila EEPROMSizeATmega168 105 | 00049 #define EEPROMSizeNano EEPROMSizeATmega168 106 | 00050 #define EEPROMSizeTeensy2 EEPROMSizeATmega32u4 107 | 00051 #define EEPROMSizeLeonardo EEPROMSizeATmega32u4 108 | 00052 #define EEPROMSizeMicro EEPROMSizeATmega32u4 109 | 00053 #define EEPROMSizeEsplora EEPROMSizeATmega32u4 110 | 00054 #define EEPROMSizeYun EEPROMSizeATmega32u4 111 | 00055 #define EEPROMSizeTre EEPROMSizeATmega32u4 112 | 00056 #define EEPROMSizeZero EEPROMSizeATSAMD21G18 113 | 00057 #define EEPROMSizeTeensy2pp EEPROMSizeAT90USB1286 114 | 00058 #define EEPROMSizeTeensy3 EEPROMSizeMK20DX128 115 | 00059 #define EEPROMSizeTeensy31 EEPROMSizeMK20DX256 116 | 00060 class EEPROMClassEx 117 | 00061 { 118 | 00062 119 | 00063 public: 120 | 00064 EEPROMClassEx(); 121 | 00065 bool isReady(); 122 | 00066 int writtenBytes(); 123 | 00067 void setMemPool(int base, int memSize); 124 | 00068 void setMaxAllowedWrites(int allowedWrites); 125 | 00069 int getAddress(int noOfBytes); 126 | 00070 127 | 00071 uint8_t read(int); 128 | 00072 bool readBit(int, byte); 129 | 00073 uint8_t readByte(int); 130 | 00074 uint16_t readInt(int); 131 | 00075 uint32_t readLong(int); 132 | 00076 float readFloat(int); 133 | 00077 double readDouble(int); 134 | 00078 135 | 00079 bool write(int, uint8_t); 136 | 00080 bool writeBit(int , uint8_t, bool); 137 | 00081 bool writeByte(int, uint8_t); 138 | 00082 bool writeInt(int, uint16_t); 139 | 00083 bool writeLong(int, uint32_t); 140 | 00084 bool writeFloat(int, float); 141 | 00085 bool writeDouble(int, double); 142 | 00086 143 | 00087 bool update(int, uint8_t); 144 | 00088 bool updateBit(int , uint8_t, bool); 145 | 00089 bool updateByte(int, uint8_t); 146 | 00090 bool updateInt(int, uint16_t); 147 | 00091 bool updateLong(int, uint32_t); 148 | 00092 bool updateFloat(int, float); 149 | 00093 bool updateDouble(int, double); 150 | 00094 151 | 00095 152 | 00096 // Use template for other data formats 153 | 00097 154 | 00101 template <class T> int readBlock(int address, const T value[], int items) 155 | 00102 { 156 | 00103 unsigned int i; 157 | 00104 for (i = 0; i < (unsigned int)items; i++) 158 | 00105 readBlock<T>(address+(i*sizeof(T)),value[i]); 159 | 00106 return i; 160 | 00107 } 161 | 00108 162 | 00112 template <class T> int readBlock(int address, const T& value) 163 | 00113 { 164 | 00114 eeprom_read_block((void*)&value, (const void*)address, sizeof(value)); 165 | 00115 return sizeof(value); 166 | 00116 } 167 | 00117 168 | 00121 template <class T> int writeBlock(int address, const T value[], int items) 169 | 00122 { 170 | 00123 if (!isWriteOk(address+items*sizeof(T))) return 0; 171 | 00124 unsigned int i; 172 | 00125 for (i = 0; i < (unsigned int)items; i++) 173 | 00126 writeBlock<T>(address+(i*sizeof(T)),value[i]); 174 | 00127 return i; 175 | 00128 } 176 | 00129 177 | 00133 template <class T> int writeBlock(int address, const T& value) 178 | 00134 { 179 | 00135 if (!isWriteOk(address+sizeof(value))) return 0; 180 | 00136 eeprom_write_block((void*)&value, (void*)address, sizeof(value)); 181 | 00137 return sizeof(value); 182 | 00138 } 183 | 00139 184 | 00144 template <class T> int updateBlock(int address, const T value[], int items) 185 | 00145 { 186 | 00146 int writeCount=0; 187 | 00147 if (!isWriteOk(address+items*sizeof(T))) return 0; 188 | 00148 unsigned int i; 189 | 00149 for (i = 0; i < (unsigned int)items; i++) 190 | 00150 writeCount+= updateBlock<T>(address+(i*sizeof(T)),value[i]); 191 | 00151 return writeCount; 192 | 00152 } 193 | 00153 194 | 00158 template <class T> int updateBlock(int address, const T& value) 195 | 00159 { 196 | 00160 int writeCount=0; 197 | 00161 if (!isWriteOk(address+sizeof(value))) return 0; 198 | 00162 const byte* bytePointer = (const byte*)(const void*)&value; 199 | 00163 for (unsigned int i = 0; i < (unsigned int)sizeof(value); i++) { 200 | 00164 if (read(address)!=*bytePointer) { 201 | 00165 write(address, *bytePointer); 202 | 00166 writeCount++; 203 | 00167 } 204 | 00168 address++; 205 | 00169 bytePointer++; 206 | 00170 } 207 | 00171 return writeCount; 208 | 00172 } 209 | 00173 210 | 00174 211 | 00175 212 | 00176 private: 213 | 00177 //Private variables 214 | 00178 static int _base; 215 | 00179 static int _memSize; 216 | 00180 static int _nextAvailableaddress; 217 | 00181 static int _writeCounts; 218 | 00182 int _allowedWrites; 219 | 00183 bool checkWrite(int base,int noOfBytes); 220 | 00184 bool isWriteOk(int address); 221 | 00185 bool isReadOk(int address); 222 | 00186 }; 223 | 00187 224 | 00188 extern EEPROMClassEx EEPROM; 225 | 00189 226 | 00190 #endif 227 | 00191 228 |
234 | 1.7.6.1
235 |
236 |
237 |
238 |
239 |
--------------------------------------------------------------------------------
/extras/Documentation/html/class_e_e_p_r_o_m_class_ex.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | |
25 | EEPROMEx
26 | 1.0.0
27 |
28 | EEPROMEX is an extension of the standard Arduino EEPROM library for reading and writing basic types, structs, strings, arrays and more.
29 | |
30 |
31 |
32 |
33 |
65 | Public Member Functions | |
| bool | isReady () |
| 68 | int | writtenBytes () |
| void | setMemPool (int base, int memSize) |
| void | setMaxAllowedWrites (int allowedWrites) |
| int | getAddress (int noOfBytes) |
| uint8_t | read (int) |
| bool | readBit (int, byte) |
| uint8_t | readByte (int) |
| uint16_t | readInt (int) |
| uint32_t | readLong (int) |
| float | readFloat (int) |
| double | readDouble (int) |
| bool | write (int, uint8_t) |
| bool | writeBit (int, uint8_t, bool) |
| bool | writeByte (int, uint8_t) |
| bool | writeInt (int, uint16_t) |
| bool | writeLong (int, uint32_t) |
| bool | writeFloat (int, float) |
| bool | writeDouble (int, double) |
| bool | update (int, uint8_t) |
| bool | updateBit (int, uint8_t, bool) |
| bool | updateByte (int, uint8_t) |
| bool | updateInt (int, uint16_t) |
| bool | updateLong (int, uint32_t) |
| bool | updateFloat (int, float) |
| bool | updateDouble (int, double) |
| template<class T > | |
| int | readBlock (int address, const T value[], int items) |
| template<class T > | |
| int | readBlock (int address, const T &value) |
| template<class T > | |
| int | writeBlock (int address, const T value[], int items) |
| template<class T > | |
| int | writeBlock (int address, const T &value) |
| template<class T > | |
| int | updateBlock (int address, const T value[], int items) |
| template<class T > | |
| int | updateBlock (int address, const T &value) |
| int EEPROMClassEx::getAddress | 113 |( | 114 |int | 115 |noOfBytes | ) | 116 |117 | |
Get a new starting address to write to. Adress is negative if not enough space is available
122 | 123 || bool EEPROMClassEx::isReady | 131 |( | 132 |) | 133 |134 | |
Check if EEPROM memory is ready to be accessed
139 | 140 || uint8_t EEPROMClassEx::read | 148 |( | 149 |int | 150 |address | ) | 151 |152 | |
Read a single byte This function performs as readByte and is added to be similar to the EEPROM library
157 | 158 |References readByte().
159 | 160 |Referenced by updateBlock().
161 | 162 || bool EEPROMClassEx::readBit | 170 |( | 171 |int | 172 |address, | 173 |
| 176 | | 177 | | byte | 178 |bit | 179 |
| 182 | | ) | 183 |184 | |
Read a single bit
189 | 190 || int EEPROMClassEx::readBlock | 200 |( | 201 |int | 202 |address, | 203 |
| 206 | | 207 | | const T | 208 |value[], | 209 |
| 212 | | 213 | | int | 214 |items | 215 |
| 218 | | ) | 219 | [inline] |
220 |
Template function to read multiple items of any type of variable, such as structs
225 | 226 || int EEPROMClassEx::readBlock | 236 |( | 237 |int | 238 |address, | 239 |
| 242 | | 243 | | const T & | 244 |value | 245 |
| 248 | | ) | 249 | [inline] |
250 |
Template function to read any type of variable, such as structs
255 | 256 || uint8_t EEPROMClassEx::readByte | 264 |( | 265 |int | 266 |address | ) | 267 |268 | |
Read a single byte
273 | 274 |Referenced by read(), and updateBit().
275 | 276 || double EEPROMClassEx::readDouble | 284 |( | 285 |int | 286 |address | ) | 287 |288 | |
Read a single double value (size will depend on board type)
293 | 294 || float EEPROMClassEx::readFloat | 302 |( | 303 |int | 304 |address | ) | 305 |306 | |
Read a single float value
311 | 312 || uint16_t EEPROMClassEx::readInt | 320 |( | 321 |int | 322 |address | ) | 323 |324 | |
Read a single 16 bits integer
329 | 330 || uint32_t EEPROMClassEx::readLong | 338 |( | 339 |int | 340 |address | ) | 341 |342 | |
Read a single 32 bits integer
347 | 348 || void EEPROMClassEx::setMaxAllowedWrites | 356 |( | 357 |int | 358 |allowedWrites | ) | 359 |360 | |
Set global maximum of allowed writes
365 | 366 || void EEPROMClassEx::setMemPool | 374 |( | 375 |int | 376 |base, | 377 |
| 380 | | 381 | | int | 382 |memSize | 383 |
| 386 | | ) | 387 |388 | |
Set starting position and memory size that EEPROMEx may manage
393 | 394 || bool EEPROMClassEx::update | 402 |( | 403 |int | 404 |address, | 405 |
| 408 | | 409 | | uint8_t | 410 |value | 411 |
| 414 | | ) | 415 |416 | |
Update a single byte The EEPROM will only be overwritten if different. This will reduce wear. This function performs as updateByte and is added to be similar to the EEPROM library
421 | 422 |References updateByte().
423 | 424 || bool EEPROMClassEx::updateBit | 432 |( | 433 |int | 434 |address, | 435 |
| 438 | | 439 | | uint8_t | 440 |bit, | 441 |
| 444 | | 445 | | bool | 446 |value | 447 |
| 450 | | ) | 451 |452 | |
Update a single bit The EEPROM will only be overwritten if different. This will reduce wear.
457 | 458 |References readByte(), and writeByte().
459 | 460 |Referenced by writeBit().
461 | 462 || int EEPROMClassEx::updateBlock | 472 |( | 473 |int | 474 |address, | 475 |
| 478 | | 479 | | const T | 480 |value[], | 481 |
| 484 | | 485 | | int | 486 |items | 487 |
| 490 | | ) | 491 | [inline] |
492 |
Template function to update multiple items of any type of variable, such as structs The EEPROM will only be overwritten if different. This will reduce wear.
497 | 498 || int EEPROMClassEx::updateBlock | 508 |( | 509 |int | 510 |address, | 511 |
| 514 | | 515 | | const T & | 516 |value | 517 |
| 520 | | ) | 521 | [inline] |
522 |
| bool EEPROMClassEx::updateByte | 538 |( | 539 |int | 540 |address, | 541 |
| 544 | | 545 | | uint8_t | 546 |value | 547 |
| 550 | | ) | 551 |552 | |
Update a single byte The EEPROM will only be overwritten if different. This will reduce wear.
557 | 558 |Referenced by update().
559 | 560 || bool EEPROMClassEx::updateDouble | 568 |( | 569 |int | 570 |address, | 571 |
| 574 | | 575 | | double | 576 |value | 577 |
| 580 | | ) | 581 |582 | |
Update a single double value (size will depend on board type) The EEPROM will only be overwritten if different. This will reduce wear.
587 | 588 || bool EEPROMClassEx::updateFloat | 596 |( | 597 |int | 598 |address, | 599 |
| 602 | | 603 | | float | 604 |value | 605 |
| 608 | | ) | 609 |610 | |
Update a single float value The EEPROM will only be overwritten if different. This will reduce wear.
615 | 616 || bool EEPROMClassEx::updateInt | 624 |( | 625 |int | 626 |address, | 627 |
| 630 | | 631 | | uint16_t | 632 |value | 633 |
| 636 | | ) | 637 |638 | |
Update a single 16 bits integer The EEPROM will only be overwritten if different. This will reduce wear.
643 | 644 || bool EEPROMClassEx::updateLong | 652 |( | 653 |int | 654 |address, | 655 |
| 658 | | 659 | | uint32_t | 660 |value | 661 |
| 664 | | ) | 665 |666 | |
Update a single 32 bits integer The EEPROM will only be overwritten if different. This will reduce wear.
671 | 672 || bool EEPROMClassEx::write | 680 |( | 681 |int | 682 |address, | 683 |
| 686 | | 687 | | uint8_t | 688 |value | 689 |
| 692 | | ) | 693 |694 | |
Write a single byte This function performs as writeByte and is added to be similar to the EEPROM library
699 | 700 |References writeByte().
701 | 702 |Referenced by updateBlock().
703 | 704 || bool EEPROMClassEx::writeBit | 712 |( | 713 |int | 714 |address, | 715 |
| 718 | | 719 | | uint8_t | 720 |bit, | 721 |
| 724 | | 725 | | bool | 726 |value | 727 |
| 730 | | ) | 731 |732 | |
Write a single bit
737 | 738 |References updateBit().
739 | 740 || int EEPROMClassEx::writeBlock | 750 |( | 751 |int | 752 |address, | 753 |
| 756 | | 757 | | const T | 758 |value[], | 759 |
| 762 | | 763 | | int | 764 |items | 765 |
| 768 | | ) | 769 | [inline] |
770 |
Template function to write multiple items of any type of variable, such as structs
775 | 776 || int EEPROMClassEx::writeBlock | 786 |( | 787 |int | 788 |address, | 789 |
| 792 | | 793 | | const T & | 794 |value | 795 |
| 798 | | ) | 799 | [inline] |
800 |
Template function to write any type of variable, such as structs
805 | 806 || bool EEPROMClassEx::writeByte | 814 |( | 815 |int | 816 |address, | 817 |
| 820 | | 821 | | uint8_t | 822 |value | 823 |
| 826 | | ) | 827 |828 | |
Write a single byte
833 | 834 |Referenced by updateBit(), and write().
835 | 836 || bool EEPROMClassEx::writeDouble | 844 |( | 845 |int | 846 |address, | 847 |
| 850 | | 851 | | double | 852 |value | 853 |
| 856 | | ) | 857 |858 | |
Write a single double value (size will depend on board type)
863 | 864 || bool EEPROMClassEx::writeFloat | 872 |( | 873 |int | 874 |address, | 875 |
| 878 | | 879 | | float | 880 |value | 881 |
| 884 | | ) | 885 |886 | |
Write a single float value
891 | 892 || bool EEPROMClassEx::writeInt | 900 |( | 901 |int | 902 |address, | 903 |
| 906 | | 907 | | uint16_t | 908 |value | 909 |
| 912 | | ) | 913 |914 | |
Write a single 16 bits integer
919 | 920 || bool EEPROMClassEx::writeLong | 928 |( | 929 |int | 930 |address, | 931 |
| 934 | | 935 | | uint32_t | 936 |value | 937 |
| 940 | | ) | 941 |942 | |
Write a single 32 bits integer
947 | 948 |
960 | 1.7.6.1
961 |
962 |
963 |
964 |
965 |
--------------------------------------------------------------------------------