[−][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) -> &mut 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> Send for SdMmcSpi<SPI, CS> where
CS: Send,
SPI: Send,
CS: Send,
SPI: Send,
impl<SPI, CS> !Sync for SdMmcSpi<SPI, CS>
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)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 for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,