embassy-stm32

Crates

git

Versions

stm32l486qg

Flavors

StorageDevice

Struct StorageDevice 

Source
pub struct StorageDevice<'a, 'b, T: Addressable> {
    pub sdmmc: &'a mut Sdmmc<'b>,
    /* private fields */
}
Expand description

Storage Device

Fields§

§sdmmc: &'a mut Sdmmc<'b>

Inner member

Implementations§

Source§

impl<'a, 'b> StorageDevice<'a, 'b, Card>

Card Storage Device

Source

pub async fn new_sd_card( sdmmc: &'a mut Sdmmc<'b>, cmd_block: &mut CmdBlock, freq: Hertz, ) -> Result<Self, Error>

Create a new SD card

Source§

impl<'a, 'b> StorageDevice<'a, 'b, Emmc>

Emmc storage device

Source

pub async fn new_emmc( sdmmc: &'a mut Sdmmc<'b>, cmd_block: &mut CmdBlock, freq: Hertz, ) -> Result<Self, Error>

Create a new EMMC card

Source§

impl<'a, 'b, A: Addressable> StorageDevice<'a, 'b, A>

Card or Emmc storage device

Source

pub fn card(&self) -> A

Write a block

Source

pub async fn read_block( &mut self, block_idx: u32, data_block: &mut DataBlock, ) -> Result<(), Error>

Read a data block.

Source

pub async fn read_blocks( &mut self, block_idx: u32, blocks: &mut [DataBlock], ) -> Result<(), Error>

Read multiple data blocks.

Source

pub async fn write_block( &mut self, block_idx: u32, buffer: &DataBlock, ) -> Result<(), Error>
where CardStatus<A::Ext>: From<u32>,

Write a data block.

Source

pub async fn write_blocks( &mut self, block_idx: u32, blocks: &[DataBlock], ) -> Result<(), Error>
where CardStatus<A::Ext>: From<u32>,

Write multiple data blocks.

Trait Implementations§

Source§

impl<'d, 'e, A: Addressable> BlockDevice<512> for StorageDevice<'d, 'e, A>

Source§

type Error = Error

The error type for the BlockDevice implementation.
Source§

type Align = A4

The alignment requirements of the block buffers.
Source§

async fn read( &mut self, block_address: u32, buf: &mut [Aligned<Self::Align, [u8; 512]>], ) -> Result<(), Self::Error>

Read one or more blocks at the given block address.
Source§

async fn write( &mut self, block_address: u32, buf: &[Aligned<Self::Align, [u8; 512]>], ) -> Result<(), Self::Error>

Write one or more blocks at the given block address.
Source§

async fn size(&mut self) -> Result<u64, Self::Error>

Report the size of the block device in bytes.

Auto Trait Implementations§

§

impl<'a, 'b, T> Freeze for StorageDevice<'a, 'b, T>
where T: Freeze,

§

impl<'a, 'b, T> !RefUnwindSafe for StorageDevice<'a, 'b, T>

§

impl<'a, 'b, T> Send for StorageDevice<'a, 'b, T>
where T: Send,

§

impl<'a, 'b, T> Sync for StorageDevice<'a, 'b, T>
where T: Sync,

§

impl<'a, 'b, T> Unpin for StorageDevice<'a, 'b, T>
where T: Unpin,

§

impl<'a, 'b, T> !UnwindSafe for StorageDevice<'a, 'b, T>

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 = Infallible

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.