sdmmc-core 0.5.0

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

lib_enum! {
    /// Represents the `SPEC_VERS` field of the `CSD` register.
    SpecificationVersion: u8 {
        default: Version4x5x,
        error: Error,
        /// Represents MMCA version allocation 0.x.
        Mmca0 = 0,
        /// Represents MMCA version allocation 1.x.
        Mmca1 = 1,
        /// Represents MMCA version allocation 2.x.
        Mmca2 = 2,
        /// Represents MMCA version allocation 3.x.
        Mmca3 = 3,
        /// Represents MMC specification version 4.x - 5.x.
        Version4x5x = 4,
    }
}

impl SpecificationVersion {
    /// Attempts to convert an inner representation into a [SpecificationVersion].
    pub const fn try_from_inner(val: u8) -> Result<Self> {
        Self::from_raw(val)
    }

    /// Converts a [SpecificationVersion] into an inner representation.
    pub const fn into_inner(self) -> u8 {
        self.into_raw()
    }
}