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>
impl<'d, T: Instance> Sdmmc<'d, T, NoDma>
sourcepub 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
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.
sourcepub 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
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>
impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> Sdmmc<'d, T, Dma>
sourcepub async fn init_card(&mut self, freq: Hertz) -> Result<(), Error>
pub async fn init_card(&mut self, freq: Hertz) -> Result<(), Error>
Initializes card (if present) and sets the bus at the specified frequency.
sourcepub async fn read_block(
&mut self,
block_idx: u32,
buffer: &mut DataBlock,
) -> Result<(), Error>
pub async fn read_block( &mut self, block_idx: u32, buffer: &mut DataBlock, ) -> Result<(), Error>
Read a data block.
sourcepub async fn write_block(
&mut self,
block_idx: u32,
buffer: &DataBlock,
) -> Result<(), Error>
pub async fn write_block( &mut self, block_idx: u32, buffer: &DataBlock, ) -> Result<(), Error>
Write a data block.
sourcepub fn set_cmd_block(&mut self, cmd_block: &'d mut CmdBlock)
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>
impl<'d, T: Instance, Dma: SdmmcDma<T> + 'd> BlockDevice<512> for Sdmmc<'d, T, Dma>
source§async fn read(
&mut self,
block_address: u32,
buf: &mut [Aligned<Self::Align, [u8; 512]>],
) -> Result<(), Self::Error>
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.
Auto Trait Implementations§
impl<'d, T, Dma> Freeze for Sdmmc<'d, T, Dma>
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>
impl<'d, T, Dma> Sync for Sdmmc<'d, T, Dma>
impl<'d, T, Dma> Unpin for Sdmmc<'d, T, Dma>
impl<'d, T, Dma = NoDma> !UnwindSafe for Sdmmc<'d, T, Dma>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more