Expand description
§embedded-sdmmc
An SD/MMC Library written in Embedded Rust
This crate is intended to allow you to read/write files on a FAT formatted
SD card on your Rust Embedded device, as easily as using the SdFat
Arduino
library. It is written in pure-Rust, is #![no_std]
and does not use
alloc
or collections
to keep the memory footprint low. In the first
instance it is designed for readability and simplicity over performance.
§Using the crate
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.
§Features
log
: Enabled by default. Generates log messages using thelog
crate.defmt-log
: By turning off the default features and enabling thedefmt-log
feature you can configure this crate to log messages over defmt instead.
You cannot enable both the log
feature and the defmt-log
feature.
Modules§
- Block Device support
- FAT16/FAT32 file system implementation
- Generic File System structures
Structs§
- Indicates whether a directory entry is read-only, a directory, a volume label, etc.
- Represents a standard 512 byte block (also known as a sector). IBM PC formatted 5.25“ and 3.5“ floppy disks, SD/MMC cards up to 1 GiB in size and IDE/SATA Hard Drives up to about 2 TiB all have 512 byte blocks.
- Represents the a number of blocks (or sectors). Add this to a
BlockIdx
to get an actual address on disk. - Represents the linear numeric address of a block (or sector). The first block on a disk gets
BlockIdx(0)
(which usually contains the Master Boot Record). - Identifies a cluster on disk.
- Represents a directory entry, which tells you about other files and directories.
- Represents an open directory on disk.
- Identifies a FAT16 or FAT32 Volume on the disk.
- Represents an open file on disk.
- An MS-DOS 8.3 filename. 7-bit ASCII only. All lower-case is converted to upper-case by default.
- Represents an instant in time, in the local time zone. TODO: Consider replacing this with POSIX time as a
u32
, which would save two bytes at the expense of some maths. - A
VolumeManager
wraps a block device and gives access to the FAT-formatted volumes within it.
Enums§
- Represents all the ways the functions in this crate can fail.
- Various filename related errors that can occur.
- The different ways we can open a file.
- This enum holds the data for the various different types of filesystems we support.
Constants§
- Maximum file size supported by this library
Traits§
- Represents a block device - a device which can read and write blocks (or sectors). Only supports devices which are <= 2 TiB in size.
- Things that impl this can tell you the current time.