1#[doc = "Register `MODIR` reader"]
2pub type R = crate::R<ModirSpec>;
3#[doc = "Register `MODIR` writer"]
4pub type W = crate::W<ModirSpec>;
5#[doc = "Transmitter CTS Enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Txctse {
9 #[doc = "0: Disable"]
10 Disabled = 0,
11 #[doc = "1: Enable"]
12 Enabled = 1,
13}
14impl From<Txctse> for bool {
15 #[inline(always)]
16 fn from(variant: Txctse) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `TXCTSE` reader - Transmitter CTS Enable"]
21pub type TxctseR = crate::BitReader<Txctse>;
22impl TxctseR {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> Txctse {
26 match self.bits {
27 false => Txctse::Disabled,
28 true => Txctse::Enabled,
29 }
30 }
31 #[doc = "Disable"]
32 #[inline(always)]
33 pub fn is_disabled(&self) -> bool {
34 *self == Txctse::Disabled
35 }
36 #[doc = "Enable"]
37 #[inline(always)]
38 pub fn is_enabled(&self) -> bool {
39 *self == Txctse::Enabled
40 }
41}
42#[doc = "Field `TXCTSE` writer - Transmitter CTS Enable"]
43pub type TxctseW<'a, REG> = crate::BitWriter<'a, REG, Txctse>;
44impl<'a, REG> TxctseW<'a, REG>
45where
46 REG: crate::Writable + crate::RegisterSpec,
47{
48 #[doc = "Disable"]
49 #[inline(always)]
50 pub fn disabled(self) -> &'a mut crate::W<REG> {
51 self.variant(Txctse::Disabled)
52 }
53 #[doc = "Enable"]
54 #[inline(always)]
55 pub fn enabled(self) -> &'a mut crate::W<REG> {
56 self.variant(Txctse::Enabled)
57 }
58}
59#[doc = "Transmitter RTS Enable\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Txrtse {
63 #[doc = "0: Disable"]
64 Disabled = 0,
65 #[doc = "1: Enable"]
66 Enabled = 1,
67}
68impl From<Txrtse> for bool {
69 #[inline(always)]
70 fn from(variant: Txrtse) -> Self {
71 variant as u8 != 0
72 }
73}
74#[doc = "Field `TXRTSE` reader - Transmitter RTS Enable"]
75pub type TxrtseR = crate::BitReader<Txrtse>;
76impl TxrtseR {
77 #[doc = "Get enumerated values variant"]
78 #[inline(always)]
79 pub const fn variant(&self) -> Txrtse {
80 match self.bits {
81 false => Txrtse::Disabled,
82 true => Txrtse::Enabled,
83 }
84 }
85 #[doc = "Disable"]
86 #[inline(always)]
87 pub fn is_disabled(&self) -> bool {
88 *self == Txrtse::Disabled
89 }
90 #[doc = "Enable"]
91 #[inline(always)]
92 pub fn is_enabled(&self) -> bool {
93 *self == Txrtse::Enabled
94 }
95}
96#[doc = "Field `TXRTSE` writer - Transmitter RTS Enable"]
97pub type TxrtseW<'a, REG> = crate::BitWriter<'a, REG, Txrtse>;
98impl<'a, REG> TxrtseW<'a, REG>
99where
100 REG: crate::Writable + crate::RegisterSpec,
101{
102 #[doc = "Disable"]
103 #[inline(always)]
104 pub fn disabled(self) -> &'a mut crate::W<REG> {
105 self.variant(Txrtse::Disabled)
106 }
107 #[doc = "Enable"]
108 #[inline(always)]
109 pub fn enabled(self) -> &'a mut crate::W<REG> {
110 self.variant(Txrtse::Enabled)
111 }
112}
113#[doc = "Transmitter RTS Polarity\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum Txrtspol {
117 #[doc = "0: Active low"]
118 Low = 0,
119 #[doc = "1: Active high"]
120 High = 1,
121}
122impl From<Txrtspol> for bool {
123 #[inline(always)]
124 fn from(variant: Txrtspol) -> Self {
125 variant as u8 != 0
126 }
127}
128#[doc = "Field `TXRTSPOL` reader - Transmitter RTS Polarity"]
129pub type TxrtspolR = crate::BitReader<Txrtspol>;
130impl TxrtspolR {
131 #[doc = "Get enumerated values variant"]
132 #[inline(always)]
133 pub const fn variant(&self) -> Txrtspol {
134 match self.bits {
135 false => Txrtspol::Low,
136 true => Txrtspol::High,
137 }
138 }
139 #[doc = "Active low"]
140 #[inline(always)]
141 pub fn is_low(&self) -> bool {
142 *self == Txrtspol::Low
143 }
144 #[doc = "Active high"]
145 #[inline(always)]
146 pub fn is_high(&self) -> bool {
147 *self == Txrtspol::High
148 }
149}
150#[doc = "Field `TXRTSPOL` writer - Transmitter RTS Polarity"]
151pub type TxrtspolW<'a, REG> = crate::BitWriter<'a, REG, Txrtspol>;
152impl<'a, REG> TxrtspolW<'a, REG>
153where
154 REG: crate::Writable + crate::RegisterSpec,
155{
156 #[doc = "Active low"]
157 #[inline(always)]
158 pub fn low(self) -> &'a mut crate::W<REG> {
159 self.variant(Txrtspol::Low)
160 }
161 #[doc = "Active high"]
162 #[inline(always)]
163 pub fn high(self) -> &'a mut crate::W<REG> {
164 self.variant(Txrtspol::High)
165 }
166}
167#[doc = "Receiver RTS Enable\n\nValue on reset: 0"]
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum Rxrtse {
171 #[doc = "0: Disable"]
172 Disabled = 0,
173 #[doc = "1: Enable"]
174 Enabled = 1,
175}
176impl From<Rxrtse> for bool {
177 #[inline(always)]
178 fn from(variant: Rxrtse) -> Self {
179 variant as u8 != 0
180 }
181}
182#[doc = "Field `RXRTSE` reader - Receiver RTS Enable"]
183pub type RxrtseR = crate::BitReader<Rxrtse>;
184impl RxrtseR {
185 #[doc = "Get enumerated values variant"]
186 #[inline(always)]
187 pub const fn variant(&self) -> Rxrtse {
188 match self.bits {
189 false => Rxrtse::Disabled,
190 true => Rxrtse::Enabled,
191 }
192 }
193 #[doc = "Disable"]
194 #[inline(always)]
195 pub fn is_disabled(&self) -> bool {
196 *self == Rxrtse::Disabled
197 }
198 #[doc = "Enable"]
199 #[inline(always)]
200 pub fn is_enabled(&self) -> bool {
201 *self == Rxrtse::Enabled
202 }
203}
204#[doc = "Field `RXRTSE` writer - Receiver RTS Enable"]
205pub type RxrtseW<'a, REG> = crate::BitWriter<'a, REG, Rxrtse>;
206impl<'a, REG> RxrtseW<'a, REG>
207where
208 REG: crate::Writable + crate::RegisterSpec,
209{
210 #[doc = "Disable"]
211 #[inline(always)]
212 pub fn disabled(self) -> &'a mut crate::W<REG> {
213 self.variant(Rxrtse::Disabled)
214 }
215 #[doc = "Enable"]
216 #[inline(always)]
217 pub fn enabled(self) -> &'a mut crate::W<REG> {
218 self.variant(Rxrtse::Enabled)
219 }
220}
221#[doc = "Transmit CTS Configuration\n\nValue on reset: 0"]
222#[cfg_attr(feature = "defmt", derive(defmt::Format))]
223#[derive(Clone, Copy, Debug, PartialEq, Eq)]
224pub enum Txctsc {
225 #[doc = "0: Sampled at the start of each character"]
226 Start = 0,
227 #[doc = "1: Sampled when the transmitter is idle"]
228 Idle = 1,
229}
230impl From<Txctsc> for bool {
231 #[inline(always)]
232 fn from(variant: Txctsc) -> Self {
233 variant as u8 != 0
234 }
235}
236#[doc = "Field `TXCTSC` reader - Transmit CTS Configuration"]
237pub type TxctscR = crate::BitReader<Txctsc>;
238impl TxctscR {
239 #[doc = "Get enumerated values variant"]
240 #[inline(always)]
241 pub const fn variant(&self) -> Txctsc {
242 match self.bits {
243 false => Txctsc::Start,
244 true => Txctsc::Idle,
245 }
246 }
247 #[doc = "Sampled at the start of each character"]
248 #[inline(always)]
249 pub fn is_start(&self) -> bool {
250 *self == Txctsc::Start
251 }
252 #[doc = "Sampled when the transmitter is idle"]
253 #[inline(always)]
254 pub fn is_idle(&self) -> bool {
255 *self == Txctsc::Idle
256 }
257}
258#[doc = "Field `TXCTSC` writer - Transmit CTS Configuration"]
259pub type TxctscW<'a, REG> = crate::BitWriter<'a, REG, Txctsc>;
260impl<'a, REG> TxctscW<'a, REG>
261where
262 REG: crate::Writable + crate::RegisterSpec,
263{
264 #[doc = "Sampled at the start of each character"]
265 #[inline(always)]
266 pub fn start(self) -> &'a mut crate::W<REG> {
267 self.variant(Txctsc::Start)
268 }
269 #[doc = "Sampled when the transmitter is idle"]
270 #[inline(always)]
271 pub fn idle(self) -> &'a mut crate::W<REG> {
272 self.variant(Txctsc::Idle)
273 }
274}
275#[doc = "Transmit CTS Source\n\nValue on reset: 0"]
276#[cfg_attr(feature = "defmt", derive(defmt::Format))]
277#[derive(Clone, Copy, Debug, PartialEq, Eq)]
278pub enum Txctssrc {
279 #[doc = "0: The CTS_B pin"]
280 Cts = 0,
281 #[doc = "1: An internal connection to the receiver address match result"]
282 Match = 1,
283}
284impl From<Txctssrc> for bool {
285 #[inline(always)]
286 fn from(variant: Txctssrc) -> Self {
287 variant as u8 != 0
288 }
289}
290#[doc = "Field `TXCTSSRC` reader - Transmit CTS Source"]
291pub type TxctssrcR = crate::BitReader<Txctssrc>;
292impl TxctssrcR {
293 #[doc = "Get enumerated values variant"]
294 #[inline(always)]
295 pub const fn variant(&self) -> Txctssrc {
296 match self.bits {
297 false => Txctssrc::Cts,
298 true => Txctssrc::Match,
299 }
300 }
301 #[doc = "The CTS_B pin"]
302 #[inline(always)]
303 pub fn is_cts(&self) -> bool {
304 *self == Txctssrc::Cts
305 }
306 #[doc = "An internal connection to the receiver address match result"]
307 #[inline(always)]
308 pub fn is_match(&self) -> bool {
309 *self == Txctssrc::Match
310 }
311}
312#[doc = "Field `TXCTSSRC` writer - Transmit CTS Source"]
313pub type TxctssrcW<'a, REG> = crate::BitWriter<'a, REG, Txctssrc>;
314impl<'a, REG> TxctssrcW<'a, REG>
315where
316 REG: crate::Writable + crate::RegisterSpec,
317{
318 #[doc = "The CTS_B pin"]
319 #[inline(always)]
320 pub fn cts(self) -> &'a mut crate::W<REG> {
321 self.variant(Txctssrc::Cts)
322 }
323 #[doc = "An internal connection to the receiver address match result"]
324 #[inline(always)]
325 pub fn match_(self) -> &'a mut crate::W<REG> {
326 self.variant(Txctssrc::Match)
327 }
328}
329#[doc = "Field `RTSWATER` reader - Receive RTS Configuration"]
330pub type RtswaterR = crate::FieldReader;
331#[doc = "Field `RTSWATER` writer - Receive RTS Configuration"]
332pub type RtswaterW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
333#[doc = "Transmitter Narrow Pulse\n\nValue on reset: 0"]
334#[cfg_attr(feature = "defmt", derive(defmt::Format))]
335#[derive(Clone, Copy, Debug, PartialEq, Eq)]
336#[repr(u8)]
337pub enum Tnp {
338 #[doc = "0: 1 / OSR"]
339 OneSample = 0,
340 #[doc = "1: 2 / OSR"]
341 TwoSample = 1,
342 #[doc = "2: 3 / OSR"]
343 ThreeSample = 2,
344 #[doc = "3: 4 / OSR"]
345 FourSample = 3,
346}
347impl From<Tnp> for u8 {
348 #[inline(always)]
349 fn from(variant: Tnp) -> Self {
350 variant as _
351 }
352}
353impl crate::FieldSpec for Tnp {
354 type Ux = u8;
355}
356impl crate::IsEnum for Tnp {}
357#[doc = "Field `TNP` reader - Transmitter Narrow Pulse"]
358pub type TnpR = crate::FieldReader<Tnp>;
359impl TnpR {
360 #[doc = "Get enumerated values variant"]
361 #[inline(always)]
362 pub const fn variant(&self) -> Tnp {
363 match self.bits {
364 0 => Tnp::OneSample,
365 1 => Tnp::TwoSample,
366 2 => Tnp::ThreeSample,
367 3 => Tnp::FourSample,
368 _ => unreachable!(),
369 }
370 }
371 #[doc = "1 / OSR"]
372 #[inline(always)]
373 pub fn is_one_sample(&self) -> bool {
374 *self == Tnp::OneSample
375 }
376 #[doc = "2 / OSR"]
377 #[inline(always)]
378 pub fn is_two_sample(&self) -> bool {
379 *self == Tnp::TwoSample
380 }
381 #[doc = "3 / OSR"]
382 #[inline(always)]
383 pub fn is_three_sample(&self) -> bool {
384 *self == Tnp::ThreeSample
385 }
386 #[doc = "4 / OSR"]
387 #[inline(always)]
388 pub fn is_four_sample(&self) -> bool {
389 *self == Tnp::FourSample
390 }
391}
392#[doc = "Field `TNP` writer - Transmitter Narrow Pulse"]
393pub type TnpW<'a, REG> = crate::FieldWriter<'a, REG, 2, Tnp, crate::Safe>;
394impl<'a, REG> TnpW<'a, REG>
395where
396 REG: crate::Writable + crate::RegisterSpec,
397 REG::Ux: From<u8>,
398{
399 #[doc = "1 / OSR"]
400 #[inline(always)]
401 pub fn one_sample(self) -> &'a mut crate::W<REG> {
402 self.variant(Tnp::OneSample)
403 }
404 #[doc = "2 / OSR"]
405 #[inline(always)]
406 pub fn two_sample(self) -> &'a mut crate::W<REG> {
407 self.variant(Tnp::TwoSample)
408 }
409 #[doc = "3 / OSR"]
410 #[inline(always)]
411 pub fn three_sample(self) -> &'a mut crate::W<REG> {
412 self.variant(Tnp::ThreeSample)
413 }
414 #[doc = "4 / OSR"]
415 #[inline(always)]
416 pub fn four_sample(self) -> &'a mut crate::W<REG> {
417 self.variant(Tnp::FourSample)
418 }
419}
420#[doc = "IR Enable\n\nValue on reset: 0"]
421#[cfg_attr(feature = "defmt", derive(defmt::Format))]
422#[derive(Clone, Copy, Debug, PartialEq, Eq)]
423pub enum Iren {
424 #[doc = "0: Disable"]
425 Disabled = 0,
426 #[doc = "1: Enable"]
427 Enabled = 1,
428}
429impl From<Iren> for bool {
430 #[inline(always)]
431 fn from(variant: Iren) -> Self {
432 variant as u8 != 0
433 }
434}
435#[doc = "Field `IREN` reader - IR Enable"]
436pub type IrenR = crate::BitReader<Iren>;
437impl IrenR {
438 #[doc = "Get enumerated values variant"]
439 #[inline(always)]
440 pub const fn variant(&self) -> Iren {
441 match self.bits {
442 false => Iren::Disabled,
443 true => Iren::Enabled,
444 }
445 }
446 #[doc = "Disable"]
447 #[inline(always)]
448 pub fn is_disabled(&self) -> bool {
449 *self == Iren::Disabled
450 }
451 #[doc = "Enable"]
452 #[inline(always)]
453 pub fn is_enabled(&self) -> bool {
454 *self == Iren::Enabled
455 }
456}
457#[doc = "Field `IREN` writer - IR Enable"]
458pub type IrenW<'a, REG> = crate::BitWriter<'a, REG, Iren>;
459impl<'a, REG> IrenW<'a, REG>
460where
461 REG: crate::Writable + crate::RegisterSpec,
462{
463 #[doc = "Disable"]
464 #[inline(always)]
465 pub fn disabled(self) -> &'a mut crate::W<REG> {
466 self.variant(Iren::Disabled)
467 }
468 #[doc = "Enable"]
469 #[inline(always)]
470 pub fn enabled(self) -> &'a mut crate::W<REG> {
471 self.variant(Iren::Enabled)
472 }
473}
474impl R {
475 #[doc = "Bit 0 - Transmitter CTS Enable"]
476 #[inline(always)]
477 pub fn txctse(&self) -> TxctseR {
478 TxctseR::new((self.bits & 1) != 0)
479 }
480 #[doc = "Bit 1 - Transmitter RTS Enable"]
481 #[inline(always)]
482 pub fn txrtse(&self) -> TxrtseR {
483 TxrtseR::new(((self.bits >> 1) & 1) != 0)
484 }
485 #[doc = "Bit 2 - Transmitter RTS Polarity"]
486 #[inline(always)]
487 pub fn txrtspol(&self) -> TxrtspolR {
488 TxrtspolR::new(((self.bits >> 2) & 1) != 0)
489 }
490 #[doc = "Bit 3 - Receiver RTS Enable"]
491 #[inline(always)]
492 pub fn rxrtse(&self) -> RxrtseR {
493 RxrtseR::new(((self.bits >> 3) & 1) != 0)
494 }
495 #[doc = "Bit 4 - Transmit CTS Configuration"]
496 #[inline(always)]
497 pub fn txctsc(&self) -> TxctscR {
498 TxctscR::new(((self.bits >> 4) & 1) != 0)
499 }
500 #[doc = "Bit 5 - Transmit CTS Source"]
501 #[inline(always)]
502 pub fn txctssrc(&self) -> TxctssrcR {
503 TxctssrcR::new(((self.bits >> 5) & 1) != 0)
504 }
505 #[doc = "Bits 8:9 - Receive RTS Configuration"]
506 #[inline(always)]
507 pub fn rtswater(&self) -> RtswaterR {
508 RtswaterR::new(((self.bits >> 8) & 3) as u8)
509 }
510 #[doc = "Bits 16:17 - Transmitter Narrow Pulse"]
511 #[inline(always)]
512 pub fn tnp(&self) -> TnpR {
513 TnpR::new(((self.bits >> 16) & 3) as u8)
514 }
515 #[doc = "Bit 18 - IR Enable"]
516 #[inline(always)]
517 pub fn iren(&self) -> IrenR {
518 IrenR::new(((self.bits >> 18) & 1) != 0)
519 }
520}
521#[cfg(feature = "debug")]
522impl core::fmt::Debug for R {
523 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
524 f.debug_struct("MODIR")
525 .field("txctse", &self.txctse())
526 .field("txrtse", &self.txrtse())
527 .field("txrtspol", &self.txrtspol())
528 .field("rxrtse", &self.rxrtse())
529 .field("txctsc", &self.txctsc())
530 .field("txctssrc", &self.txctssrc())
531 .field("rtswater", &self.rtswater())
532 .field("tnp", &self.tnp())
533 .field("iren", &self.iren())
534 .finish()
535 }
536}
537impl W {
538 #[doc = "Bit 0 - Transmitter CTS Enable"]
539 #[inline(always)]
540 pub fn txctse(&mut self) -> TxctseW<'_, ModirSpec> {
541 TxctseW::new(self, 0)
542 }
543 #[doc = "Bit 1 - Transmitter RTS Enable"]
544 #[inline(always)]
545 pub fn txrtse(&mut self) -> TxrtseW<'_, ModirSpec> {
546 TxrtseW::new(self, 1)
547 }
548 #[doc = "Bit 2 - Transmitter RTS Polarity"]
549 #[inline(always)]
550 pub fn txrtspol(&mut self) -> TxrtspolW<'_, ModirSpec> {
551 TxrtspolW::new(self, 2)
552 }
553 #[doc = "Bit 3 - Receiver RTS Enable"]
554 #[inline(always)]
555 pub fn rxrtse(&mut self) -> RxrtseW<'_, ModirSpec> {
556 RxrtseW::new(self, 3)
557 }
558 #[doc = "Bit 4 - Transmit CTS Configuration"]
559 #[inline(always)]
560 pub fn txctsc(&mut self) -> TxctscW<'_, ModirSpec> {
561 TxctscW::new(self, 4)
562 }
563 #[doc = "Bit 5 - Transmit CTS Source"]
564 #[inline(always)]
565 pub fn txctssrc(&mut self) -> TxctssrcW<'_, ModirSpec> {
566 TxctssrcW::new(self, 5)
567 }
568 #[doc = "Bits 8:9 - Receive RTS Configuration"]
569 #[inline(always)]
570 pub fn rtswater(&mut self) -> RtswaterW<'_, ModirSpec> {
571 RtswaterW::new(self, 8)
572 }
573 #[doc = "Bits 16:17 - Transmitter Narrow Pulse"]
574 #[inline(always)]
575 pub fn tnp(&mut self) -> TnpW<'_, ModirSpec> {
576 TnpW::new(self, 16)
577 }
578 #[doc = "Bit 18 - IR Enable"]
579 #[inline(always)]
580 pub fn iren(&mut self) -> IrenW<'_, ModirSpec> {
581 IrenW::new(self, 18)
582 }
583}
584#[doc = "MODEM IrDA\n\nYou can [`read`](crate::Reg::read) this register and get [`modir::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`modir::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
585pub struct ModirSpec;
586impl crate::RegisterSpec for ModirSpec {
587 type Ux = u32;
588}
589#[doc = "`read()` method returns [`modir::R`](R) reader structure"]
590impl crate::Readable for ModirSpec {}
591#[doc = "`write(|w| ..)` method takes [`modir::W`](W) writer structure"]
592impl crate::Writable for ModirSpec {
593 type Safety = crate::Unsafe;
594}
595#[doc = "`reset()` method sets MODIR to value 0"]
596impl crate::Resettable for ModirSpec {}