1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#[doc = "Reader of register CRCSTATUS"]
pub type R = crate::R<u32, super::CRCSTATUS>;
#[doc = "CRC status of packet received\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CRCSTATUS_A {
    #[doc = "0: Packet received with CRC error"]
    CRCERROR,
    #[doc = "1: Packet received with CRC ok"]
    CRCOK,
}
impl From<CRCSTATUS_A> for bool {
    #[inline(always)]
    fn from(variant: CRCSTATUS_A) -> Self {
        match variant {
            CRCSTATUS_A::CRCERROR => false,
            CRCSTATUS_A::CRCOK => true,
        }
    }
}
#[doc = "Reader of field `CRCSTATUS`"]
pub type CRCSTATUS_R = crate::R<bool, CRCSTATUS_A>;
impl CRCSTATUS_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> CRCSTATUS_A {
        match self.bits {
            false => CRCSTATUS_A::CRCERROR,
            true => CRCSTATUS_A::CRCOK,
        }
    }
    #[doc = "Checks if the value of the field is `CRCERROR`"]
    #[inline(always)]
    pub fn is_crcerror(&self) -> bool {
        *self == CRCSTATUS_A::CRCERROR
    }
    #[doc = "Checks if the value of the field is `CRCOK`"]
    #[inline(always)]
    pub fn is_crcok(&self) -> bool {
        *self == CRCSTATUS_A::CRCOK
    }
}
impl R {
    #[doc = "Bit 0 - CRC status of packet received"]
    #[inline(always)]
    pub fn crcstatus(&self) -> CRCSTATUS_R {
        CRCSTATUS_R::new((self.bits & 0x01) != 0)
    }
}