diff --git a/README.md b/README.md index 74a4a2c..5748100 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ designed for readability and simplicity over performance. You will need something that implements the `BlockDevice` trait, which can read and write the 512-byte blocks (or sectors) from your card. If you were to implement this over USB Mass Storage, there's no reason this crate couldn't work with a USB Thumb Drive, but we only supply a `BlockDevice` suitable for reading SD and SDHC cards over SPI. -To accommodate specific requirements when using SD cards on a shared SPI bus, this crate uses a bespoke `SdCardDevice` trait instead of the more commmon `embedded_hal::spi::SpiDevice` trait. Implementations for several types that wrap a `embedded-hal::spi::SpiBus` implementation are provided in the `sd_card` module. Some are guarded behind cargo features: +To accommodate specific requirements when using SD cards on a shared SPI bus, this crate uses a bespoke `SdCardSpiDevice` trait instead of the more commmon `embedded_hal::spi::SpiDevice` trait. Implementations for several types that wrap a `embedded-hal::spi::SpiBus` implementation are provided in the `sd_card` module. Some are guarded behind cargo features: - `embedded-hal-bus-03`: adds support for `embedded-hal-bus::spi::ExclusiveDevice`. This is probably the easiest way to use this crate when the SD card is the only device on the bus. - `embassy-sync-06`: adds support for using a blocking mutex from the `embassy-sync` crate. This allows sharing the bus between multiple tasks. diff --git a/src/lib.rs b/src/lib.rs index d21b021..6343783 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,11 +17,11 @@ //! suitable for reading SD and SDHC cards over SPI. //! //! ```rust -//! use embedded_sdmmc::{Error, Mode, SdCard, SdCardError, TimeSource, VolumeIdx, VolumeManager, SdCardDevice}; +//! use embedded_sdmmc::{Error, Mode, SdCard, SdCardError, TimeSource, VolumeIdx, VolumeManager, SdCardSpiDevice}; //! //! fn example(spi: S, delay: D, ts: T) -> Result<(), Error> //! where -//! S: SdCardDevice, +//! S: SdCardSpiDevice, //! D: embedded_hal::delay::DelayNs, //! T: TimeSource, //! { diff --git a/src/sdcard/device.rs b/src/sdcard/device.rs index 34679d7..7e3c155 100644 --- a/src/sdcard/device.rs +++ b/src/sdcard/device.rs @@ -26,7 +26,7 @@ pub trait SdCardSpiDevice { /// /// This is a convenience method equivalent to `device.transaction(&mut [Operation::Read(buf)])`. /// - /// See also: [`SdCardDevice::transaction`], [`embedded_hal::spi::SpiBus::read`] + /// See also: [`SdCardSpiDevice::transaction`], [`embedded_hal::spi::SpiBus::read`] #[inline] fn read(&mut self, buf: &mut [u8]) -> Result<(), SdCardDeviceError> { self.transaction(&mut [Operation::Read(buf)]) @@ -36,7 +36,7 @@ pub trait SdCardSpiDevice { /// /// This is a convenience method equivalent to `device.transaction(&mut [Operation::Write(buf)])`. /// - /// See also: [`SdCardDevice::transaction`], [`embedded_hal::spi::SpiBus::write`] + /// See also: [`SdCardSpiDevice::transaction`], [`embedded_hal::spi::SpiBus::write`] #[inline] fn write(&mut self, buf: &[u8]) -> Result<(), SdCardDeviceError> { self.transaction(&mut [Operation::Write(buf)]) @@ -46,7 +46,7 @@ pub trait SdCardSpiDevice { /// /// This is a convenience method equivalent to `device.transaction(&mut [Operation::Transfer(read, write)]`. /// - /// See also: [`SdCardDevice::transaction`], [`embedded_hal::spi::SpiBus::transfer`] + /// See also: [`SdCardSpiDevice::transaction`], [`embedded_hal::spi::SpiBus::transfer`] #[inline] fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), SdCardDeviceError> { self.transaction(&mut [Operation::Transfer(read, write)]) @@ -56,7 +56,7 @@ pub trait SdCardSpiDevice { /// /// This is a convenience method equivalent to `device.transaction(&mut [Operation::TransferInPlace(buf)]`. /// - /// See also: [`SdCardDevice::transaction`], [`embedded_hal::spi::SpiBus::transfer_in_place`] + /// See also: [`SdCardSpiDevice::transaction`], [`embedded_hal::spi::SpiBus::transfer_in_place`] #[inline] fn transfer_in_place(&mut self, buf: &mut [u8]) -> Result<(), SdCardDeviceError> { self.transaction(&mut [Operation::TransferInPlace(buf)])