[−][src]Struct embedded_sdmmc::SdMmcSpi
Represents an SD Card interface built from an SPI peripheral and a Chip Select pin. We need Chip Select to be separate so we can clock out some bytes without Chip Select asserted (which puts the card into SPI mode).
Methods
impl<SPI, CS> SdMmcSpi<SPI, CS> where
SPI: FullDuplex<u8>,
CS: OutputPin,
<SPI as FullDuplex<u8>>::Error: Debug,
[src]
SPI: FullDuplex<u8>,
CS: OutputPin,
<SPI as FullDuplex<u8>>::Error: Debug,
pub fn new(spi: SPI, cs: CS) -> SdMmcSpi<SPI, CS>
[src]
Create a new SD/MMC controller using a raw SPI interface.
pub fn spi(&mut self) -> RefMut<SPI>
[src]
Get a temporary borrow on the underlying SPI device. Useful if you
need to re-clock the SPI after performing init()
.
pub fn init(&mut self) -> Result<(), Error>
[src]
This routine must be performed with an SPI clock speed of around 100 - 400 kHz. Afterwards you may increase the SPI clock speed.
pub fn deinit(&mut self)
[src]
De-init the card so it can't be used
pub fn card_size_bytes(&self) -> Result<u64, Error>
[src]
Return the usable size of this SD card in bytes.
pub fn erase(
&mut self,
_first_block: BlockIdx,
_last_block: BlockIdx
) -> Result<(), Error>
[src]
&mut self,
_first_block: BlockIdx,
_last_block: BlockIdx
) -> Result<(), Error>
Erase some blocks on the card.
pub fn erase_single_block_enabled(&self) -> Result<bool, Error>
[src]
Can this card erase single blocks?
Trait Implementations
impl<SPI, CS> BlockDevice for SdMmcSpi<SPI, CS> where
SPI: FullDuplex<u8>,
<SPI as FullDuplex<u8>>::Error: Debug,
CS: OutputPin,
[src]
SPI: FullDuplex<u8>,
<SPI as FullDuplex<u8>>::Error: Debug,
CS: OutputPin,
type Error = Error
The errors that the BlockDevice
can return. Must be debug formattable.
fn read(
&self,
blocks: &mut [Block],
start_block_idx: BlockIdx,
_reason: &str
) -> Result<(), Self::Error>
[src]
&self,
blocks: &mut [Block],
start_block_idx: BlockIdx,
_reason: &str
) -> Result<(), Self::Error>
Read one or more blocks, starting at the given block index.
fn write(
&self,
blocks: &[Block],
start_block_idx: BlockIdx
) -> Result<(), Self::Error>
[src]
&self,
blocks: &[Block],
start_block_idx: BlockIdx
) -> Result<(), Self::Error>
Write one or more blocks, starting at the given block index.
fn num_blocks(&self) -> Result<BlockCount, Self::Error>
[src]
Determine how many blocks this device can hold.
Auto Trait Implementations
impl<SPI, CS> !RefUnwindSafe for SdMmcSpi<SPI, CS>
impl<SPI, CS> Send for SdMmcSpi<SPI, CS> where
CS: Send,
SPI: Send,
CS: Send,
SPI: Send,
impl<SPI, CS> !Sync for SdMmcSpi<SPI, CS>
impl<SPI, CS> Unpin for SdMmcSpi<SPI, CS> where
CS: Unpin,
SPI: Unpin,
CS: Unpin,
SPI: Unpin,
impl<SPI, CS> UnwindSafe for SdMmcSpi<SPI, CS> where
CS: UnwindSafe,
SPI: UnwindSafe,
CS: UnwindSafe,
SPI: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
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>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,