Skip to main content

SdCardDriver

Struct SdCardDriver 

Source
pub struct SdCardDriver<T> { /* private fields */ }
Expand description

A high-level SD-Card driver.

This driver is used to interface with an SD-Card by wrapping one of the two SD Host drivers:

  • SD-SPI Host driver (SdSpiHostDriver)
  • SD-MMC Host driver (SdMmcHostDriver) - on MCUs that do have an SD-MMC peripheral (ESP32, ESP32S3 and ESP32P4)

The interface allows reading, writing and erasing sectors, as well as reading and writing arbitrary-length bytes.

Currently, all interaction with the SD-Card driver is via the native, unsafe sys::sdmmc_* functions.

Implementations§

Source§

impl<T> SdCardDriver<T>

Source

pub fn card(&self) -> &sdmmc_card_t

Get a reference to the SD-Card native structure.

Source§

impl<'d, T> SdCardDriver<SdSpiHostDriver<'d, T>>
where T: Borrow<SpiDriver<'d>>,

Source

pub fn new_spi( host: SdSpiHostDriver<'d, T>, configuration: &Configuration, ) -> Result<Self, EspError>

Create a new SD-Card driver using the SD-SPI host driver instantiated with one of the SPI peripherals

Auto Trait Implementations§

§

impl<T> Freeze for SdCardDriver<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for SdCardDriver<T>
where T: RefUnwindSafe,

§

impl<T> !Send for SdCardDriver<T>

§

impl<T> !Sync for SdCardDriver<T>

§

impl<T> Unpin for SdCardDriver<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for SdCardDriver<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for SdCardDriver<T>
where T: UnwindSafe,

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.