xmc4400/can_node0/
nipr.rs

1#[doc = "Register `NIPR` reader"]
2pub type R = crate::R<NIPR_SPEC>;
3#[doc = "Register `NIPR` writer"]
4pub type W = crate::W<NIPR_SPEC>;
5#[doc = "Alert Interrupt Node Pointer\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum ALINP_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 = "7: Interrupt output line INT_O7 is selected."]
14    VALUE3 = 7,
15}
16impl From<ALINP_A> for u8 {
17    #[inline(always)]
18    fn from(variant: ALINP_A) -> Self {
19        variant as _
20    }
21}
22impl crate::FieldSpec for ALINP_A {
23    type Ux = u8;
24}
25impl crate::IsEnum for ALINP_A {}
26#[doc = "Field `ALINP` reader - Alert Interrupt Node Pointer"]
27pub type ALINP_R = crate::FieldReader<ALINP_A>;
28impl ALINP_R {
29    #[doc = "Get enumerated values variant"]
30    #[inline(always)]
31    pub const fn variant(&self) -> Option<ALINP_A> {
32        match self.bits {
33            0 => Some(ALINP_A::VALUE1),
34            1 => Some(ALINP_A::VALUE2),
35            7 => Some(ALINP_A::VALUE3),
36            _ => None,
37        }
38    }
39    #[doc = "Interrupt output line INT_O0 is selected."]
40    #[inline(always)]
41    pub fn is_value1(&self) -> bool {
42        *self == ALINP_A::VALUE1
43    }
44    #[doc = "Interrupt output line INT_O1 is selected."]
45    #[inline(always)]
46    pub fn is_value2(&self) -> bool {
47        *self == ALINP_A::VALUE2
48    }
49    #[doc = "Interrupt output line INT_O7 is selected."]
50    #[inline(always)]
51    pub fn is_value3(&self) -> bool {
52        *self == ALINP_A::VALUE3
53    }
54}
55#[doc = "Field `ALINP` writer - Alert Interrupt Node Pointer"]
56pub type ALINP_W<'a, REG> = crate::FieldWriter<'a, REG, 3, ALINP_A>;
57impl<'a, REG> ALINP_W<'a, REG>
58where
59    REG: crate::Writable + crate::RegisterSpec,
60    REG::Ux: From<u8>,
61{
62    #[doc = "Interrupt output line INT_O0 is selected."]
63    #[inline(always)]
64    pub fn value1(self) -> &'a mut crate::W<REG> {
65        self.variant(ALINP_A::VALUE1)
66    }
67    #[doc = "Interrupt output line INT_O1 is selected."]
68    #[inline(always)]
69    pub fn value2(self) -> &'a mut crate::W<REG> {
70        self.variant(ALINP_A::VALUE2)
71    }
72    #[doc = "Interrupt output line INT_O7 is selected."]
73    #[inline(always)]
74    pub fn value3(self) -> &'a mut crate::W<REG> {
75        self.variant(ALINP_A::VALUE3)
76    }
77}
78#[doc = "Last Error Code Interrupt Node Pointer\n\nValue on reset: 0"]
79#[derive(Clone, Copy, Debug, PartialEq, Eq)]
80#[repr(u8)]
81pub enum LECINP_A {
82    #[doc = "0: Interrupt output line INT_O0 is selected."]
83    VALUE1 = 0,
84    #[doc = "1: Interrupt output line INT_O1 is selected."]
85    VALUE2 = 1,
86    #[doc = "7: Interrupt output line INT_O7 is selected."]
87    VALUE3 = 7,
88}
89impl From<LECINP_A> for u8 {
90    #[inline(always)]
91    fn from(variant: LECINP_A) -> Self {
92        variant as _
93    }
94}
95impl crate::FieldSpec for LECINP_A {
96    type Ux = u8;
97}
98impl crate::IsEnum for LECINP_A {}
99#[doc = "Field `LECINP` reader - Last Error Code Interrupt Node Pointer"]
100pub type LECINP_R = crate::FieldReader<LECINP_A>;
101impl LECINP_R {
102    #[doc = "Get enumerated values variant"]
103    #[inline(always)]
104    pub const fn variant(&self) -> Option<LECINP_A> {
105        match self.bits {
106            0 => Some(LECINP_A::VALUE1),
107            1 => Some(LECINP_A::VALUE2),
108            7 => Some(LECINP_A::VALUE3),
109            _ => None,
110        }
111    }
112    #[doc = "Interrupt output line INT_O0 is selected."]
113    #[inline(always)]
114    pub fn is_value1(&self) -> bool {
115        *self == LECINP_A::VALUE1
116    }
117    #[doc = "Interrupt output line INT_O1 is selected."]
118    #[inline(always)]
119    pub fn is_value2(&self) -> bool {
120        *self == LECINP_A::VALUE2
121    }
122    #[doc = "Interrupt output line INT_O7 is selected."]
123    #[inline(always)]
124    pub fn is_value3(&self) -> bool {
125        *self == LECINP_A::VALUE3
126    }
127}
128#[doc = "Field `LECINP` writer - Last Error Code Interrupt Node Pointer"]
129pub type LECINP_W<'a, REG> = crate::FieldWriter<'a, REG, 3, LECINP_A>;
130impl<'a, REG> LECINP_W<'a, REG>
131where
132    REG: crate::Writable + crate::RegisterSpec,
133    REG::Ux: From<u8>,
134{
135    #[doc = "Interrupt output line INT_O0 is selected."]
136    #[inline(always)]
137    pub fn value1(self) -> &'a mut crate::W<REG> {
138        self.variant(LECINP_A::VALUE1)
139    }
140    #[doc = "Interrupt output line INT_O1 is selected."]
141    #[inline(always)]
142    pub fn value2(self) -> &'a mut crate::W<REG> {
143        self.variant(LECINP_A::VALUE2)
144    }
145    #[doc = "Interrupt output line INT_O7 is selected."]
146    #[inline(always)]
147    pub fn value3(self) -> &'a mut crate::W<REG> {
148        self.variant(LECINP_A::VALUE3)
149    }
150}
151#[doc = "Transfer OK Interrupt Node Pointer\n\nValue on reset: 0"]
152#[derive(Clone, Copy, Debug, PartialEq, Eq)]
153#[repr(u8)]
154pub enum TRINP_A {
155    #[doc = "0: Interrupt output line INT_O0 is selected."]
156    VALUE1 = 0,
157    #[doc = "1: Interrupt output line INT_O1 is selected."]
158    VALUE2 = 1,
159    #[doc = "7: Interrupt output line INT_O7 is selected."]
160    VALUE3 = 7,
161}
162impl From<TRINP_A> for u8 {
163    #[inline(always)]
164    fn from(variant: TRINP_A) -> Self {
165        variant as _
166    }
167}
168impl crate::FieldSpec for TRINP_A {
169    type Ux = u8;
170}
171impl crate::IsEnum for TRINP_A {}
172#[doc = "Field `TRINP` reader - Transfer OK Interrupt Node Pointer"]
173pub type TRINP_R = crate::FieldReader<TRINP_A>;
174impl TRINP_R {
175    #[doc = "Get enumerated values variant"]
176    #[inline(always)]
177    pub const fn variant(&self) -> Option<TRINP_A> {
178        match self.bits {
179            0 => Some(TRINP_A::VALUE1),
180            1 => Some(TRINP_A::VALUE2),
181            7 => Some(TRINP_A::VALUE3),
182            _ => None,
183        }
184    }
185    #[doc = "Interrupt output line INT_O0 is selected."]
186    #[inline(always)]
187    pub fn is_value1(&self) -> bool {
188        *self == TRINP_A::VALUE1
189    }
190    #[doc = "Interrupt output line INT_O1 is selected."]
191    #[inline(always)]
192    pub fn is_value2(&self) -> bool {
193        *self == TRINP_A::VALUE2
194    }
195    #[doc = "Interrupt output line INT_O7 is selected."]
196    #[inline(always)]
197    pub fn is_value3(&self) -> bool {
198        *self == TRINP_A::VALUE3
199    }
200}
201#[doc = "Field `TRINP` writer - Transfer OK Interrupt Node Pointer"]
202pub type TRINP_W<'a, REG> = crate::FieldWriter<'a, REG, 3, TRINP_A>;
203impl<'a, REG> TRINP_W<'a, REG>
204where
205    REG: crate::Writable + crate::RegisterSpec,
206    REG::Ux: From<u8>,
207{
208    #[doc = "Interrupt output line INT_O0 is selected."]
209    #[inline(always)]
210    pub fn value1(self) -> &'a mut crate::W<REG> {
211        self.variant(TRINP_A::VALUE1)
212    }
213    #[doc = "Interrupt output line INT_O1 is selected."]
214    #[inline(always)]
215    pub fn value2(self) -> &'a mut crate::W<REG> {
216        self.variant(TRINP_A::VALUE2)
217    }
218    #[doc = "Interrupt output line INT_O7 is selected."]
219    #[inline(always)]
220    pub fn value3(self) -> &'a mut crate::W<REG> {
221        self.variant(TRINP_A::VALUE3)
222    }
223}
224#[doc = "Frame Counter Interrupt Node Pointer\n\nValue on reset: 0"]
225#[derive(Clone, Copy, Debug, PartialEq, Eq)]
226#[repr(u8)]
227pub enum CFCINP_A {
228    #[doc = "0: Interrupt output line INT_O0 is selected."]
229    VALUE1 = 0,
230    #[doc = "1: Interrupt output line INT_O1 is selected."]
231    VALUE2 = 1,
232    #[doc = "7: Interrupt output line INT_O7 is selected."]
233    VALUE3 = 7,
234}
235impl From<CFCINP_A> for u8 {
236    #[inline(always)]
237    fn from(variant: CFCINP_A) -> Self {
238        variant as _
239    }
240}
241impl crate::FieldSpec for CFCINP_A {
242    type Ux = u8;
243}
244impl crate::IsEnum for CFCINP_A {}
245#[doc = "Field `CFCINP` reader - Frame Counter Interrupt Node Pointer"]
246pub type CFCINP_R = crate::FieldReader<CFCINP_A>;
247impl CFCINP_R {
248    #[doc = "Get enumerated values variant"]
249    #[inline(always)]
250    pub const fn variant(&self) -> Option<CFCINP_A> {
251        match self.bits {
252            0 => Some(CFCINP_A::VALUE1),
253            1 => Some(CFCINP_A::VALUE2),
254            7 => Some(CFCINP_A::VALUE3),
255            _ => None,
256        }
257    }
258    #[doc = "Interrupt output line INT_O0 is selected."]
259    #[inline(always)]
260    pub fn is_value1(&self) -> bool {
261        *self == CFCINP_A::VALUE1
262    }
263    #[doc = "Interrupt output line INT_O1 is selected."]
264    #[inline(always)]
265    pub fn is_value2(&self) -> bool {
266        *self == CFCINP_A::VALUE2
267    }
268    #[doc = "Interrupt output line INT_O7 is selected."]
269    #[inline(always)]
270    pub fn is_value3(&self) -> bool {
271        *self == CFCINP_A::VALUE3
272    }
273}
274#[doc = "Field `CFCINP` writer - Frame Counter Interrupt Node Pointer"]
275pub type CFCINP_W<'a, REG> = crate::FieldWriter<'a, REG, 3, CFCINP_A>;
276impl<'a, REG> CFCINP_W<'a, REG>
277where
278    REG: crate::Writable + crate::RegisterSpec,
279    REG::Ux: From<u8>,
280{
281    #[doc = "Interrupt output line INT_O0 is selected."]
282    #[inline(always)]
283    pub fn value1(self) -> &'a mut crate::W<REG> {
284        self.variant(CFCINP_A::VALUE1)
285    }
286    #[doc = "Interrupt output line INT_O1 is selected."]
287    #[inline(always)]
288    pub fn value2(self) -> &'a mut crate::W<REG> {
289        self.variant(CFCINP_A::VALUE2)
290    }
291    #[doc = "Interrupt output line INT_O7 is selected."]
292    #[inline(always)]
293    pub fn value3(self) -> &'a mut crate::W<REG> {
294        self.variant(CFCINP_A::VALUE3)
295    }
296}
297impl R {
298    #[doc = "Bits 0:2 - Alert Interrupt Node Pointer"]
299    #[inline(always)]
300    pub fn alinp(&self) -> ALINP_R {
301        ALINP_R::new((self.bits & 7) as u8)
302    }
303    #[doc = "Bits 4:6 - Last Error Code Interrupt Node Pointer"]
304    #[inline(always)]
305    pub fn lecinp(&self) -> LECINP_R {
306        LECINP_R::new(((self.bits >> 4) & 7) as u8)
307    }
308    #[doc = "Bits 8:10 - Transfer OK Interrupt Node Pointer"]
309    #[inline(always)]
310    pub fn trinp(&self) -> TRINP_R {
311        TRINP_R::new(((self.bits >> 8) & 7) as u8)
312    }
313    #[doc = "Bits 12:14 - Frame Counter Interrupt Node Pointer"]
314    #[inline(always)]
315    pub fn cfcinp(&self) -> CFCINP_R {
316        CFCINP_R::new(((self.bits >> 12) & 7) as u8)
317    }
318}
319impl W {
320    #[doc = "Bits 0:2 - Alert Interrupt Node Pointer"]
321    #[inline(always)]
322    pub fn alinp(&mut self) -> ALINP_W<NIPR_SPEC> {
323        ALINP_W::new(self, 0)
324    }
325    #[doc = "Bits 4:6 - Last Error Code Interrupt Node Pointer"]
326    #[inline(always)]
327    pub fn lecinp(&mut self) -> LECINP_W<NIPR_SPEC> {
328        LECINP_W::new(self, 4)
329    }
330    #[doc = "Bits 8:10 - Transfer OK Interrupt Node Pointer"]
331    #[inline(always)]
332    pub fn trinp(&mut self) -> TRINP_W<NIPR_SPEC> {
333        TRINP_W::new(self, 8)
334    }
335    #[doc = "Bits 12:14 - Frame Counter Interrupt Node Pointer"]
336    #[inline(always)]
337    pub fn cfcinp(&mut self) -> CFCINP_W<NIPR_SPEC> {
338        CFCINP_W::new(self, 12)
339    }
340}
341#[doc = "Node Interrupt Pointer Register\n\nYou can [`read`](crate::Reg::read) this register and get [`nipr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`nipr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
342pub struct NIPR_SPEC;
343impl crate::RegisterSpec for NIPR_SPEC {
344    type Ux = u32;
345}
346#[doc = "`read()` method returns [`nipr::R`](R) reader structure"]
347impl crate::Readable for NIPR_SPEC {}
348#[doc = "`write(|w| ..)` method takes [`nipr::W`](W) writer structure"]
349impl crate::Writable for NIPR_SPEC {
350    type Safety = crate::Unsafe;
351    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
352    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
353}
354#[doc = "`reset()` method sets NIPR to value 0"]
355impl crate::Resettable for NIPR_SPEC {
356    const RESET_VALUE: u32 = 0;
357}