embassy-stm32

Crates

git

Versions

stm32u585zi

Flavors

๐Ÿ“ฃ We want to hear from you! Fill the Rust Embedded 2024 micro-survey.

Struct embassy_stm32::sdmmc::Sdmmc

source ยท
pub struct Sdmmc<'d, T: Instance, Dma: SdmmcDma<T> = NoDma> { /* private fields */ }
Expand description

Sdmmc device

Implementationsยง

sourceยง

impl<'d, T: Instance> Sdmmc<'d, T, NoDma>

source

pub fn new_1bit( sdmmc: impl Peripheral<P = T> + 'd, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, clk: impl Peripheral<P = impl CkPin<T>> + 'd, cmd: impl Peripheral<P = impl CmdPin<T>> + 'd, d0: impl Peripheral<P = impl D0Pin<T>> + 'd, config: Config, ) -> Self

Create a new SDMMC driver, with 1 data lane.

source

pub fn new_4bit( sdmmc: impl Peripheral<P = T> + 'd, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, clk: impl Peripheral<P = impl CkPin<T>> + 'd, cmd: impl Peripheral<P = impl CmdPin<T>> + 'd, d0: impl Peripheral<P = impl D0Pin<T>> + 'd, d1: impl Peripheral<P = impl D1Pin<T>> + 'd, d2: impl Peripheral<P = impl D2Pin<T>> + 'd, d3: impl Peripheral<P = impl D3Pin<T>> + 'd, config: Config, ) -> Self

Create a new SDMMC driver, with 4 data lanes.

sourceยง

impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Sdmmc<'d, T, Dma>

source

pub async fn init_card(&mut self, freq: Hertz) -> Result<(), Error>

Initializes card (if present) and sets the bus at the specified frequency.

source

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

Read a data block.

source

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

Write a data block.

source

pub fn card(&self) -> Result<&Card, Error>

Get a reference to the initialized card

ยงErrors

Returns Error::NoCard if init_card has not previously succeeded

source

pub fn clock(&self) -> Hertz

Get the current SDMMC bus clock

source

pub fn set_cmd_block(&mut self, cmd_block: &'d mut CmdBlock)

Set a specific cmd buffer rather than using the default stack allocated one. This is required if stack RAM cannot be used with DMA and usually manifests itself as an indefinite wait on a dma transfer because the dma peripheral cannot access the memory.

Trait Implementationsยง

sourceยง

impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> BlockDevice<512> for Sdmmc<'d, T, Dma>

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.
sourceยง

impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Drop for Sdmmc<'d, T, Dma>

sourceยง

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementationsยง

ยง

impl<'d, T, Dma> Freeze for Sdmmc<'d, T, Dma>
where T: Freeze, Dma: Freeze,

ยง

impl<'d, T, Dma> RefUnwindSafe for Sdmmc<'d, T, Dma>

ยง

impl<'d, T, Dma> Send for Sdmmc<'d, T, Dma>
where T: Send, Dma: Send,

ยง

impl<'d, T, Dma> Sync for Sdmmc<'d, T, Dma>
where T: Sync, Dma: Sync,

ยง

impl<'d, T, Dma> Unpin for Sdmmc<'d, T, Dma>
where T: Unpin, Dma: Unpin,

ยง

impl<'d, T, Dma = NoDma> !UnwindSafe for Sdmmc<'d, T, Dma>

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.