efm32gg11b510_pac/uart1/
irctrl.rs

1#[doc = "Register `IRCTRL` reader"]
2pub struct R(crate::R<IRCTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<IRCTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<IRCTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<IRCTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `IRCTRL` writer"]
17pub struct W(crate::W<IRCTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<IRCTRL_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<IRCTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<IRCTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `IREN` reader - Enable IrDA Module"]
38pub type IREN_R = crate::BitReader<bool>;
39#[doc = "Field `IREN` writer - Enable IrDA Module"]
40pub type IREN_W<'a> = crate::BitWriter<'a, u32, IRCTRL_SPEC, bool, 0>;
41#[doc = "IrDA TX Pulse Width\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq)]
43#[repr(u8)]
44pub enum IRPW_A {
45    #[doc = "0: IrDA pulse width is 1/16 for OVS=0 and 1/8 for OVS=1"]
46    ONE = 0,
47    #[doc = "1: IrDA pulse width is 2/16 for OVS=0 and 2/8 for OVS=1"]
48    TWO = 1,
49    #[doc = "2: IrDA pulse width is 3/16 for OVS=0 and 3/8 for OVS=1"]
50    THREE = 2,
51    #[doc = "3: IrDA pulse width is 4/16 for OVS=0 and 4/8 for OVS=1"]
52    FOUR = 3,
53}
54impl From<IRPW_A> for u8 {
55    #[inline(always)]
56    fn from(variant: IRPW_A) -> Self {
57        variant as _
58    }
59}
60#[doc = "Field `IRPW` reader - IrDA TX Pulse Width"]
61pub type IRPW_R = crate::FieldReader<u8, IRPW_A>;
62impl IRPW_R {
63    #[doc = "Get enumerated values variant"]
64    #[inline(always)]
65    pub fn variant(&self) -> IRPW_A {
66        match self.bits {
67            0 => IRPW_A::ONE,
68            1 => IRPW_A::TWO,
69            2 => IRPW_A::THREE,
70            3 => IRPW_A::FOUR,
71            _ => unreachable!(),
72        }
73    }
74    #[doc = "Checks if the value of the field is `ONE`"]
75    #[inline(always)]
76    pub fn is_one(&self) -> bool {
77        *self == IRPW_A::ONE
78    }
79    #[doc = "Checks if the value of the field is `TWO`"]
80    #[inline(always)]
81    pub fn is_two(&self) -> bool {
82        *self == IRPW_A::TWO
83    }
84    #[doc = "Checks if the value of the field is `THREE`"]
85    #[inline(always)]
86    pub fn is_three(&self) -> bool {
87        *self == IRPW_A::THREE
88    }
89    #[doc = "Checks if the value of the field is `FOUR`"]
90    #[inline(always)]
91    pub fn is_four(&self) -> bool {
92        *self == IRPW_A::FOUR
93    }
94}
95#[doc = "Field `IRPW` writer - IrDA TX Pulse Width"]
96pub type IRPW_W<'a> = crate::FieldWriterSafe<'a, u32, IRCTRL_SPEC, u8, IRPW_A, 2, 1>;
97impl<'a> IRPW_W<'a> {
98    #[doc = "IrDA pulse width is 1/16 for OVS=0 and 1/8 for OVS=1"]
99    #[inline(always)]
100    pub fn one(self) -> &'a mut W {
101        self.variant(IRPW_A::ONE)
102    }
103    #[doc = "IrDA pulse width is 2/16 for OVS=0 and 2/8 for OVS=1"]
104    #[inline(always)]
105    pub fn two(self) -> &'a mut W {
106        self.variant(IRPW_A::TWO)
107    }
108    #[doc = "IrDA pulse width is 3/16 for OVS=0 and 3/8 for OVS=1"]
109    #[inline(always)]
110    pub fn three(self) -> &'a mut W {
111        self.variant(IRPW_A::THREE)
112    }
113    #[doc = "IrDA pulse width is 4/16 for OVS=0 and 4/8 for OVS=1"]
114    #[inline(always)]
115    pub fn four(self) -> &'a mut W {
116        self.variant(IRPW_A::FOUR)
117    }
118}
119#[doc = "Field `IRFILT` reader - IrDA RX Filter"]
120pub type IRFILT_R = crate::BitReader<bool>;
121#[doc = "Field `IRFILT` writer - IrDA RX Filter"]
122pub type IRFILT_W<'a> = crate::BitWriter<'a, u32, IRCTRL_SPEC, bool, 3>;
123#[doc = "Field `IRPRSEN` reader - IrDA PRS Channel Enable"]
124pub type IRPRSEN_R = crate::BitReader<bool>;
125#[doc = "Field `IRPRSEN` writer - IrDA PRS Channel Enable"]
126pub type IRPRSEN_W<'a> = crate::BitWriter<'a, u32, IRCTRL_SPEC, bool, 7>;
127#[doc = "IrDA PRS Channel Select\n\nValue on reset: 0"]
128#[derive(Clone, Copy, Debug, PartialEq)]
129#[repr(u8)]
130pub enum IRPRSSEL_A {
131    #[doc = "0: PRS Channel 0 selected"]
132    PRSCH0 = 0,
133    #[doc = "1: PRS Channel 1 selected"]
134    PRSCH1 = 1,
135    #[doc = "2: PRS Channel 2 selected"]
136    PRSCH2 = 2,
137    #[doc = "3: PRS Channel 3 selected"]
138    PRSCH3 = 3,
139    #[doc = "4: PRS Channel 4 selected"]
140    PRSCH4 = 4,
141    #[doc = "5: PRS Channel 5 selected"]
142    PRSCH5 = 5,
143    #[doc = "6: PRS Channel 6 selected"]
144    PRSCH6 = 6,
145    #[doc = "7: PRS Channel 7 selected"]
146    PRSCH7 = 7,
147    #[doc = "8: PRS Channel 8 selected"]
148    PRSCH8 = 8,
149    #[doc = "9: PRS Channel 9 selected"]
150    PRSCH9 = 9,
151    #[doc = "10: PRS Channel 10 selected"]
152    PRSCH10 = 10,
153    #[doc = "11: PRS Channel 11 selected"]
154    PRSCH11 = 11,
155    #[doc = "12: PRS Channel 12 selected"]
156    PRSCH12 = 12,
157    #[doc = "13: PRS Channel 13 selected"]
158    PRSCH13 = 13,
159    #[doc = "14: PRS Channel 14 selected"]
160    PRSCH14 = 14,
161    #[doc = "15: PRS Channel 15 selected"]
162    PRSCH15 = 15,
163    #[doc = "16: PRS Channel 16 selected"]
164    PRSCH16 = 16,
165    #[doc = "17: PRS Channel 17 selected"]
166    PRSCH17 = 17,
167    #[doc = "18: PRS Channel 18 selected"]
168    PRSCH18 = 18,
169    #[doc = "19: PRS Channel 19 selected"]
170    PRSCH19 = 19,
171    #[doc = "20: PRS Channel 20 selected"]
172    PRSCH20 = 20,
173    #[doc = "21: PRS Channel 21 selected"]
174    PRSCH21 = 21,
175    #[doc = "22: PRS Channel 22 selected"]
176    PRSCH22 = 22,
177    #[doc = "23: PRS Channel 23 selected"]
178    PRSCH23 = 23,
179}
180impl From<IRPRSSEL_A> for u8 {
181    #[inline(always)]
182    fn from(variant: IRPRSSEL_A) -> Self {
183        variant as _
184    }
185}
186#[doc = "Field `IRPRSSEL` reader - IrDA PRS Channel Select"]
187pub type IRPRSSEL_R = crate::FieldReader<u8, IRPRSSEL_A>;
188impl IRPRSSEL_R {
189    #[doc = "Get enumerated values variant"]
190    #[inline(always)]
191    pub fn variant(&self) -> Option<IRPRSSEL_A> {
192        match self.bits {
193            0 => Some(IRPRSSEL_A::PRSCH0),
194            1 => Some(IRPRSSEL_A::PRSCH1),
195            2 => Some(IRPRSSEL_A::PRSCH2),
196            3 => Some(IRPRSSEL_A::PRSCH3),
197            4 => Some(IRPRSSEL_A::PRSCH4),
198            5 => Some(IRPRSSEL_A::PRSCH5),
199            6 => Some(IRPRSSEL_A::PRSCH6),
200            7 => Some(IRPRSSEL_A::PRSCH7),
201            8 => Some(IRPRSSEL_A::PRSCH8),
202            9 => Some(IRPRSSEL_A::PRSCH9),
203            10 => Some(IRPRSSEL_A::PRSCH10),
204            11 => Some(IRPRSSEL_A::PRSCH11),
205            12 => Some(IRPRSSEL_A::PRSCH12),
206            13 => Some(IRPRSSEL_A::PRSCH13),
207            14 => Some(IRPRSSEL_A::PRSCH14),
208            15 => Some(IRPRSSEL_A::PRSCH15),
209            16 => Some(IRPRSSEL_A::PRSCH16),
210            17 => Some(IRPRSSEL_A::PRSCH17),
211            18 => Some(IRPRSSEL_A::PRSCH18),
212            19 => Some(IRPRSSEL_A::PRSCH19),
213            20 => Some(IRPRSSEL_A::PRSCH20),
214            21 => Some(IRPRSSEL_A::PRSCH21),
215            22 => Some(IRPRSSEL_A::PRSCH22),
216            23 => Some(IRPRSSEL_A::PRSCH23),
217            _ => None,
218        }
219    }
220    #[doc = "Checks if the value of the field is `PRSCH0`"]
221    #[inline(always)]
222    pub fn is_prsch0(&self) -> bool {
223        *self == IRPRSSEL_A::PRSCH0
224    }
225    #[doc = "Checks if the value of the field is `PRSCH1`"]
226    #[inline(always)]
227    pub fn is_prsch1(&self) -> bool {
228        *self == IRPRSSEL_A::PRSCH1
229    }
230    #[doc = "Checks if the value of the field is `PRSCH2`"]
231    #[inline(always)]
232    pub fn is_prsch2(&self) -> bool {
233        *self == IRPRSSEL_A::PRSCH2
234    }
235    #[doc = "Checks if the value of the field is `PRSCH3`"]
236    #[inline(always)]
237    pub fn is_prsch3(&self) -> bool {
238        *self == IRPRSSEL_A::PRSCH3
239    }
240    #[doc = "Checks if the value of the field is `PRSCH4`"]
241    #[inline(always)]
242    pub fn is_prsch4(&self) -> bool {
243        *self == IRPRSSEL_A::PRSCH4
244    }
245    #[doc = "Checks if the value of the field is `PRSCH5`"]
246    #[inline(always)]
247    pub fn is_prsch5(&self) -> bool {
248        *self == IRPRSSEL_A::PRSCH5
249    }
250    #[doc = "Checks if the value of the field is `PRSCH6`"]
251    #[inline(always)]
252    pub fn is_prsch6(&self) -> bool {
253        *self == IRPRSSEL_A::PRSCH6
254    }
255    #[doc = "Checks if the value of the field is `PRSCH7`"]
256    #[inline(always)]
257    pub fn is_prsch7(&self) -> bool {
258        *self == IRPRSSEL_A::PRSCH7
259    }
260    #[doc = "Checks if the value of the field is `PRSCH8`"]
261    #[inline(always)]
262    pub fn is_prsch8(&self) -> bool {
263        *self == IRPRSSEL_A::PRSCH8
264    }
265    #[doc = "Checks if the value of the field is `PRSCH9`"]
266    #[inline(always)]
267    pub fn is_prsch9(&self) -> bool {
268        *self == IRPRSSEL_A::PRSCH9
269    }
270    #[doc = "Checks if the value of the field is `PRSCH10`"]
271    #[inline(always)]
272    pub fn is_prsch10(&self) -> bool {
273        *self == IRPRSSEL_A::PRSCH10
274    }
275    #[doc = "Checks if the value of the field is `PRSCH11`"]
276    #[inline(always)]
277    pub fn is_prsch11(&self) -> bool {
278        *self == IRPRSSEL_A::PRSCH11
279    }
280    #[doc = "Checks if the value of the field is `PRSCH12`"]
281    #[inline(always)]
282    pub fn is_prsch12(&self) -> bool {
283        *self == IRPRSSEL_A::PRSCH12
284    }
285    #[doc = "Checks if the value of the field is `PRSCH13`"]
286    #[inline(always)]
287    pub fn is_prsch13(&self) -> bool {
288        *self == IRPRSSEL_A::PRSCH13
289    }
290    #[doc = "Checks if the value of the field is `PRSCH14`"]
291    #[inline(always)]
292    pub fn is_prsch14(&self) -> bool {
293        *self == IRPRSSEL_A::PRSCH14
294    }
295    #[doc = "Checks if the value of the field is `PRSCH15`"]
296    #[inline(always)]
297    pub fn is_prsch15(&self) -> bool {
298        *self == IRPRSSEL_A::PRSCH15
299    }
300    #[doc = "Checks if the value of the field is `PRSCH16`"]
301    #[inline(always)]
302    pub fn is_prsch16(&self) -> bool {
303        *self == IRPRSSEL_A::PRSCH16
304    }
305    #[doc = "Checks if the value of the field is `PRSCH17`"]
306    #[inline(always)]
307    pub fn is_prsch17(&self) -> bool {
308        *self == IRPRSSEL_A::PRSCH17
309    }
310    #[doc = "Checks if the value of the field is `PRSCH18`"]
311    #[inline(always)]
312    pub fn is_prsch18(&self) -> bool {
313        *self == IRPRSSEL_A::PRSCH18
314    }
315    #[doc = "Checks if the value of the field is `PRSCH19`"]
316    #[inline(always)]
317    pub fn is_prsch19(&self) -> bool {
318        *self == IRPRSSEL_A::PRSCH19
319    }
320    #[doc = "Checks if the value of the field is `PRSCH20`"]
321    #[inline(always)]
322    pub fn is_prsch20(&self) -> bool {
323        *self == IRPRSSEL_A::PRSCH20
324    }
325    #[doc = "Checks if the value of the field is `PRSCH21`"]
326    #[inline(always)]
327    pub fn is_prsch21(&self) -> bool {
328        *self == IRPRSSEL_A::PRSCH21
329    }
330    #[doc = "Checks if the value of the field is `PRSCH22`"]
331    #[inline(always)]
332    pub fn is_prsch22(&self) -> bool {
333        *self == IRPRSSEL_A::PRSCH22
334    }
335    #[doc = "Checks if the value of the field is `PRSCH23`"]
336    #[inline(always)]
337    pub fn is_prsch23(&self) -> bool {
338        *self == IRPRSSEL_A::PRSCH23
339    }
340}
341#[doc = "Field `IRPRSSEL` writer - IrDA PRS Channel Select"]
342pub type IRPRSSEL_W<'a> = crate::FieldWriter<'a, u32, IRCTRL_SPEC, u8, IRPRSSEL_A, 5, 8>;
343impl<'a> IRPRSSEL_W<'a> {
344    #[doc = "PRS Channel 0 selected"]
345    #[inline(always)]
346    pub fn prsch0(self) -> &'a mut W {
347        self.variant(IRPRSSEL_A::PRSCH0)
348    }
349    #[doc = "PRS Channel 1 selected"]
350    #[inline(always)]
351    pub fn prsch1(self) -> &'a mut W {
352        self.variant(IRPRSSEL_A::PRSCH1)
353    }
354    #[doc = "PRS Channel 2 selected"]
355    #[inline(always)]
356    pub fn prsch2(self) -> &'a mut W {
357        self.variant(IRPRSSEL_A::PRSCH2)
358    }
359    #[doc = "PRS Channel 3 selected"]
360    #[inline(always)]
361    pub fn prsch3(self) -> &'a mut W {
362        self.variant(IRPRSSEL_A::PRSCH3)
363    }
364    #[doc = "PRS Channel 4 selected"]
365    #[inline(always)]
366    pub fn prsch4(self) -> &'a mut W {
367        self.variant(IRPRSSEL_A::PRSCH4)
368    }
369    #[doc = "PRS Channel 5 selected"]
370    #[inline(always)]
371    pub fn prsch5(self) -> &'a mut W {
372        self.variant(IRPRSSEL_A::PRSCH5)
373    }
374    #[doc = "PRS Channel 6 selected"]
375    #[inline(always)]
376    pub fn prsch6(self) -> &'a mut W {
377        self.variant(IRPRSSEL_A::PRSCH6)
378    }
379    #[doc = "PRS Channel 7 selected"]
380    #[inline(always)]
381    pub fn prsch7(self) -> &'a mut W {
382        self.variant(IRPRSSEL_A::PRSCH7)
383    }
384    #[doc = "PRS Channel 8 selected"]
385    #[inline(always)]
386    pub fn prsch8(self) -> &'a mut W {
387        self.variant(IRPRSSEL_A::PRSCH8)
388    }
389    #[doc = "PRS Channel 9 selected"]
390    #[inline(always)]
391    pub fn prsch9(self) -> &'a mut W {
392        self.variant(IRPRSSEL_A::PRSCH9)
393    }
394    #[doc = "PRS Channel 10 selected"]
395    #[inline(always)]
396    pub fn prsch10(self) -> &'a mut W {
397        self.variant(IRPRSSEL_A::PRSCH10)
398    }
399    #[doc = "PRS Channel 11 selected"]
400    #[inline(always)]
401    pub fn prsch11(self) -> &'a mut W {
402        self.variant(IRPRSSEL_A::PRSCH11)
403    }
404    #[doc = "PRS Channel 12 selected"]
405    #[inline(always)]
406    pub fn prsch12(self) -> &'a mut W {
407        self.variant(IRPRSSEL_A::PRSCH12)
408    }
409    #[doc = "PRS Channel 13 selected"]
410    #[inline(always)]
411    pub fn prsch13(self) -> &'a mut W {
412        self.variant(IRPRSSEL_A::PRSCH13)
413    }
414    #[doc = "PRS Channel 14 selected"]
415    #[inline(always)]
416    pub fn prsch14(self) -> &'a mut W {
417        self.variant(IRPRSSEL_A::PRSCH14)
418    }
419    #[doc = "PRS Channel 15 selected"]
420    #[inline(always)]
421    pub fn prsch15(self) -> &'a mut W {
422        self.variant(IRPRSSEL_A::PRSCH15)
423    }
424    #[doc = "PRS Channel 16 selected"]
425    #[inline(always)]
426    pub fn prsch16(self) -> &'a mut W {
427        self.variant(IRPRSSEL_A::PRSCH16)
428    }
429    #[doc = "PRS Channel 17 selected"]
430    #[inline(always)]
431    pub fn prsch17(self) -> &'a mut W {
432        self.variant(IRPRSSEL_A::PRSCH17)
433    }
434    #[doc = "PRS Channel 18 selected"]
435    #[inline(always)]
436    pub fn prsch18(self) -> &'a mut W {
437        self.variant(IRPRSSEL_A::PRSCH18)
438    }
439    #[doc = "PRS Channel 19 selected"]
440    #[inline(always)]
441    pub fn prsch19(self) -> &'a mut W {
442        self.variant(IRPRSSEL_A::PRSCH19)
443    }
444    #[doc = "PRS Channel 20 selected"]
445    #[inline(always)]
446    pub fn prsch20(self) -> &'a mut W {
447        self.variant(IRPRSSEL_A::PRSCH20)
448    }
449    #[doc = "PRS Channel 21 selected"]
450    #[inline(always)]
451    pub fn prsch21(self) -> &'a mut W {
452        self.variant(IRPRSSEL_A::PRSCH21)
453    }
454    #[doc = "PRS Channel 22 selected"]
455    #[inline(always)]
456    pub fn prsch22(self) -> &'a mut W {
457        self.variant(IRPRSSEL_A::PRSCH22)
458    }
459    #[doc = "PRS Channel 23 selected"]
460    #[inline(always)]
461    pub fn prsch23(self) -> &'a mut W {
462        self.variant(IRPRSSEL_A::PRSCH23)
463    }
464}
465impl R {
466    #[doc = "Bit 0 - Enable IrDA Module"]
467    #[inline(always)]
468    pub fn iren(&self) -> IREN_R {
469        IREN_R::new((self.bits & 1) != 0)
470    }
471    #[doc = "Bits 1:2 - IrDA TX Pulse Width"]
472    #[inline(always)]
473    pub fn irpw(&self) -> IRPW_R {
474        IRPW_R::new(((self.bits >> 1) & 3) as u8)
475    }
476    #[doc = "Bit 3 - IrDA RX Filter"]
477    #[inline(always)]
478    pub fn irfilt(&self) -> IRFILT_R {
479        IRFILT_R::new(((self.bits >> 3) & 1) != 0)
480    }
481    #[doc = "Bit 7 - IrDA PRS Channel Enable"]
482    #[inline(always)]
483    pub fn irprsen(&self) -> IRPRSEN_R {
484        IRPRSEN_R::new(((self.bits >> 7) & 1) != 0)
485    }
486    #[doc = "Bits 8:12 - IrDA PRS Channel Select"]
487    #[inline(always)]
488    pub fn irprssel(&self) -> IRPRSSEL_R {
489        IRPRSSEL_R::new(((self.bits >> 8) & 0x1f) as u8)
490    }
491}
492impl W {
493    #[doc = "Bit 0 - Enable IrDA Module"]
494    #[inline(always)]
495    pub fn iren(&mut self) -> IREN_W {
496        IREN_W::new(self)
497    }
498    #[doc = "Bits 1:2 - IrDA TX Pulse Width"]
499    #[inline(always)]
500    pub fn irpw(&mut self) -> IRPW_W {
501        IRPW_W::new(self)
502    }
503    #[doc = "Bit 3 - IrDA RX Filter"]
504    #[inline(always)]
505    pub fn irfilt(&mut self) -> IRFILT_W {
506        IRFILT_W::new(self)
507    }
508    #[doc = "Bit 7 - IrDA PRS Channel Enable"]
509    #[inline(always)]
510    pub fn irprsen(&mut self) -> IRPRSEN_W {
511        IRPRSEN_W::new(self)
512    }
513    #[doc = "Bits 8:12 - IrDA PRS Channel Select"]
514    #[inline(always)]
515    pub fn irprssel(&mut self) -> IRPRSSEL_W {
516        IRPRSSEL_W::new(self)
517    }
518    #[doc = "Writes raw bits to the register."]
519    #[inline(always)]
520    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
521        self.0.bits(bits);
522        self
523    }
524}
525#[doc = "IrDA Control 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 [irctrl](index.html) module"]
526pub struct IRCTRL_SPEC;
527impl crate::RegisterSpec for IRCTRL_SPEC {
528    type Ux = u32;
529}
530#[doc = "`read()` method returns [irctrl::R](R) reader structure"]
531impl crate::Readable for IRCTRL_SPEC {
532    type Reader = R;
533}
534#[doc = "`write(|w| ..)` method takes [irctrl::W](W) writer structure"]
535impl crate::Writable for IRCTRL_SPEC {
536    type Writer = W;
537}
538#[doc = "`reset()` method sets IRCTRL to value 0"]
539impl crate::Resettable for IRCTRL_SPEC {
540    #[inline(always)]
541    fn reset_value() -> Self::Ux {
542        0
543    }
544}