Astro 6 months ago
parent
commit
bf89da23a7
  1. 9
      src/lib.rs
  2. 2
      src/no_flash.rs

9
src/lib.rs

@ -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) {}

2
src/no_flash.rs

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

Loading…
Cancel
Save