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 `PARTITION_ACCESS` sub-field of the `PARTITION_CONFIG` field.
    PartitionAccess: u8 {
        default: NoAccess,
        error: Error,
        /// Indicates no access to boot partition.
        NoAccess = 0x0,
        /// Indicates read-write access to boot partition 1.
        BootPart1 = 0x1,
        /// Indicates read-write access to boot partition 2.
        BootPart2 = 0x2,
        /// Indicates read-write access to `Replay Protected Memory Block (RPMB)`.
        Rpmb = 0x3,
        /// Indicates read-write access to general purpose partition 1.
        GeneralPart1 = 0x4,
        /// Indicates read-write access to general purpose partition 2.
        GeneralPart2 = 0x5,
        /// Indicates read-write access to general purpose partition 3.
        GeneralPart3 = 0x6,
        /// Indicates read-write access to general purpose partition 4.
        GeneralPart4 = 0x7,
    }
}

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

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