embassy-stm32

Crates

git

Versions

stm32l162ve

Flavors

Skip to main content

Eeprom

Struct Eeprom 

Source
pub struct Eeprom<'d, M: Mode> { /* private fields */ }
Expand description

Driver for the data EEPROM.

The EEPROM is written without erasing it first, at any offset and with any length. The hardware erases and programs it in 32-bit words, which takes a few milliseconds per word: a write rewrites every word it touches, except the ones that already have the value written. While a word is programmed, the CPU stalls when it reads from the flash bank being written.

Erased EEPROM reads as 0x00.

Implementations§

Source§

impl<'d, M: Mode> Eeprom<'d, M>

Source

pub fn capacity(&self) -> usize

Size of the EEPROM in bytes, EEPROM_SIZE.

Source

pub fn blocking_read( &mut self, offset: u32, bytes: &mut [u8], ) -> Result<(), Error>

Blocking read.

NOTE: offset is an offset from the start of the EEPROM, EEPROM_BASE.

Source§

impl<'d> Eeprom<'d, Blocking>

Source

pub fn blocking_write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Error>

Blocking write.

NOTE: offset is an offset from the start of the EEPROM, EEPROM_BASE.

Source§

impl<'d> Eeprom<'d, Async>

Source

pub async fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Error>

Async read.

Note: reading from the EEPROM can’t actually block, so this is the same as blocking_read.

Source

pub async fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Error>

Async write.

NOTE: offset is an offset from the start of the EEPROM, EEPROM_BASE.

Trait Implementations§

Source§

impl<M: Mode> ReadStorage for Eeprom<'_, M>

Source§

type Error = Error

An enumeration of storage errors
Source§

fn read(&mut self, offset: u32, bytes: &mut [u8]) -> Result<(), Self::Error>

Read a slice of data from the storage peripheral, starting the read operation at the given address offset, and reading bytes.len() bytes. Read more
Source§

fn capacity(&self) -> usize

The capacity of the storage peripheral in bytes.
Source§

impl Storage for Eeprom<'_, Blocking>

Source§

fn write(&mut self, offset: u32, bytes: &[u8]) -> Result<(), Self::Error>

Write a slice of data to the storage peripheral, starting the write operation at the given address offset (between 0 and self.capacity()). Read more

Auto Trait Implementations§

§

impl<'d, M> !UnwindSafe for Eeprom<'d, M>

§

impl<'d, M> Freeze for Eeprom<'d, M>
where PhantomData<M>: Freeze,

§

impl<'d, M> RefUnwindSafe for Eeprom<'d, M>

§

impl<'d, M> Send for Eeprom<'d, M>
where PhantomData<M>: Send,

§

impl<'d, M> Sync for Eeprom<'d, M>
where PhantomData<M>: Sync,

§

impl<'d, M> Unpin for Eeprom<'d, M>
where PhantomData<M>: Unpin,

§

impl<'d, M> UnsafeUnpin for Eeprom<'d, M>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.