k::d::storage::GD32Flash: Implement isSliceUninitialized()

The `::isSliceUninitialized()` method is required by the Base flash driver
class, but `GD32Flash` did not implement it. While the Base class does so,
`GD32Flash` is subclassing `EEPROMClass`, rather than `storage::Base`, for
historical and technical reasons. As such, we need to implement this method
ourselves.

We could probably use multiple inheritance, but I feel that would be more
trouble than its worth.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/1173/head
Gergely Nagy 3 years ago
parent 7d08de5d23
commit f834bd6079
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -38,6 +38,14 @@ class GD32Flash : public EEPROMClass<_StorageProps::length> {
void setup() { void setup() {
EEPROMClass<_StorageProps::length>::begin(); EEPROMClass<_StorageProps::length>::begin();
} }
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

Loading…
Cancel
Save