You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**devCap***(eeprom_size_t)*: The size of one EEPROM device in k-bits. Choose a value from the eeprom_size_t enumeration above.
86
-
**nDev***(byte)*: The number of EEPROM devices on the bus. Note that if there are multiple EEPROM devices on the bus, they must be identical and each must have its address pins strapped properly.
87
-
**pgSize***(unsigned int)*: The EEPROM page size in bytes. Consult the datasheet if you are unsure of the page size.
88
-
**busAddr***(byte)*: The base I2C bus address for the EEPROM(s). 0x50 is a common value and this parameter can be omitted, in which case 0x50 will be used as the default.
86
+
**nDev***(uint8_t)*: The number of EEPROM devices on the bus. Note that if there are multiple EEPROM devices on the bus, they must be identical and each must have its address pins strapped properly.
87
+
**pgSize***(uint16_t)*: The EEPROM page size in bytes. Consult the datasheet if you are unsure of the page size.
88
+
**busAddr***(uint8_t)*: The base I2C bus address for the EEPROM(s). 0x50 is a common value and this parameter can be omitted, in which case 0x50 will be used as the default.
89
89
##### Example
90
90
```c++
91
91
JC_EEPROM myEEPROM(kbits_256, 2, 64); //two 24LC256 EEPROMS on the bus
@@ -101,31 +101,31 @@ Initializes the library. Call this method once in the setup code. begin() does a
101
101
##### Parameters
102
102
**freq** *(twiClockFreq_t)*: The desired I2C bus speed, `JC_EEPROM::twiClock100kHz` or `JC_EEPROM::twiClock400kHz`. Can be omitted in which case it will default to `twiClock100kHz`. **NOTE:** When using 400kHz, if there are other devices on the bus they must all support a 400kHz bus speed. **Secondly**, the other devices should be initialized first, as other libraries may not support adjusting the bus speed. To ensure the desired speed is set, call the JC_EEPROM.begin() function *after* initializing all other I2C devices.
103
103
##### Returns
104
-
I2C I/O status, zero if successful *(byte)*. See the [Arduino Wire.endTransmission() function](http://arduino.cc/en/Reference/WireEndTransmission) for a description of other return codes.
104
+
I2C I/O status, zero if successful *(uint8_t)*. See the [Arduino Wire.endTransmission() function](http://arduino.cc/en/Reference/WireEndTransmission) for a description of other return codes.
**addr***(unsigned long)*: The beginning EEPROM location to write.
120
-
**values**_(byte*)_: Pointer to an array containing the data to write.
121
-
**nBytes***(unsigned int)*: The number of bytes to write.
119
+
**addr***(uint32_t)*: The beginning EEPROM location to write.
120
+
**values**_(uint8_t*)_: Pointer to an array containing the data to write.
121
+
**nBytes***(uint16_t)*: The number of bytes to write.
122
122
##### Returns
123
-
I2C I/O status, zero if successful *(byte)*. See the [Arduino Wire.endTransmission() function](http://arduino.cc/en/Reference/WireEndTransmission) for a description of other return codes. Returns a status of EEPROM_ADDR_ERR if the I/O would extend past the top of the EEPROM address space.
123
+
I2C I/O status, zero if successful *(uint8_t)*. See the [Arduino Wire.endTransmission() function](http://arduino.cc/en/Reference/WireEndTransmission) for a description of other return codes. Returns a status of EEPROM_ADDR_ERR if the I/O would extend past the top of the EEPROM address space.
124
124
##### Example
125
125
```c++
126
-
byte myData[10];
126
+
uint8_t myData[10];
127
127
//write 10 bytes starting at location 42
128
-
byte i2cStat = myEEPROM.write(42, myData, 10);
128
+
uint8_t i2cStat = myEEPROM.write(42, myData, 10);
129
129
if ( i2cStat != 0 ) {
130
130
//there was a problem
131
131
if ( i2cStat == EEPROM_ADDR_ERR) {
@@ -136,37 +136,37 @@ if ( i2cStat != 0 ) {
136
136
}
137
137
}
138
138
```
139
-
### write(unsigned long addr, byte value)
139
+
### write(uint32_t addr, uint8_t value)
140
140
##### Description
141
141
Writes a single byte to external EEPROM.
142
142
##### Syntax
143
-
`myEEPROM.write(unsigned long addr, byte value);`
143
+
`myEEPROM.write(uint32_t addr, uint8_t value);`
144
144
##### Parameters
145
-
**addr***(unsigned long)*: The EEPROM location to write.
146
-
**values**_(byte)_: The value to write.
145
+
**addr***(uint32_t)*: The EEPROM location to write.
146
+
**values**_(uint8_t)_: The value to write.
147
147
##### Returns
148
148
Same as multiple-byte write() above.
149
149
##### Example
150
150
```c++
151
151
//write the value 16 to EEPROM location 314.
152
-
byte i2cStat = myEEPROM.write(314, 16);
152
+
uint8_t i2cStat = myEEPROM.write(314, 16);
153
153
```
154
-
### read(unsigned long addr, byte* values, unsigned int nBytes)
**addr***(unsigned long)*: The beginning EEPROM location to read from.
161
-
**values**_(byte*)_: Pointer to an array to receive the data.
162
-
**nBytes***(unsigned int)*: The number of bytes to read.
160
+
**addr***(uint32_t)*: The beginning EEPROM location to read from.
161
+
**values**_(uint8_t*)_: Pointer to an array to receive the data.
162
+
**nBytes***(uint16_t)*: The number of bytes to read.
163
163
##### Returns
164
-
I2C I/O status, zero if successful *(byte)*. See the [Arduino Wire.endTransmission() function](http://arduino.cc/en/Reference/WireEndTransmission) for a description of other return codes. Returns a status of EEPROM_ADDR_ERR if the I/O would extend past the top of the EEPROM address space.
164
+
I2C I/O status, zero if successful *(uint8_t)*. See the [Arduino Wire.endTransmission() function](http://arduino.cc/en/Reference/WireEndTransmission) for a description of other return codes. Returns a status of EEPROM_ADDR_ERR if the I/O would extend past the top of the EEPROM address space.
165
165
##### Example
166
166
```c++
167
-
byte myData[10];
167
+
uint8_t myData[10];
168
168
//read 10 bytes starting at location 42
169
-
byte i2cStat = myEEPROM.read(42, myData, 10);
169
+
uint8_t i2cStat = myEEPROM.read(42, myData, 10);
170
170
if ( i2cStat != 0 ) {
171
171
//there was a problem
172
172
if ( i2cStat == EEPROM_ADDR_ERR) {
@@ -177,21 +177,20 @@ if ( i2cStat != 0 ) {
177
177
}
178
178
}
179
179
```
180
-
### read(unsigned long addr)
180
+
### read(uint32_t addr)
181
181
##### Description
182
182
Reads a single byte from external EEPROM.
183
183
##### Syntax
184
-
`myEEPROM.read(unsigned long addr);`
184
+
`myEEPROM.read(uint32_t addr);`
185
185
##### Parameters
186
-
**addr***(unsigned long)*: The EEPROM location to read from.
186
+
**addr***(uint32_t)*: The EEPROM location to read from.
187
187
##### Returns
188
-
The data read from EEPROM or an error code *(int)*. To distinguish error values from valid data, error values are returned as negative numbers. See the [Arduino Wire.endTransmission() function](http://arduino.cc/en/Reference/WireEndTransmission) for a description of return codes. Returns a status of EEPROM_ADDR_ERR if the I/O would extend past the top of the EEPROM address space.
188
+
The data read from EEPROM or an error code *(int16_t)*. To distinguish error values from valid data, error values are returned as negative numbers. See the [Arduino Wire.endTransmission() function](http://arduino.cc/en/Reference/WireEndTransmission) for a description of return codes. Returns a status of EEPROM_ADDR_ERR if the I/O would extend past the top of the EEPROM address space.
189
189
190
190
##### Example
191
191
```c++
192
-
int myData;
193
192
//read a byte from location 42
194
-
int readValue = myEEPROM.read(42);
193
+
int16_t readValue = myEEPROM.read(42);
195
194
if ( readValue < 0 ) {
196
195
//there was a problem
197
196
if ( -readValue == EEPROM_ADDR_ERR) {
@@ -206,18 +205,18 @@ else {
206
205
}
207
206
```
208
207
209
-
### update(unsigned long addr, byte value)
208
+
### update(uint32_t addr, uint8_t value)
210
209
##### Description
211
210
Updates a single byte in external EEPROM. Like `write(addr, value)` except first reads the location from EEPROM and only writes `value` if it differs from the current value stored at the given location, to reduce wear on the EEPROM.
212
211
##### Syntax
213
-
`myEEPROM.update(unsigned long addr, byte value);`
212
+
`myEEPROM.update(uint32_t addr, uint8_t value);`
214
213
##### Parameters
215
-
**addr***(unsigned long)*: The EEPROM location to update.
216
-
**values**_(byte)_: The value to write.
214
+
**addr***(uint32_t)*: The EEPROM location to update.
0 commit comments