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

driver::storage: Fix isSliceUninitialized() for AVREEPROM
pull/1188/head
Jesse Vincent 2 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) {
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

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

Loading…
Cancel
Save