atsams70q21/usart0/
us_linmr.rs1#[doc = "Register `US_LINMR` reader"]
2pub struct R(crate::R<US_LINMR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<US_LINMR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<US_LINMR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<US_LINMR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `US_LINMR` writer"]
17pub struct W(crate::W<US_LINMR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<US_LINMR_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<US_LINMR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<US_LINMR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "LIN Node Action\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum NACT_A {
41 #[doc = "0: The USART transmits the response."]
42 PUBLISH = 0,
43 #[doc = "1: The USART receives the response."]
44 SUBSCRIBE = 1,
45 #[doc = "2: The USART does not transmit and does not receive the response."]
46 IGNORE = 2,
47}
48impl From<NACT_A> for u8 {
49 #[inline(always)]
50 fn from(variant: NACT_A) -> Self {
51 variant as _
52 }
53}
54#[doc = "Field `NACT` reader - LIN Node Action"]
55pub struct NACT_R(crate::FieldReader<u8, NACT_A>);
56impl NACT_R {
57 #[inline(always)]
58 pub(crate) fn new(bits: u8) -> Self {
59 NACT_R(crate::FieldReader::new(bits))
60 }
61 #[doc = r"Get enumerated values variant"]
62 #[inline(always)]
63 pub fn variant(&self) -> Option<NACT_A> {
64 match self.bits {
65 0 => Some(NACT_A::PUBLISH),
66 1 => Some(NACT_A::SUBSCRIBE),
67 2 => Some(NACT_A::IGNORE),
68 _ => None,
69 }
70 }
71 #[doc = "Checks if the value of the field is `PUBLISH`"]
72 #[inline(always)]
73 pub fn is_publish(&self) -> bool {
74 **self == NACT_A::PUBLISH
75 }
76 #[doc = "Checks if the value of the field is `SUBSCRIBE`"]
77 #[inline(always)]
78 pub fn is_subscribe(&self) -> bool {
79 **self == NACT_A::SUBSCRIBE
80 }
81 #[doc = "Checks if the value of the field is `IGNORE`"]
82 #[inline(always)]
83 pub fn is_ignore(&self) -> bool {
84 **self == NACT_A::IGNORE
85 }
86}
87impl core::ops::Deref for NACT_R {
88 type Target = crate::FieldReader<u8, NACT_A>;
89 #[inline(always)]
90 fn deref(&self) -> &Self::Target {
91 &self.0
92 }
93}
94#[doc = "Field `NACT` writer - LIN Node Action"]
95pub struct NACT_W<'a> {
96 w: &'a mut W,
97}
98impl<'a> NACT_W<'a> {
99 #[doc = r"Writes `variant` to the field"]
100 #[inline(always)]
101 pub fn variant(self, variant: NACT_A) -> &'a mut W {
102 unsafe { self.bits(variant.into()) }
103 }
104 #[doc = "The USART transmits the response."]
105 #[inline(always)]
106 pub fn publish(self) -> &'a mut W {
107 self.variant(NACT_A::PUBLISH)
108 }
109 #[doc = "The USART receives the response."]
110 #[inline(always)]
111 pub fn subscribe(self) -> &'a mut W {
112 self.variant(NACT_A::SUBSCRIBE)
113 }
114 #[doc = "The USART does not transmit and does not receive the response."]
115 #[inline(always)]
116 pub fn ignore(self) -> &'a mut W {
117 self.variant(NACT_A::IGNORE)
118 }
119 #[doc = r"Writes raw bits to the field"]
120 #[inline(always)]
121 pub unsafe fn bits(self, value: u8) -> &'a mut W {
122 self.w.bits = (self.w.bits & !0x03) | (value as u32 & 0x03);
123 self.w
124 }
125}
126#[doc = "Field `PARDIS` reader - Parity Disable"]
127pub struct PARDIS_R(crate::FieldReader<bool, bool>);
128impl PARDIS_R {
129 #[inline(always)]
130 pub(crate) fn new(bits: bool) -> Self {
131 PARDIS_R(crate::FieldReader::new(bits))
132 }
133}
134impl core::ops::Deref for PARDIS_R {
135 type Target = crate::FieldReader<bool, bool>;
136 #[inline(always)]
137 fn deref(&self) -> &Self::Target {
138 &self.0
139 }
140}
141#[doc = "Field `PARDIS` writer - Parity Disable"]
142pub struct PARDIS_W<'a> {
143 w: &'a mut W,
144}
145impl<'a> PARDIS_W<'a> {
146 #[doc = r"Sets the field bit"]
147 #[inline(always)]
148 pub fn set_bit(self) -> &'a mut W {
149 self.bit(true)
150 }
151 #[doc = r"Clears the field bit"]
152 #[inline(always)]
153 pub fn clear_bit(self) -> &'a mut W {
154 self.bit(false)
155 }
156 #[doc = r"Writes raw bits to the field"]
157 #[inline(always)]
158 pub fn bit(self, value: bool) -> &'a mut W {
159 self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
160 self.w
161 }
162}
163#[doc = "Field `CHKDIS` reader - Checksum Disable"]
164pub struct CHKDIS_R(crate::FieldReader<bool, bool>);
165impl CHKDIS_R {
166 #[inline(always)]
167 pub(crate) fn new(bits: bool) -> Self {
168 CHKDIS_R(crate::FieldReader::new(bits))
169 }
170}
171impl core::ops::Deref for CHKDIS_R {
172 type Target = crate::FieldReader<bool, bool>;
173 #[inline(always)]
174 fn deref(&self) -> &Self::Target {
175 &self.0
176 }
177}
178#[doc = "Field `CHKDIS` writer - Checksum Disable"]
179pub struct CHKDIS_W<'a> {
180 w: &'a mut W,
181}
182impl<'a> CHKDIS_W<'a> {
183 #[doc = r"Sets the field bit"]
184 #[inline(always)]
185 pub fn set_bit(self) -> &'a mut W {
186 self.bit(true)
187 }
188 #[doc = r"Clears the field bit"]
189 #[inline(always)]
190 pub fn clear_bit(self) -> &'a mut W {
191 self.bit(false)
192 }
193 #[doc = r"Writes raw bits to the field"]
194 #[inline(always)]
195 pub fn bit(self, value: bool) -> &'a mut W {
196 self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
197 self.w
198 }
199}
200#[doc = "Field `CHKTYP` reader - Checksum Type"]
201pub struct CHKTYP_R(crate::FieldReader<bool, bool>);
202impl CHKTYP_R {
203 #[inline(always)]
204 pub(crate) fn new(bits: bool) -> Self {
205 CHKTYP_R(crate::FieldReader::new(bits))
206 }
207}
208impl core::ops::Deref for CHKTYP_R {
209 type Target = crate::FieldReader<bool, bool>;
210 #[inline(always)]
211 fn deref(&self) -> &Self::Target {
212 &self.0
213 }
214}
215#[doc = "Field `CHKTYP` writer - Checksum Type"]
216pub struct CHKTYP_W<'a> {
217 w: &'a mut W,
218}
219impl<'a> CHKTYP_W<'a> {
220 #[doc = r"Sets the field bit"]
221 #[inline(always)]
222 pub fn set_bit(self) -> &'a mut W {
223 self.bit(true)
224 }
225 #[doc = r"Clears the field bit"]
226 #[inline(always)]
227 pub fn clear_bit(self) -> &'a mut W {
228 self.bit(false)
229 }
230 #[doc = r"Writes raw bits to the field"]
231 #[inline(always)]
232 pub fn bit(self, value: bool) -> &'a mut W {
233 self.w.bits = (self.w.bits & !(0x01 << 4)) | ((value as u32 & 0x01) << 4);
234 self.w
235 }
236}
237#[doc = "Field `DLM` reader - Data Length Mode"]
238pub struct DLM_R(crate::FieldReader<bool, bool>);
239impl DLM_R {
240 #[inline(always)]
241 pub(crate) fn new(bits: bool) -> Self {
242 DLM_R(crate::FieldReader::new(bits))
243 }
244}
245impl core::ops::Deref for DLM_R {
246 type Target = crate::FieldReader<bool, bool>;
247 #[inline(always)]
248 fn deref(&self) -> &Self::Target {
249 &self.0
250 }
251}
252#[doc = "Field `DLM` writer - Data Length Mode"]
253pub struct DLM_W<'a> {
254 w: &'a mut W,
255}
256impl<'a> DLM_W<'a> {
257 #[doc = r"Sets the field bit"]
258 #[inline(always)]
259 pub fn set_bit(self) -> &'a mut W {
260 self.bit(true)
261 }
262 #[doc = r"Clears the field bit"]
263 #[inline(always)]
264 pub fn clear_bit(self) -> &'a mut W {
265 self.bit(false)
266 }
267 #[doc = r"Writes raw bits to the field"]
268 #[inline(always)]
269 pub fn bit(self, value: bool) -> &'a mut W {
270 self.w.bits = (self.w.bits & !(0x01 << 5)) | ((value as u32 & 0x01) << 5);
271 self.w
272 }
273}
274#[doc = "Field `FSDIS` reader - Frame Slot Mode Disable"]
275pub struct FSDIS_R(crate::FieldReader<bool, bool>);
276impl FSDIS_R {
277 #[inline(always)]
278 pub(crate) fn new(bits: bool) -> Self {
279 FSDIS_R(crate::FieldReader::new(bits))
280 }
281}
282impl core::ops::Deref for FSDIS_R {
283 type Target = crate::FieldReader<bool, bool>;
284 #[inline(always)]
285 fn deref(&self) -> &Self::Target {
286 &self.0
287 }
288}
289#[doc = "Field `FSDIS` writer - Frame Slot Mode Disable"]
290pub struct FSDIS_W<'a> {
291 w: &'a mut W,
292}
293impl<'a> FSDIS_W<'a> {
294 #[doc = r"Sets the field bit"]
295 #[inline(always)]
296 pub fn set_bit(self) -> &'a mut W {
297 self.bit(true)
298 }
299 #[doc = r"Clears the field bit"]
300 #[inline(always)]
301 pub fn clear_bit(self) -> &'a mut W {
302 self.bit(false)
303 }
304 #[doc = r"Writes raw bits to the field"]
305 #[inline(always)]
306 pub fn bit(self, value: bool) -> &'a mut W {
307 self.w.bits = (self.w.bits & !(0x01 << 6)) | ((value as u32 & 0x01) << 6);
308 self.w
309 }
310}
311#[doc = "Field `WKUPTYP` reader - Wakeup Signal Type"]
312pub struct WKUPTYP_R(crate::FieldReader<bool, bool>);
313impl WKUPTYP_R {
314 #[inline(always)]
315 pub(crate) fn new(bits: bool) -> Self {
316 WKUPTYP_R(crate::FieldReader::new(bits))
317 }
318}
319impl core::ops::Deref for WKUPTYP_R {
320 type Target = crate::FieldReader<bool, bool>;
321 #[inline(always)]
322 fn deref(&self) -> &Self::Target {
323 &self.0
324 }
325}
326#[doc = "Field `WKUPTYP` writer - Wakeup Signal Type"]
327pub struct WKUPTYP_W<'a> {
328 w: &'a mut W,
329}
330impl<'a> WKUPTYP_W<'a> {
331 #[doc = r"Sets the field bit"]
332 #[inline(always)]
333 pub fn set_bit(self) -> &'a mut W {
334 self.bit(true)
335 }
336 #[doc = r"Clears the field bit"]
337 #[inline(always)]
338 pub fn clear_bit(self) -> &'a mut W {
339 self.bit(false)
340 }
341 #[doc = r"Writes raw bits to the field"]
342 #[inline(always)]
343 pub fn bit(self, value: bool) -> &'a mut W {
344 self.w.bits = (self.w.bits & !(0x01 << 7)) | ((value as u32 & 0x01) << 7);
345 self.w
346 }
347}
348#[doc = "Field `DLC` reader - Data Length Control"]
349pub struct DLC_R(crate::FieldReader<u8, u8>);
350impl DLC_R {
351 #[inline(always)]
352 pub(crate) fn new(bits: u8) -> Self {
353 DLC_R(crate::FieldReader::new(bits))
354 }
355}
356impl core::ops::Deref for DLC_R {
357 type Target = crate::FieldReader<u8, u8>;
358 #[inline(always)]
359 fn deref(&self) -> &Self::Target {
360 &self.0
361 }
362}
363#[doc = "Field `DLC` writer - Data Length Control"]
364pub struct DLC_W<'a> {
365 w: &'a mut W,
366}
367impl<'a> DLC_W<'a> {
368 #[doc = r"Writes raw bits to the field"]
369 #[inline(always)]
370 pub unsafe fn bits(self, value: u8) -> &'a mut W {
371 self.w.bits = (self.w.bits & !(0xff << 8)) | ((value as u32 & 0xff) << 8);
372 self.w
373 }
374}
375#[doc = "Field `PDCM` reader - DMAC Mode"]
376pub struct PDCM_R(crate::FieldReader<bool, bool>);
377impl PDCM_R {
378 #[inline(always)]
379 pub(crate) fn new(bits: bool) -> Self {
380 PDCM_R(crate::FieldReader::new(bits))
381 }
382}
383impl core::ops::Deref for PDCM_R {
384 type Target = crate::FieldReader<bool, bool>;
385 #[inline(always)]
386 fn deref(&self) -> &Self::Target {
387 &self.0
388 }
389}
390#[doc = "Field `PDCM` writer - DMAC Mode"]
391pub struct PDCM_W<'a> {
392 w: &'a mut W,
393}
394impl<'a> PDCM_W<'a> {
395 #[doc = r"Sets the field bit"]
396 #[inline(always)]
397 pub fn set_bit(self) -> &'a mut W {
398 self.bit(true)
399 }
400 #[doc = r"Clears the field bit"]
401 #[inline(always)]
402 pub fn clear_bit(self) -> &'a mut W {
403 self.bit(false)
404 }
405 #[doc = r"Writes raw bits to the field"]
406 #[inline(always)]
407 pub fn bit(self, value: bool) -> &'a mut W {
408 self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
409 self.w
410 }
411}
412#[doc = "Field `SYNCDIS` reader - Synchronization Disable"]
413pub struct SYNCDIS_R(crate::FieldReader<bool, bool>);
414impl SYNCDIS_R {
415 #[inline(always)]
416 pub(crate) fn new(bits: bool) -> Self {
417 SYNCDIS_R(crate::FieldReader::new(bits))
418 }
419}
420impl core::ops::Deref for SYNCDIS_R {
421 type Target = crate::FieldReader<bool, bool>;
422 #[inline(always)]
423 fn deref(&self) -> &Self::Target {
424 &self.0
425 }
426}
427#[doc = "Field `SYNCDIS` writer - Synchronization Disable"]
428pub struct SYNCDIS_W<'a> {
429 w: &'a mut W,
430}
431impl<'a> SYNCDIS_W<'a> {
432 #[doc = r"Sets the field bit"]
433 #[inline(always)]
434 pub fn set_bit(self) -> &'a mut W {
435 self.bit(true)
436 }
437 #[doc = r"Clears the field bit"]
438 #[inline(always)]
439 pub fn clear_bit(self) -> &'a mut W {
440 self.bit(false)
441 }
442 #[doc = r"Writes raw bits to the field"]
443 #[inline(always)]
444 pub fn bit(self, value: bool) -> &'a mut W {
445 self.w.bits = (self.w.bits & !(0x01 << 17)) | ((value as u32 & 0x01) << 17);
446 self.w
447 }
448}
449impl R {
450 #[doc = "Bits 0:1 - LIN Node Action"]
451 #[inline(always)]
452 pub fn nact(&self) -> NACT_R {
453 NACT_R::new((self.bits & 0x03) as u8)
454 }
455 #[doc = "Bit 2 - Parity Disable"]
456 #[inline(always)]
457 pub fn pardis(&self) -> PARDIS_R {
458 PARDIS_R::new(((self.bits >> 2) & 0x01) != 0)
459 }
460 #[doc = "Bit 3 - Checksum Disable"]
461 #[inline(always)]
462 pub fn chkdis(&self) -> CHKDIS_R {
463 CHKDIS_R::new(((self.bits >> 3) & 0x01) != 0)
464 }
465 #[doc = "Bit 4 - Checksum Type"]
466 #[inline(always)]
467 pub fn chktyp(&self) -> CHKTYP_R {
468 CHKTYP_R::new(((self.bits >> 4) & 0x01) != 0)
469 }
470 #[doc = "Bit 5 - Data Length Mode"]
471 #[inline(always)]
472 pub fn dlm(&self) -> DLM_R {
473 DLM_R::new(((self.bits >> 5) & 0x01) != 0)
474 }
475 #[doc = "Bit 6 - Frame Slot Mode Disable"]
476 #[inline(always)]
477 pub fn fsdis(&self) -> FSDIS_R {
478 FSDIS_R::new(((self.bits >> 6) & 0x01) != 0)
479 }
480 #[doc = "Bit 7 - Wakeup Signal Type"]
481 #[inline(always)]
482 pub fn wkuptyp(&self) -> WKUPTYP_R {
483 WKUPTYP_R::new(((self.bits >> 7) & 0x01) != 0)
484 }
485 #[doc = "Bits 8:15 - Data Length Control"]
486 #[inline(always)]
487 pub fn dlc(&self) -> DLC_R {
488 DLC_R::new(((self.bits >> 8) & 0xff) as u8)
489 }
490 #[doc = "Bit 16 - DMAC Mode"]
491 #[inline(always)]
492 pub fn pdcm(&self) -> PDCM_R {
493 PDCM_R::new(((self.bits >> 16) & 0x01) != 0)
494 }
495 #[doc = "Bit 17 - Synchronization Disable"]
496 #[inline(always)]
497 pub fn syncdis(&self) -> SYNCDIS_R {
498 SYNCDIS_R::new(((self.bits >> 17) & 0x01) != 0)
499 }
500}
501impl W {
502 #[doc = "Bits 0:1 - LIN Node Action"]
503 #[inline(always)]
504 pub fn nact(&mut self) -> NACT_W {
505 NACT_W { w: self }
506 }
507 #[doc = "Bit 2 - Parity Disable"]
508 #[inline(always)]
509 pub fn pardis(&mut self) -> PARDIS_W {
510 PARDIS_W { w: self }
511 }
512 #[doc = "Bit 3 - Checksum Disable"]
513 #[inline(always)]
514 pub fn chkdis(&mut self) -> CHKDIS_W {
515 CHKDIS_W { w: self }
516 }
517 #[doc = "Bit 4 - Checksum Type"]
518 #[inline(always)]
519 pub fn chktyp(&mut self) -> CHKTYP_W {
520 CHKTYP_W { w: self }
521 }
522 #[doc = "Bit 5 - Data Length Mode"]
523 #[inline(always)]
524 pub fn dlm(&mut self) -> DLM_W {
525 DLM_W { w: self }
526 }
527 #[doc = "Bit 6 - Frame Slot Mode Disable"]
528 #[inline(always)]
529 pub fn fsdis(&mut self) -> FSDIS_W {
530 FSDIS_W { w: self }
531 }
532 #[doc = "Bit 7 - Wakeup Signal Type"]
533 #[inline(always)]
534 pub fn wkuptyp(&mut self) -> WKUPTYP_W {
535 WKUPTYP_W { w: self }
536 }
537 #[doc = "Bits 8:15 - Data Length Control"]
538 #[inline(always)]
539 pub fn dlc(&mut self) -> DLC_W {
540 DLC_W { w: self }
541 }
542 #[doc = "Bit 16 - DMAC Mode"]
543 #[inline(always)]
544 pub fn pdcm(&mut self) -> PDCM_W {
545 PDCM_W { w: self }
546 }
547 #[doc = "Bit 17 - Synchronization Disable"]
548 #[inline(always)]
549 pub fn syncdis(&mut self) -> SYNCDIS_W {
550 SYNCDIS_W { w: self }
551 }
552 #[doc = "Writes raw bits to the register."]
553 #[inline(always)]
554 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
555 self.0.bits(bits);
556 self
557 }
558}
559#[doc = "LIN Mode Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [us_linmr](index.html) module"]
560pub struct US_LINMR_SPEC;
561impl crate::RegisterSpec for US_LINMR_SPEC {
562 type Ux = u32;
563}
564#[doc = "`read()` method returns [us_linmr::R](R) reader structure"]
565impl crate::Readable for US_LINMR_SPEC {
566 type Reader = R;
567}
568#[doc = "`write(|w| ..)` method takes [us_linmr::W](W) writer structure"]
569impl crate::Writable for US_LINMR_SPEC {
570 type Writer = W;
571}
572#[doc = "`reset()` method sets US_LINMR to value 0"]
573impl crate::Resettable for US_LINMR_SPEC {
574 #[inline(always)]
575 fn reset_value() -> Self::Ux {
576 0
577 }
578}