atsame70n21/usart0/
us_cr.rs1#[doc = "Register `US_CR` writer"]
2pub struct W(crate::W<US_CR_SPEC>);
3impl core::ops::Deref for W {
4 type Target = crate::W<US_CR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl core::ops::DerefMut for W {
11 #[inline(always)]
12 fn deref_mut(&mut self) -> &mut Self::Target {
13 &mut self.0
14 }
15}
16impl From<crate::W<US_CR_SPEC>> for W {
17 #[inline(always)]
18 fn from(writer: crate::W<US_CR_SPEC>) -> Self {
19 W(writer)
20 }
21}
22#[doc = "Field `RSTRX` writer - Reset Receiver"]
23pub struct RSTRX_W<'a> {
24 w: &'a mut W,
25}
26impl<'a> RSTRX_W<'a> {
27 #[doc = r"Sets the field bit"]
28 #[inline(always)]
29 pub fn set_bit(self) -> &'a mut W {
30 self.bit(true)
31 }
32 #[doc = r"Clears the field bit"]
33 #[inline(always)]
34 pub fn clear_bit(self) -> &'a mut W {
35 self.bit(false)
36 }
37 #[doc = r"Writes raw bits to the field"]
38 #[inline(always)]
39 pub fn bit(self, value: bool) -> &'a mut W {
40 self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
41 self.w
42 }
43}
44#[doc = "Field `RSTTX` writer - Reset Transmitter"]
45pub struct RSTTX_W<'a> {
46 w: &'a mut W,
47}
48impl<'a> RSTTX_W<'a> {
49 #[doc = r"Sets the field bit"]
50 #[inline(always)]
51 pub fn set_bit(self) -> &'a mut W {
52 self.bit(true)
53 }
54 #[doc = r"Clears the field bit"]
55 #[inline(always)]
56 pub fn clear_bit(self) -> &'a mut W {
57 self.bit(false)
58 }
59 #[doc = r"Writes raw bits to the field"]
60 #[inline(always)]
61 pub fn bit(self, value: bool) -> &'a mut W {
62 self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
63 self.w
64 }
65}
66#[doc = "Field `RXEN` writer - Receiver Enable"]
67pub struct RXEN_W<'a> {
68 w: &'a mut W,
69}
70impl<'a> RXEN_W<'a> {
71 #[doc = r"Sets the field bit"]
72 #[inline(always)]
73 pub fn set_bit(self) -> &'a mut W {
74 self.bit(true)
75 }
76 #[doc = r"Clears the field bit"]
77 #[inline(always)]
78 pub fn clear_bit(self) -> &'a mut W {
79 self.bit(false)
80 }
81 #[doc = r"Writes raw bits to the field"]
82 #[inline(always)]
83 pub fn bit(self, value: bool) -> &'a mut W {
84 self.w.bits = (self.w.bits & !(0x01 << 4)) | ((value as u32 & 0x01) << 4);
85 self.w
86 }
87}
88#[doc = "Field `RXDIS` writer - Receiver Disable"]
89pub struct RXDIS_W<'a> {
90 w: &'a mut W,
91}
92impl<'a> RXDIS_W<'a> {
93 #[doc = r"Sets the field bit"]
94 #[inline(always)]
95 pub fn set_bit(self) -> &'a mut W {
96 self.bit(true)
97 }
98 #[doc = r"Clears the field bit"]
99 #[inline(always)]
100 pub fn clear_bit(self) -> &'a mut W {
101 self.bit(false)
102 }
103 #[doc = r"Writes raw bits to the field"]
104 #[inline(always)]
105 pub fn bit(self, value: bool) -> &'a mut W {
106 self.w.bits = (self.w.bits & !(0x01 << 5)) | ((value as u32 & 0x01) << 5);
107 self.w
108 }
109}
110#[doc = "Field `TXEN` writer - Transmitter Enable"]
111pub struct TXEN_W<'a> {
112 w: &'a mut W,
113}
114impl<'a> TXEN_W<'a> {
115 #[doc = r"Sets the field bit"]
116 #[inline(always)]
117 pub fn set_bit(self) -> &'a mut W {
118 self.bit(true)
119 }
120 #[doc = r"Clears the field bit"]
121 #[inline(always)]
122 pub fn clear_bit(self) -> &'a mut W {
123 self.bit(false)
124 }
125 #[doc = r"Writes raw bits to the field"]
126 #[inline(always)]
127 pub fn bit(self, value: bool) -> &'a mut W {
128 self.w.bits = (self.w.bits & !(0x01 << 6)) | ((value as u32 & 0x01) << 6);
129 self.w
130 }
131}
132#[doc = "Field `TXDIS` writer - Transmitter Disable"]
133pub struct TXDIS_W<'a> {
134 w: &'a mut W,
135}
136impl<'a> TXDIS_W<'a> {
137 #[doc = r"Sets the field bit"]
138 #[inline(always)]
139 pub fn set_bit(self) -> &'a mut W {
140 self.bit(true)
141 }
142 #[doc = r"Clears the field bit"]
143 #[inline(always)]
144 pub fn clear_bit(self) -> &'a mut W {
145 self.bit(false)
146 }
147 #[doc = r"Writes raw bits to the field"]
148 #[inline(always)]
149 pub fn bit(self, value: bool) -> &'a mut W {
150 self.w.bits = (self.w.bits & !(0x01 << 7)) | ((value as u32 & 0x01) << 7);
151 self.w
152 }
153}
154#[doc = "Field `RSTSTA` writer - Reset Status Bits"]
155pub struct RSTSTA_W<'a> {
156 w: &'a mut W,
157}
158impl<'a> RSTSTA_W<'a> {
159 #[doc = r"Sets the field bit"]
160 #[inline(always)]
161 pub fn set_bit(self) -> &'a mut W {
162 self.bit(true)
163 }
164 #[doc = r"Clears the field bit"]
165 #[inline(always)]
166 pub fn clear_bit(self) -> &'a mut W {
167 self.bit(false)
168 }
169 #[doc = r"Writes raw bits to the field"]
170 #[inline(always)]
171 pub fn bit(self, value: bool) -> &'a mut W {
172 self.w.bits = (self.w.bits & !(0x01 << 8)) | ((value as u32 & 0x01) << 8);
173 self.w
174 }
175}
176#[doc = "Field `STTBRK` writer - Start Break"]
177pub struct STTBRK_W<'a> {
178 w: &'a mut W,
179}
180impl<'a> STTBRK_W<'a> {
181 #[doc = r"Sets the field bit"]
182 #[inline(always)]
183 pub fn set_bit(self) -> &'a mut W {
184 self.bit(true)
185 }
186 #[doc = r"Clears the field bit"]
187 #[inline(always)]
188 pub fn clear_bit(self) -> &'a mut W {
189 self.bit(false)
190 }
191 #[doc = r"Writes raw bits to the field"]
192 #[inline(always)]
193 pub fn bit(self, value: bool) -> &'a mut W {
194 self.w.bits = (self.w.bits & !(0x01 << 9)) | ((value as u32 & 0x01) << 9);
195 self.w
196 }
197}
198#[doc = "Field `STPBRK` writer - Stop Break"]
199pub struct STPBRK_W<'a> {
200 w: &'a mut W,
201}
202impl<'a> STPBRK_W<'a> {
203 #[doc = r"Sets the field bit"]
204 #[inline(always)]
205 pub fn set_bit(self) -> &'a mut W {
206 self.bit(true)
207 }
208 #[doc = r"Clears the field bit"]
209 #[inline(always)]
210 pub fn clear_bit(self) -> &'a mut W {
211 self.bit(false)
212 }
213 #[doc = r"Writes raw bits to the field"]
214 #[inline(always)]
215 pub fn bit(self, value: bool) -> &'a mut W {
216 self.w.bits = (self.w.bits & !(0x01 << 10)) | ((value as u32 & 0x01) << 10);
217 self.w
218 }
219}
220#[doc = "Field `STTTO` writer - Clear TIMEOUT Flag and Start Time-out After Next Character Received"]
221pub struct STTTO_W<'a> {
222 w: &'a mut W,
223}
224impl<'a> STTTO_W<'a> {
225 #[doc = r"Sets the field bit"]
226 #[inline(always)]
227 pub fn set_bit(self) -> &'a mut W {
228 self.bit(true)
229 }
230 #[doc = r"Clears the field bit"]
231 #[inline(always)]
232 pub fn clear_bit(self) -> &'a mut W {
233 self.bit(false)
234 }
235 #[doc = r"Writes raw bits to the field"]
236 #[inline(always)]
237 pub fn bit(self, value: bool) -> &'a mut W {
238 self.w.bits = (self.w.bits & !(0x01 << 11)) | ((value as u32 & 0x01) << 11);
239 self.w
240 }
241}
242#[doc = "Field `SENDA` writer - Send Address"]
243pub struct SENDA_W<'a> {
244 w: &'a mut W,
245}
246impl<'a> SENDA_W<'a> {
247 #[doc = r"Sets the field bit"]
248 #[inline(always)]
249 pub fn set_bit(self) -> &'a mut W {
250 self.bit(true)
251 }
252 #[doc = r"Clears the field bit"]
253 #[inline(always)]
254 pub fn clear_bit(self) -> &'a mut W {
255 self.bit(false)
256 }
257 #[doc = r"Writes raw bits to the field"]
258 #[inline(always)]
259 pub fn bit(self, value: bool) -> &'a mut W {
260 self.w.bits = (self.w.bits & !(0x01 << 12)) | ((value as u32 & 0x01) << 12);
261 self.w
262 }
263}
264#[doc = "Field `RSTIT` writer - Reset Iterations"]
265pub struct RSTIT_W<'a> {
266 w: &'a mut W,
267}
268impl<'a> RSTIT_W<'a> {
269 #[doc = r"Sets the field bit"]
270 #[inline(always)]
271 pub fn set_bit(self) -> &'a mut W {
272 self.bit(true)
273 }
274 #[doc = r"Clears the field bit"]
275 #[inline(always)]
276 pub fn clear_bit(self) -> &'a mut W {
277 self.bit(false)
278 }
279 #[doc = r"Writes raw bits to the field"]
280 #[inline(always)]
281 pub fn bit(self, value: bool) -> &'a mut W {
282 self.w.bits = (self.w.bits & !(0x01 << 13)) | ((value as u32 & 0x01) << 13);
283 self.w
284 }
285}
286#[doc = "Field `RSTNACK` writer - Reset Non Acknowledge"]
287pub struct RSTNACK_W<'a> {
288 w: &'a mut W,
289}
290impl<'a> RSTNACK_W<'a> {
291 #[doc = r"Sets the field bit"]
292 #[inline(always)]
293 pub fn set_bit(self) -> &'a mut W {
294 self.bit(true)
295 }
296 #[doc = r"Clears the field bit"]
297 #[inline(always)]
298 pub fn clear_bit(self) -> &'a mut W {
299 self.bit(false)
300 }
301 #[doc = r"Writes raw bits to the field"]
302 #[inline(always)]
303 pub fn bit(self, value: bool) -> &'a mut W {
304 self.w.bits = (self.w.bits & !(0x01 << 14)) | ((value as u32 & 0x01) << 14);
305 self.w
306 }
307}
308#[doc = "Field `RETTO` writer - Start Time-out Immediately"]
309pub struct RETTO_W<'a> {
310 w: &'a mut W,
311}
312impl<'a> RETTO_W<'a> {
313 #[doc = r"Sets the field bit"]
314 #[inline(always)]
315 pub fn set_bit(self) -> &'a mut W {
316 self.bit(true)
317 }
318 #[doc = r"Clears the field bit"]
319 #[inline(always)]
320 pub fn clear_bit(self) -> &'a mut W {
321 self.bit(false)
322 }
323 #[doc = r"Writes raw bits to the field"]
324 #[inline(always)]
325 pub fn bit(self, value: bool) -> &'a mut W {
326 self.w.bits = (self.w.bits & !(0x01 << 15)) | ((value as u32 & 0x01) << 15);
327 self.w
328 }
329}
330#[doc = "Field `DTREN` writer - Data Terminal Ready Enable"]
331pub struct DTREN_W<'a> {
332 w: &'a mut W,
333}
334impl<'a> DTREN_W<'a> {
335 #[doc = r"Sets the field bit"]
336 #[inline(always)]
337 pub fn set_bit(self) -> &'a mut W {
338 self.bit(true)
339 }
340 #[doc = r"Clears the field bit"]
341 #[inline(always)]
342 pub fn clear_bit(self) -> &'a mut W {
343 self.bit(false)
344 }
345 #[doc = r"Writes raw bits to the field"]
346 #[inline(always)]
347 pub fn bit(self, value: bool) -> &'a mut W {
348 self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
349 self.w
350 }
351}
352#[doc = "Field `DTRDIS` writer - Data Terminal Ready Disable"]
353pub struct DTRDIS_W<'a> {
354 w: &'a mut W,
355}
356impl<'a> DTRDIS_W<'a> {
357 #[doc = r"Sets the field bit"]
358 #[inline(always)]
359 pub fn set_bit(self) -> &'a mut W {
360 self.bit(true)
361 }
362 #[doc = r"Clears the field bit"]
363 #[inline(always)]
364 pub fn clear_bit(self) -> &'a mut W {
365 self.bit(false)
366 }
367 #[doc = r"Writes raw bits to the field"]
368 #[inline(always)]
369 pub fn bit(self, value: bool) -> &'a mut W {
370 self.w.bits = (self.w.bits & !(0x01 << 17)) | ((value as u32 & 0x01) << 17);
371 self.w
372 }
373}
374#[doc = "Field `RTSEN` writer - Request to Send Pin Control"]
375pub struct RTSEN_W<'a> {
376 w: &'a mut W,
377}
378impl<'a> RTSEN_W<'a> {
379 #[doc = r"Sets the field bit"]
380 #[inline(always)]
381 pub fn set_bit(self) -> &'a mut W {
382 self.bit(true)
383 }
384 #[doc = r"Clears the field bit"]
385 #[inline(always)]
386 pub fn clear_bit(self) -> &'a mut W {
387 self.bit(false)
388 }
389 #[doc = r"Writes raw bits to the field"]
390 #[inline(always)]
391 pub fn bit(self, value: bool) -> &'a mut W {
392 self.w.bits = (self.w.bits & !(0x01 << 18)) | ((value as u32 & 0x01) << 18);
393 self.w
394 }
395}
396#[doc = "Field `RTSDIS` writer - Request to Send Pin Control"]
397pub struct RTSDIS_W<'a> {
398 w: &'a mut W,
399}
400impl<'a> RTSDIS_W<'a> {
401 #[doc = r"Sets the field bit"]
402 #[inline(always)]
403 pub fn set_bit(self) -> &'a mut W {
404 self.bit(true)
405 }
406 #[doc = r"Clears the field bit"]
407 #[inline(always)]
408 pub fn clear_bit(self) -> &'a mut W {
409 self.bit(false)
410 }
411 #[doc = r"Writes raw bits to the field"]
412 #[inline(always)]
413 pub fn bit(self, value: bool) -> &'a mut W {
414 self.w.bits = (self.w.bits & !(0x01 << 19)) | ((value as u32 & 0x01) << 19);
415 self.w
416 }
417}
418#[doc = "Field `LINABT` writer - Abort LIN Transmission"]
419pub struct LINABT_W<'a> {
420 w: &'a mut W,
421}
422impl<'a> LINABT_W<'a> {
423 #[doc = r"Sets the field bit"]
424 #[inline(always)]
425 pub fn set_bit(self) -> &'a mut W {
426 self.bit(true)
427 }
428 #[doc = r"Clears the field bit"]
429 #[inline(always)]
430 pub fn clear_bit(self) -> &'a mut W {
431 self.bit(false)
432 }
433 #[doc = r"Writes raw bits to the field"]
434 #[inline(always)]
435 pub fn bit(self, value: bool) -> &'a mut W {
436 self.w.bits = (self.w.bits & !(0x01 << 20)) | ((value as u32 & 0x01) << 20);
437 self.w
438 }
439}
440#[doc = "Field `LINWKUP` writer - Send LIN Wakeup Signal"]
441pub struct LINWKUP_W<'a> {
442 w: &'a mut W,
443}
444impl<'a> LINWKUP_W<'a> {
445 #[doc = r"Sets the field bit"]
446 #[inline(always)]
447 pub fn set_bit(self) -> &'a mut W {
448 self.bit(true)
449 }
450 #[doc = r"Clears the field bit"]
451 #[inline(always)]
452 pub fn clear_bit(self) -> &'a mut W {
453 self.bit(false)
454 }
455 #[doc = r"Writes raw bits to the field"]
456 #[inline(always)]
457 pub fn bit(self, value: bool) -> &'a mut W {
458 self.w.bits = (self.w.bits & !(0x01 << 21)) | ((value as u32 & 0x01) << 21);
459 self.w
460 }
461}
462impl W {
463 #[doc = "Bit 2 - Reset Receiver"]
464 #[inline(always)]
465 pub fn rstrx(&mut self) -> RSTRX_W {
466 RSTRX_W { w: self }
467 }
468 #[doc = "Bit 3 - Reset Transmitter"]
469 #[inline(always)]
470 pub fn rsttx(&mut self) -> RSTTX_W {
471 RSTTX_W { w: self }
472 }
473 #[doc = "Bit 4 - Receiver Enable"]
474 #[inline(always)]
475 pub fn rxen(&mut self) -> RXEN_W {
476 RXEN_W { w: self }
477 }
478 #[doc = "Bit 5 - Receiver Disable"]
479 #[inline(always)]
480 pub fn rxdis(&mut self) -> RXDIS_W {
481 RXDIS_W { w: self }
482 }
483 #[doc = "Bit 6 - Transmitter Enable"]
484 #[inline(always)]
485 pub fn txen(&mut self) -> TXEN_W {
486 TXEN_W { w: self }
487 }
488 #[doc = "Bit 7 - Transmitter Disable"]
489 #[inline(always)]
490 pub fn txdis(&mut self) -> TXDIS_W {
491 TXDIS_W { w: self }
492 }
493 #[doc = "Bit 8 - Reset Status Bits"]
494 #[inline(always)]
495 pub fn rststa(&mut self) -> RSTSTA_W {
496 RSTSTA_W { w: self }
497 }
498 #[doc = "Bit 9 - Start Break"]
499 #[inline(always)]
500 pub fn sttbrk(&mut self) -> STTBRK_W {
501 STTBRK_W { w: self }
502 }
503 #[doc = "Bit 10 - Stop Break"]
504 #[inline(always)]
505 pub fn stpbrk(&mut self) -> STPBRK_W {
506 STPBRK_W { w: self }
507 }
508 #[doc = "Bit 11 - Clear TIMEOUT Flag and Start Time-out After Next Character Received"]
509 #[inline(always)]
510 pub fn sttto(&mut self) -> STTTO_W {
511 STTTO_W { w: self }
512 }
513 #[doc = "Bit 12 - Send Address"]
514 #[inline(always)]
515 pub fn senda(&mut self) -> SENDA_W {
516 SENDA_W { w: self }
517 }
518 #[doc = "Bit 13 - Reset Iterations"]
519 #[inline(always)]
520 pub fn rstit(&mut self) -> RSTIT_W {
521 RSTIT_W { w: self }
522 }
523 #[doc = "Bit 14 - Reset Non Acknowledge"]
524 #[inline(always)]
525 pub fn rstnack(&mut self) -> RSTNACK_W {
526 RSTNACK_W { w: self }
527 }
528 #[doc = "Bit 15 - Start Time-out Immediately"]
529 #[inline(always)]
530 pub fn retto(&mut self) -> RETTO_W {
531 RETTO_W { w: self }
532 }
533 #[doc = "Bit 16 - Data Terminal Ready Enable"]
534 #[inline(always)]
535 pub fn dtren(&mut self) -> DTREN_W {
536 DTREN_W { w: self }
537 }
538 #[doc = "Bit 17 - Data Terminal Ready Disable"]
539 #[inline(always)]
540 pub fn dtrdis(&mut self) -> DTRDIS_W {
541 DTRDIS_W { w: self }
542 }
543 #[doc = "Bit 18 - Request to Send Pin Control"]
544 #[inline(always)]
545 pub fn rtsen(&mut self) -> RTSEN_W {
546 RTSEN_W { w: self }
547 }
548 #[doc = "Bit 19 - Request to Send Pin Control"]
549 #[inline(always)]
550 pub fn rtsdis(&mut self) -> RTSDIS_W {
551 RTSDIS_W { w: self }
552 }
553 #[doc = "Bit 20 - Abort LIN Transmission"]
554 #[inline(always)]
555 pub fn linabt(&mut self) -> LINABT_W {
556 LINABT_W { w: self }
557 }
558 #[doc = "Bit 21 - Send LIN Wakeup Signal"]
559 #[inline(always)]
560 pub fn linwkup(&mut self) -> LINWKUP_W {
561 LINWKUP_W { w: self }
562 }
563 #[doc = "Writes raw bits to the register."]
564 #[inline(always)]
565 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
566 self.0.bits(bits);
567 self
568 }
569}
570#[doc = "Control Register\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [us_cr](index.html) module"]
571pub struct US_CR_SPEC;
572impl crate::RegisterSpec for US_CR_SPEC {
573 type Ux = u32;
574}
575#[doc = "`write(|w| ..)` method takes [us_cr::W](W) writer structure"]
576impl crate::Writable for US_CR_SPEC {
577 type Writer = W;
578}
579#[doc = "`reset()` method sets US_CR to value 0"]
580impl crate::Resettable for US_CR_SPEC {
581 #[inline(always)]
582 fn reset_value() -> Self::Ux {
583 0
584 }
585}