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 `CSD_STRUCTURE` field of the [ExtCsd](super::ExtCsd) register.
    CsdStructure: u8 {
        default: Version10,
        error: Error,
        /// Represents CSD version v1.0 (allocated by MMCA).
        Version10 = 0,
        /// Represents CSD version v1.1 (allocated by MMCA).
        Version11 = 1,
        /// Represents CSD version v1.2 (versions 4.1-5.1).
        Version12 = 2,
    }
}

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

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