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 `TIMING_INTERFACE` sub-field of the `HS_TIMING` field.
    TimingInterface: u8 {
        default: BackwardsCompatible,
        error: Error,
        /// Selects a backwards compatible timing interface.
        BackwardsCompatible = 0x0,
        /// Selects a high speed timing interface.
        HighSpeed = 0x1,
        /// Selects a HS200 speed timing interface.
        HS200 = 0x2,
        /// Selects a HS400 speed timing interface.
        HS400 = 0x3,
    }
}

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

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