Merge pull request #1196 from keyboardio/storage/avreeprom-isSliceUninitialized-fix

driver::storage: Fix isSliceUninitialized() for AVREEPROM
pull/1188/head
Jesse Vincent 3 years ago committed by GitHub
commit feca06d0c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -56,6 +56,14 @@ class AVREEPROM : public kaleidoscope::driver::storage::Base<_StorageProps> {
void update(int idx, uint8_t val) { void update(int idx, uint8_t val) {
EEPROM.update(idx, val); EEPROM.update(idx, val);
} }
bool isSliceUninitialized(uint16_t offset, uint16_t size) {
for (uint16_t o = offset; o < offset + size; o++) {
if (this->read(o) != _StorageProps::uninitialized_byte)
return false;
}
return true;
}
}; };
} // namespace storage } // namespace storage

@ -50,11 +50,7 @@ class Base {
void update(int idx, uint8_t val) {} void update(int idx, uint8_t val) {}
bool isSliceUninitialized(uint16_t offset, uint16_t size) { bool isSliceUninitialized(uint16_t offset, uint16_t size) {
for (uint16_t o = offset; o < offset + size; o++) { return false;
if (read(o) != _StorageProps::uninitialized_byte)
return false;
}
return true;
} }
const uint16_t length() { const uint16_t length() {

Loading…
Cancel
Save