sdmmc_core/register/ext_csd/command_set.rs
1use crate::result::{Error, Result};
2use crate::{lib_bitfield, lib_enum};
3
4lib_enum! {
5 /// Represents the selection variants for the `EXT_CSD` command set.
6 MmcCommandSet: u8 {
7 default: StandardMmc,
8 error: Error,
9 /// Selects the Standard MMC command set.
10 StandardMmc = 0,
11 /// Selects the MMCA allocated command set 1.
12 Mmca1 = 1,
13 /// Selects the MMCA allocated command set 2.
14 Mmca2 = 2,
15 /// Selects the MMCA allocated command set 3.
16 Mmca3 = 3,
17 /// Selects the MMCA allocated command set 4.
18 Mmca4 = 4,
19 }
20}
21
22impl MmcCommandSet {
23 /// Attempts to convert an inner representation into a [MmcCommandSet].
24 pub const fn try_from_inner(val: u8) -> Result<Self> {
25 Self::from_raw(val)
26 }
27
28 /// Converts a [MmcCommandSet] into an inner representation.
29 pub const fn into_inner(self) -> u8 {
30 self.into_raw()
31 }
32}