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 `BOOT_PARTITION_ENABLE` sub-field of the `PARTITION_CONFIG` field.
    BootPartitionEnable: u8 {
        default: NotEnabled,
        error: Error,
        /// Indicates the device is not boot enabled.
        NotEnabled = 0x0,
        /// Indicates boot partition 1 is enabled for boot.
        BootPart1 = 0x1,
        /// Indicates boot partition 2 is enabled for boot.
        BootPart2 = 0x2,
        /// Indicates user area is enabled for boot.
        UserArea = 0x7,
    }
}

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

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