embedded_hal_sdmmc/card_type.rs
1/// Represents the card type of the peripheral.
2#[repr(u8)]
3#[derive(Clone, Copy, Debug, Eq, PartialEq)]
4pub enum CardType {
5 /// Represents a SD device.
6 Sd,
7 /// Represents a MMC device.
8 Mmc,
9}
10
11impl CardType {
12 /// Creates a new [CardType].
13 pub const fn new() -> Self {
14 Self::Sd
15 }
16
17 /// Convenience function to get if the [CardType] is a SD.
18 pub const fn is_sd(&self) -> bool {
19 matches!(self, Self::Sd)
20 }
21
22 /// Convenience function to get if the [CardType] is a MMC.
23 pub const fn is_mmc(&self) -> bool {
24 matches!(self, Self::Mmc)
25 }
26}
27
28impl Default for CardType {
29 fn default() -> Self {
30 Self::new()
31 }
32}