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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#[doc = "Reader of register ESR2"]
pub type R = crate::R<u32, super::ESR2>;
#[doc = "Inactive Mailbox\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum IMB_A {
    #[doc = "0: If CAN_ESR2\\[VPS\\]
is asserted, the CAN_ESR2\\[LPTM\\]
is not an inactive Mailbox."]
    IMB_0 = 0,
    #[doc = "1: If CAN_ESR2\\[VPS\\]
is asserted, there is at least one inactive Mailbox. LPTM content is the number of the first one."]
    IMB_1 = 1,
}
impl From<IMB_A> for bool {
    #[inline(always)]
    fn from(variant: IMB_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `IMB`"]
pub type IMB_R = crate::R<bool, IMB_A>;
impl IMB_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> IMB_A {
        match self.bits {
            false => IMB_A::IMB_0,
            true => IMB_A::IMB_1,
        }
    }
    #[doc = "Checks if the value of the field is `IMB_0`"]
    #[inline(always)]
    pub fn is_imb_0(&self) -> bool {
        *self == IMB_A::IMB_0
    }
    #[doc = "Checks if the value of the field is `IMB_1`"]
    #[inline(always)]
    pub fn is_imb_1(&self) -> bool {
        *self == IMB_A::IMB_1
    }
}
#[doc = "Valid Priority Status\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum VPS_A {
    #[doc = "0: Contents of IMB and LPTM are invalid."]
    VPS_0 = 0,
    #[doc = "1: Contents of IMB and LPTM are valid."]
    VPS_1 = 1,
}
impl From<VPS_A> for bool {
    #[inline(always)]
    fn from(variant: VPS_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `VPS`"]
pub type VPS_R = crate::R<bool, VPS_A>;
impl VPS_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> VPS_A {
        match self.bits {
            false => VPS_A::VPS_0,
            true => VPS_A::VPS_1,
        }
    }
    #[doc = "Checks if the value of the field is `VPS_0`"]
    #[inline(always)]
    pub fn is_vps_0(&self) -> bool {
        *self == VPS_A::VPS_0
    }
    #[doc = "Checks if the value of the field is `VPS_1`"]
    #[inline(always)]
    pub fn is_vps_1(&self) -> bool {
        *self == VPS_A::VPS_1
    }
}
#[doc = "Reader of field `LPTM`"]
pub type LPTM_R = crate::R<u8, u8>;
impl R {
    #[doc = "Bit 13 - Inactive Mailbox"]
    #[inline(always)]
    pub fn imb(&self) -> IMB_R {
        IMB_R::new(((self.bits >> 13) & 0x01) != 0)
    }
    #[doc = "Bit 14 - Valid Priority Status"]
    #[inline(always)]
    pub fn vps(&self) -> VPS_R {
        VPS_R::new(((self.bits >> 14) & 0x01) != 0)
    }
    #[doc = "Bits 16:22 - Lowest Priority Tx Mailbox"]
    #[inline(always)]
    pub fn lptm(&self) -> LPTM_R {
        LPTM_R::new(((self.bits >> 16) & 0x7f) as u8)
    }
}