master
Astro 2020-12-13 22:12:21 +01:00
parent 53c66ff79c
commit bf89da23a7
2 changed files with 8 additions and 3 deletions

View File

@ -14,18 +14,21 @@ mod test;
/// Backend interface for `Store`
pub trait StoreBackend {
/// type returned by `data()` for reading the flash
type Data: ?Sized + AsRef<[u8]>;
/// Memory-mapped
/// memory-mapped
fn data(&self) -> &Self::Data;
/// size of flash page
fn len(&self) -> usize {
self.data().as_ref().len()
}
/// error type returned by `erase()`/`flash()` operations
type Error;
/// erase flash
/// erase flash page
fn erase(&mut self) -> Result<(), Self::Error>;
/// program flash
/// program flash with offset into flash page
fn program(&mut self, offset: usize, payload: &[u8]) -> Result<(), Self::Error>;
/// called after repeated `program()` invocations to allow for eg. cache flushing
fn program_done(&mut self) {}

View File

@ -1,3 +1,5 @@
//! Support for configurations without flash
use crate::StoreBackend;
use core::fmt;