1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//! Flash-related traits

pub trait Latency {
    type Latency;
    type Error;

    fn set_latency(&mut self, latency: Self::Latency) -> Result<(), Self::Error>;
}

pub trait Read {
    type Error;

    fn read<WORD>(&self, addr: usize) -> Result<WORD, Self::Error>;
}

pub trait WriteErase {
    type Error;
    type Status;

    fn status(&self) -> Result<Self::Status, Self::Error>;

    fn erase_page(&mut self, address: usize) -> Result<(), Self::Error>;

    fn program_word(&mut self, address: usize, value: u32) -> Result<(), Self::Error>;
}

pub trait Locking {
    type Error;

    fn is_locked(&self) -> bool;

    fn lock(&mut self);

    fn unlock(&mut self);
}