Skip to main content

Sdmmc

Struct Sdmmc 

Source
pub struct Sdmmc<'d, T: Instance, Dma: SdioDma<T> = NoDma> { /* private fields */ }
Expand description

Sdmmc device

Implementations§

Source§

impl<'d, T: Instance, Dma: SdioDma<T>> Sdmmc<'d, T, Dma>

Source

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

Create a new SDMMC driver, with 1 data lane.

Source

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

Create a new SDMMC driver, with 4 data lanes.

Source§

impl<'d, T: Instance, Dma: SdioDma<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

Trait Implementations§

Source§

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

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

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

§

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>
where T: RefUnwindSafe, Dma: RefUnwindSafe,

§

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> UnsafeUnpin for Sdmmc<'d, T, Dma>
where T: UnsafeUnpin, Dma: UnsafeUnpin,

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.