xmc4300/can_mo/mo/
moipr.rs

1#[doc = "Register `MOIPR` reader"]
2pub type R = crate::R<MOIPR_SPEC>;
3#[doc = "Register `MOIPR` writer"]
4pub type W = crate::W<MOIPR_SPEC>;
5#[doc = "Receive Interrupt Node Pointer\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum RXINP_A {
9    #[doc = "0: Interrupt output line INT_O0 is selected."]
10    VALUE1 = 0,
11    #[doc = "1: Interrupt output line INT_O1 is selected."]
12    VALUE2 = 1,
13    #[doc = "14: Interrupt output line INT_O14 is selected."]
14    VALUE3 = 14,
15    #[doc = "15: Interrupt output line INT_O15 is selected."]
16    VALUE4 = 15,
17}
18impl From<RXINP_A> for u8 {
19    #[inline(always)]
20    fn from(variant: RXINP_A) -> Self {
21        variant as _
22    }
23}
24impl crate::FieldSpec for RXINP_A {
25    type Ux = u8;
26}
27impl crate::IsEnum for RXINP_A {}
28#[doc = "Field `RXINP` reader - Receive Interrupt Node Pointer"]
29pub type RXINP_R = crate::FieldReader<RXINP_A>;
30impl RXINP_R {
31    #[doc = "Get enumerated values variant"]
32    #[inline(always)]
33    pub const fn variant(&self) -> Option<RXINP_A> {
34        match self.bits {
35            0 => Some(RXINP_A::VALUE1),
36            1 => Some(RXINP_A::VALUE2),
37            14 => Some(RXINP_A::VALUE3),
38            15 => Some(RXINP_A::VALUE4),
39            _ => None,
40        }
41    }
42    #[doc = "Interrupt output line INT_O0 is selected."]
43    #[inline(always)]
44    pub fn is_value1(&self) -> bool {
45        *self == RXINP_A::VALUE1
46    }
47    #[doc = "Interrupt output line INT_O1 is selected."]
48    #[inline(always)]
49    pub fn is_value2(&self) -> bool {
50        *self == RXINP_A::VALUE2
51    }
52    #[doc = "Interrupt output line INT_O14 is selected."]
53    #[inline(always)]
54    pub fn is_value3(&self) -> bool {
55        *self == RXINP_A::VALUE3
56    }
57    #[doc = "Interrupt output line INT_O15 is selected."]
58    #[inline(always)]
59    pub fn is_value4(&self) -> bool {
60        *self == RXINP_A::VALUE4
61    }
62}
63#[doc = "Field `RXINP` writer - Receive Interrupt Node Pointer"]
64pub type RXINP_W<'a, REG> = crate::FieldWriter<'a, REG, 4, RXINP_A>;
65impl<'a, REG> RXINP_W<'a, REG>
66where
67    REG: crate::Writable + crate::RegisterSpec,
68    REG::Ux: From<u8>,
69{
70    #[doc = "Interrupt output line INT_O0 is selected."]
71    #[inline(always)]
72    pub fn value1(self) -> &'a mut crate::W<REG> {
73        self.variant(RXINP_A::VALUE1)
74    }
75    #[doc = "Interrupt output line INT_O1 is selected."]
76    #[inline(always)]
77    pub fn value2(self) -> &'a mut crate::W<REG> {
78        self.variant(RXINP_A::VALUE2)
79    }
80    #[doc = "Interrupt output line INT_O14 is selected."]
81    #[inline(always)]
82    pub fn value3(self) -> &'a mut crate::W<REG> {
83        self.variant(RXINP_A::VALUE3)
84    }
85    #[doc = "Interrupt output line INT_O15 is selected."]
86    #[inline(always)]
87    pub fn value4(self) -> &'a mut crate::W<REG> {
88        self.variant(RXINP_A::VALUE4)
89    }
90}
91#[doc = "Transmit Interrupt Node Pointer\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq, Eq)]
93#[repr(u8)]
94pub enum TXINP_A {
95    #[doc = "0: Interrupt output line INT_O0 is selected."]
96    VALUE1 = 0,
97    #[doc = "1: Interrupt output line INT_O1 is selected."]
98    VALUE2 = 1,
99    #[doc = "14: Interrupt output line INT_O14 is selected."]
100    VALUE3 = 14,
101    #[doc = "15: Interrupt output line INT_O15 is selected."]
102    VALUE4 = 15,
103}
104impl From<TXINP_A> for u8 {
105    #[inline(always)]
106    fn from(variant: TXINP_A) -> Self {
107        variant as _
108    }
109}
110impl crate::FieldSpec for TXINP_A {
111    type Ux = u8;
112}
113impl crate::IsEnum for TXINP_A {}
114#[doc = "Field `TXINP` reader - Transmit Interrupt Node Pointer"]
115pub type TXINP_R = crate::FieldReader<TXINP_A>;
116impl TXINP_R {
117    #[doc = "Get enumerated values variant"]
118    #[inline(always)]
119    pub const fn variant(&self) -> Option<TXINP_A> {
120        match self.bits {
121            0 => Some(TXINP_A::VALUE1),
122            1 => Some(TXINP_A::VALUE2),
123            14 => Some(TXINP_A::VALUE3),
124            15 => Some(TXINP_A::VALUE4),
125            _ => None,
126        }
127    }
128    #[doc = "Interrupt output line INT_O0 is selected."]
129    #[inline(always)]
130    pub fn is_value1(&self) -> bool {
131        *self == TXINP_A::VALUE1
132    }
133    #[doc = "Interrupt output line INT_O1 is selected."]
134    #[inline(always)]
135    pub fn is_value2(&self) -> bool {
136        *self == TXINP_A::VALUE2
137    }
138    #[doc = "Interrupt output line INT_O14 is selected."]
139    #[inline(always)]
140    pub fn is_value3(&self) -> bool {
141        *self == TXINP_A::VALUE3
142    }
143    #[doc = "Interrupt output line INT_O15 is selected."]
144    #[inline(always)]
145    pub fn is_value4(&self) -> bool {
146        *self == TXINP_A::VALUE4
147    }
148}
149#[doc = "Field `TXINP` writer - Transmit Interrupt Node Pointer"]
150pub type TXINP_W<'a, REG> = crate::FieldWriter<'a, REG, 4, TXINP_A>;
151impl<'a, REG> TXINP_W<'a, REG>
152where
153    REG: crate::Writable + crate::RegisterSpec,
154    REG::Ux: From<u8>,
155{
156    #[doc = "Interrupt output line INT_O0 is selected."]
157    #[inline(always)]
158    pub fn value1(self) -> &'a mut crate::W<REG> {
159        self.variant(TXINP_A::VALUE1)
160    }
161    #[doc = "Interrupt output line INT_O1 is selected."]
162    #[inline(always)]
163    pub fn value2(self) -> &'a mut crate::W<REG> {
164        self.variant(TXINP_A::VALUE2)
165    }
166    #[doc = "Interrupt output line INT_O14 is selected."]
167    #[inline(always)]
168    pub fn value3(self) -> &'a mut crate::W<REG> {
169        self.variant(TXINP_A::VALUE3)
170    }
171    #[doc = "Interrupt output line INT_O15 is selected."]
172    #[inline(always)]
173    pub fn value4(self) -> &'a mut crate::W<REG> {
174        self.variant(TXINP_A::VALUE4)
175    }
176}
177#[doc = "Field `MPN` reader - Message Pending Number"]
178pub type MPN_R = crate::FieldReader;
179#[doc = "Field `MPN` writer - Message Pending Number"]
180pub type MPN_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
181#[doc = "Field `CFCVAL` reader - CAN Frame Counter Value"]
182pub type CFCVAL_R = crate::FieldReader<u16>;
183#[doc = "Field `CFCVAL` writer - CAN Frame Counter Value"]
184pub type CFCVAL_W<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
185impl R {
186    #[doc = "Bits 0:3 - Receive Interrupt Node Pointer"]
187    #[inline(always)]
188    pub fn rxinp(&self) -> RXINP_R {
189        RXINP_R::new((self.bits & 0x0f) as u8)
190    }
191    #[doc = "Bits 4:7 - Transmit Interrupt Node Pointer"]
192    #[inline(always)]
193    pub fn txinp(&self) -> TXINP_R {
194        TXINP_R::new(((self.bits >> 4) & 0x0f) as u8)
195    }
196    #[doc = "Bits 8:15 - Message Pending Number"]
197    #[inline(always)]
198    pub fn mpn(&self) -> MPN_R {
199        MPN_R::new(((self.bits >> 8) & 0xff) as u8)
200    }
201    #[doc = "Bits 16:31 - CAN Frame Counter Value"]
202    #[inline(always)]
203    pub fn cfcval(&self) -> CFCVAL_R {
204        CFCVAL_R::new(((self.bits >> 16) & 0xffff) as u16)
205    }
206}
207impl W {
208    #[doc = "Bits 0:3 - Receive Interrupt Node Pointer"]
209    #[inline(always)]
210    pub fn rxinp(&mut self) -> RXINP_W<MOIPR_SPEC> {
211        RXINP_W::new(self, 0)
212    }
213    #[doc = "Bits 4:7 - Transmit Interrupt Node Pointer"]
214    #[inline(always)]
215    pub fn txinp(&mut self) -> TXINP_W<MOIPR_SPEC> {
216        TXINP_W::new(self, 4)
217    }
218    #[doc = "Bits 8:15 - Message Pending Number"]
219    #[inline(always)]
220    pub fn mpn(&mut self) -> MPN_W<MOIPR_SPEC> {
221        MPN_W::new(self, 8)
222    }
223    #[doc = "Bits 16:31 - CAN Frame Counter Value"]
224    #[inline(always)]
225    pub fn cfcval(&mut self) -> CFCVAL_W<MOIPR_SPEC> {
226        CFCVAL_W::new(self, 16)
227    }
228}
229#[doc = "Message Object Interrupt Pointer Register\n\nYou can [`read`](crate::Reg::read) this register and get [`moipr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`moipr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
230pub struct MOIPR_SPEC;
231impl crate::RegisterSpec for MOIPR_SPEC {
232    type Ux = u32;
233}
234#[doc = "`read()` method returns [`moipr::R`](R) reader structure"]
235impl crate::Readable for MOIPR_SPEC {}
236#[doc = "`write(|w| ..)` method takes [`moipr::W`](W) writer structure"]
237impl crate::Writable for MOIPR_SPEC {
238    type Safety = crate::Unsafe;
239    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
240    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
241}
242#[doc = "`reset()` method sets MOIPR to value 0"]
243impl crate::Resettable for MOIPR_SPEC {
244    const RESET_VALUE: u32 = 0;
245}