Skip to content

Commit a4fecfb

Browse files
author
Owen L - SFE
committed
update comments and cap allowedSize at AP3_EEPROM_MAX_LENGTH
taking suggestions from @rustycoat
1 parent 39bae70 commit a4fecfb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

libraries/EEPROM/src/EEPROM.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@
6666
Error : EEPROM start address must be divisble by 8192
6767
#endif
6868

69-
//By limiting EEPROM size to 1024 bytes, we reduce the amount of SRAM required and
70-
//time needed to read/write words into flash. It can be increased
71-
//to 2048 if needed
69+
//Operations on psuedo-EEPROM require a read-write-modify cycle on the entire
70+
//configured memory area because flash pages cannot be partially erased. The
71+
//larger the memory area the longer this operation will take. Here are some
72+
//benchmarks:
7273
//1024 = 19ms update time
7374
//2048 = 23ms update time
7475
const uint16_t AP3_DEFAULT_FLASH_EEPROM_SIZE = 1024; //In bytes
@@ -185,7 +186,7 @@ struct EEPROMClass
185186
}
186187
void setLength(uint16_t length)
187188
{
188-
allowedSize = length;
189+
allowedSize = (length <= AP3_EEPROM_MAX_LENGTH) ? length : AP3_EEPROM_MAX_LENGTH;
189190
}
190191

191192
//Functionality to 'get' and 'put' objects to and from EEPROM.

0 commit comments

Comments
 (0)