sdmmc_core/register/csd/wp_upc.rs
1use crate::lib_bool_enum;
2use crate::result::Result;
3
4lib_bool_enum! {
5 /// Represents the `WP_UPC` field of the `CSD` register.
6 WriteProtectUntilPowerCycle {
7 /// Indicates that write protection until power cycle is disabled.
8 Disabled = false,
9 /// Indicates that write protection until power cycle is enabled.
10 Enabled = true,
11 }
12}
13
14impl WriteProtectUntilPowerCycle {
15 /// Converts an inner representation into a [WriteProtectUntilPowerCycle].
16 pub const fn from_inner(val: bool) -> Self {
17 Self::from_bool(val)
18 }
19
20 /// Attempts to convert an inner representation into a [WriteProtectUntilPowerCycle].
21 pub const fn try_from_inner(val: bool) -> Result<Self> {
22 Ok(Self::from_bool(val))
23 }
24
25 /// Converts a [WriteProtectUntilPowerCycle] into an inner representation.
26 pub const fn into_inner(self) -> bool {
27 self.into_bool()
28 }
29}