sdmmc-core 0.5.0

SD/MMC core data structures and algorithms
Documentation
use crate::lib_enum;
use crate::result::Error;

lib_enum! {
    /// Represents the maximum transfer rate unit for the SD memory card.
    TransferRateUnit: u8 {
        default: Mbits10,
        error: Error,
        /// Transfer rate: 100 kbit/s.
        Kbits100 = 0,
        /// Transfer rate: 1 Mbit/s.
        Mbits1 = 1,
        /// Transfer rate: 10 Mbit/s.
        Mbits10 = 2,
        /// Transfer rate: 100 Mbit/s.
        Mbits100 = 3,
    }
}

impl TransferRateUnit {
    /// Gets the kbit/s rate value of the [TransferRateUnit].
    pub const fn kbits(&self) -> u32 {
        match self {
            Self::Kbits100 => 100,
            Self::Mbits1 => 1000,
            Self::Mbits10 => 10_000,
            Self::Mbits100 => 100_000,
        }
    }
}