sdmmc_core/register/ext_csd/context_conf/
direction_activation.rs

1use crate::lib_enum;
2use crate::result::{Error, Result};
3
4lib_enum! {
5    /// Represents the `Config Direction and Activate` sub-field of the `CONTEXT_CONF` field.
6    DirectionActivation: u8 {
7        default: ClosedInactive,
8        error: Error,
9        /// Indicates the connection is closed and inactive.
10        ClosedInactive = 0,
11        /// Indicates the connection is configured and active as write-only.
12        WriteOnly = 0b01,
13        /// Indicates the connection is configured and active as read-only.
14        ReadOnly = 0b10,
15        /// Indicates the connection is configured and active as read-write.
16        ReadWrite = 0b11,
17    }
18}
19
20impl DirectionActivation {
21    /// Attempts to convert an inner representation into a [DirectionActivation].
22    pub const fn try_from_inner(val: u8) -> Result<Self> {
23        Self::from_raw(val)
24    }
25
26    /// Converts the [DirectionActivation] into an inner representation.
27    pub const fn into_inner(self) -> u8 {
28        self.into_raw()
29    }
30}