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 `ECC` and `DEFAULT_ECC` sub-fields of the `CSD` register.
    Ecc: u8 {
        default: NoEcc,
        error: Error,
        /// Indicates no ECC algorithm is in use.
        NoEcc = 0,
        /// Indicates the BCH ECC algorithm is in use (max correctible bits: 3).
        Bch = 1,
    }
}

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

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