pub struct Slot<'d, const S: u8, Dm: DriverMode> { /* private fields */ }Expand description
A configured card slot, generic over the slot index and driver mode.
Implementations§
Source§impl<'d, const S: u8, Dm: DriverMode> Slot<'d, S, Dm>
impl<'d, const S: u8, Dm: DriverMode> Slot<'d, S, Dm>
Sourcepub fn with_cmd(self, cmd: impl SlotCmd<'d, S>) -> Self
pub fn with_cmd(self, cmd: impl SlotCmd<'d, S>) -> Self
Connects the bidirectional command line.
Sourcepub fn with_data0(self, d0: impl SlotData<'d, S, 0>) -> Self
pub fn with_data0(self, d0: impl SlotData<'d, S, 0>) -> Self
Connects data line 0 (required for any transfer).
Sourcepub fn with_data1(self, d1: impl SlotData<'d, S, 1>) -> Self
pub fn with_data1(self, d1: impl SlotData<'d, S, 1>) -> Self
Connects data line 1.
Sourcepub fn with_data2(self, d2: impl SlotData<'d, S, 2>) -> Self
pub fn with_data2(self, d2: impl SlotData<'d, S, 2>) -> Self
Connects data line 2.
Sourcepub fn with_data3(self, d3: impl SlotData<'d, S, 3>) -> Self
pub fn with_data3(self, d3: impl SlotData<'d, S, 3>) -> Self
Connects data line 3 (completes the 4-bit bus).
Sourcepub fn with_data4(self, d4: impl SlotData<'d, S, 4>) -> Self
pub fn with_data4(self, d4: impl SlotData<'d, S, 4>) -> Self
Connects data line 4.
Sourcepub fn with_data5(self, d5: impl SlotData<'d, S, 5>) -> Self
pub fn with_data5(self, d5: impl SlotData<'d, S, 5>) -> Self
Connects data line 5.
Sourcepub fn with_data6(self, d6: impl SlotData<'d, S, 6>) -> Self
pub fn with_data6(self, d6: impl SlotData<'d, S, 6>) -> Self
Connects data line 6.
Sourcepub fn with_data7(self, d7: impl SlotData<'d, S, 7>) -> Self
pub fn with_data7(self, d7: impl SlotData<'d, S, 7>) -> Self
Connects data line 7 (completes the 8-bit bus).
Sourcepub fn with_card_detect(self, cd: impl PeripheralInput<'d>) -> Self
pub fn with_card_detect(self, cd: impl PeripheralInput<'d>) -> Self
Connects the card-detect input.
Sourcepub fn with_write_protect(self, wp: impl PeripheralInput<'d>) -> Self
pub fn with_write_protect(self, wp: impl PeripheralInput<'d>) -> Self
Connects the write-protect input.
Sourcepub fn with_power_enable(self, power: impl PeripheralOutput<'d>) -> Self
pub fn with_power_enable(self, power: impl PeripheralOutput<'d>) -> Self
Connects a GPIO used to switch card power. Driven high here.
Sourcepub fn is_card_present(&self) -> bool
pub fn is_card_present(&self) -> bool
Returns true if a card is detected, or if no card-detect pin is
wired (assume present).
Sourcepub fn is_write_protected(&self) -> bool
pub fn is_write_protected(&self) -> bool
Returns true if the card reports write protection. Returns false
if no write-protect pin is wired. Polarity follows
SlotConfig::with_wp_active_high.
Sourcepub fn set_bus_low_level(
&mut self,
width: BusWidth,
hz: u32,
) -> Result<(), Error>
pub fn set_bus_low_level( &mut self, width: BusWidth, hz: u32, ) -> Result<(), Error>
Caches bus width and card clock; HW is programmed on the next engine op.
Sourcepub fn send_init_sequence(&mut self) -> Result<(), BlockingError>
pub fn send_init_sequence(&mut self) -> Result<(), BlockingError>
Issues the 80-clock SD init sequence (no command index).
Sourcepub fn command_blocking(
&mut self,
index: u8,
arg: u32,
resp_len: ResponseLen,
check_crc: bool,
flags: CommandFlags,
) -> Result<[u32; 4], BlockingError>
pub fn command_blocking( &mut self, index: u8, arg: u32, resp_len: ResponseLen, check_crc: bool, flags: CommandFlags, ) -> Result<[u32; 4], BlockingError>
Issues a no-data command and returns its raw response words.
Sourcepub fn read_blocks_blocking(
&mut self,
cmd_index: u8,
arg: u32,
buf: DmaAlignedMut<'_, [u8]>,
block_size: u16,
block_count: u32,
) -> Result<[u32; 4], BlockingError>
pub fn read_blocks_blocking( &mut self, cmd_index: u8, arg: u32, buf: DmaAlignedMut<'_, [u8]>, block_size: u16, block_count: u32, ) -> Result<[u32; 4], BlockingError>
Reads block_count blocks into a DMA-capable buffer (CMD17/CMD18).
Sourcepub fn write_blocks_blocking(
&mut self,
cmd_index: u8,
arg: u32,
buf: DmaAlignedMut<'_, [u8]>,
block_size: u16,
block_count: u32,
) -> Result<[u32; 4], BlockingError>
pub fn write_blocks_blocking( &mut self, cmd_index: u8, arg: u32, buf: DmaAlignedMut<'_, [u8]>, block_size: u16, block_count: u32, ) -> Result<[u32; 4], BlockingError>
Writes block_count blocks from a DMA-capable buffer (CMD24/CMD25).
Trait Implementations§
Source§impl<'d, const S: u8> MmcBus for Slot<'d, S, Async>
Available on crate feature unstable only.
impl<'d, const S: u8> MmcBus for Slot<'d, S, Async>
unstable only.Source§async fn wait_for_event(&mut self) -> Result<(), MmcError>
async fn wait_for_event(&mut self) -> Result<(), MmcError>
Source§async fn send_command<'a, C>(&mut self, cmd: C) -> Result<C::Resp<'a>, MmcError>where
C: ControlCommand + 'a,
async fn send_command<'a, C>(&mut self, cmd: C) -> Result<C::Resp<'a>, MmcError>where
C: ControlCommand + 'a,
Source§async fn read_blocks<'a, C>(
&mut self,
cmd: C,
auto_stop: bool,
) -> Result<C::Resp<'a>, MmcError>where
C: BlockReadCommand + 'a,
async fn read_blocks<'a, C>(
&mut self,
cmd: C,
auto_stop: bool,
) -> Result<C::Resp<'a>, MmcError>where
C: BlockReadCommand + 'a,
Source§async fn write_blocks<'a, C>(
&mut self,
cmd: C,
auto_stop: bool,
) -> Result<C::Resp<'a>, MmcError>where
C: BlockWriteCommand + 'a,
async fn write_blocks<'a, C>(
&mut self,
cmd: C,
auto_stop: bool,
) -> Result<C::Resp<'a>, MmcError>where
C: BlockWriteCommand + 'a,
Source§async fn read_bytes<'a, C>(&mut self, cmd: C) -> Result<C::Resp<'a>, MmcError>where
C: ByteReadCommand + 'a,
async fn read_bytes<'a, C>(&mut self, cmd: C) -> Result<C::Resp<'a>, MmcError>where
C: ByteReadCommand + 'a,
Source§async fn write_bytes<'a, C>(&mut self, cmd: C) -> Result<C::Resp<'a>, MmcError>where
C: ByteWriteCommand + 'a,
async fn write_bytes<'a, C>(&mut self, cmd: C) -> Result<C::Resp<'a>, MmcError>where
C: ByteWriteCommand + 'a,
Source§async fn init_idle(&mut self, hz: u32) -> Result<(), MmcError>
async fn init_idle(&mut self, hz: u32) -> Result<(), MmcError>
Source§fn set_bus(&mut self, width: BusWidth, hz: u32) -> Result<(), MmcError>
fn set_bus(&mut self, width: BusWidth, hz: u32) -> Result<(), MmcError>
Source§fn supports_mmc(&self) -> bool
fn supports_mmc(&self) -> bool
Source§fn supports_auto_stop(&self) -> bool
fn supports_auto_stop(&self) -> bool
Source§fn supports_bus_width(&self) -> BusWidth
fn supports_bus_width(&self) -> BusWidth
Source§fn supports_frequency(&self) -> u32
fn supports_frequency(&self) -> u32
Source§fn tune_bus<O>(
&mut self,
width: BusWidth,
hz: u32,
op: O,
) -> impl Future<Output = Result<(), MmcError>>where
O: TuningOp,
fn tune_bus<O>(
&mut self,
width: BusWidth,
hz: u32,
op: O,
) -> impl Future<Output = Result<(), MmcError>>where
O: TuningOp,
Source§fn supports_1v8(&self) -> bool
fn supports_1v8(&self) -> bool
send_command will be called with CMD11.