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 `WAKEUP_UNIT` sub-field of the [PeriodicWakeup](super::PeriodicWakeup) field.
    WakeupUnit: u8 {
        default: Infinity,
        error: Error,
        /// The period between wakeups is inifinite, no wakeups.
        Infinity = 0x0,
        /// The period between wakeups is months.
        Months = 0x1,
        /// The period between wakeups is weeks.
        Weeks = 0x2,
        /// The period between wakeups is days.
        Days = 0x3,
        /// The period between wakeups is hours.
        Hours = 0x4,
        /// The period between wakeups is minutes.
        Minutes = 0x5,
    }
}

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

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