efm32pg12_pac/usart0/
input.rs

1#[doc = "Reader of register INPUT"]
2pub type R = crate::R<u32, super::INPUT>;
3#[doc = "Writer for register INPUT"]
4pub type W = crate::W<u32, super::INPUT>;
5#[doc = "Register INPUT `reset()`'s with value 0"]
6impl crate::ResetValue for super::INPUT {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "RX PRS Channel Select\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum RXPRSSEL_A {
17    #[doc = "0: PRS Channel 0 selected"]
18    PRSCH0 = 0,
19    #[doc = "1: PRS Channel 1 selected"]
20    PRSCH1 = 1,
21    #[doc = "2: PRS Channel 2 selected"]
22    PRSCH2 = 2,
23    #[doc = "3: PRS Channel 3 selected"]
24    PRSCH3 = 3,
25    #[doc = "4: PRS Channel 4 selected"]
26    PRSCH4 = 4,
27    #[doc = "5: PRS Channel 5 selected"]
28    PRSCH5 = 5,
29    #[doc = "6: PRS Channel 6 selected"]
30    PRSCH6 = 6,
31    #[doc = "7: PRS Channel 7 selected"]
32    PRSCH7 = 7,
33    #[doc = "8: PRS Channel 8 selected"]
34    PRSCH8 = 8,
35    #[doc = "9: PRS Channel 9 selected"]
36    PRSCH9 = 9,
37    #[doc = "10: PRS Channel 10 selected"]
38    PRSCH10 = 10,
39    #[doc = "11: PRS Channel 11 selected"]
40    PRSCH11 = 11,
41}
42impl From<RXPRSSEL_A> for u8 {
43    #[inline(always)]
44    fn from(variant: RXPRSSEL_A) -> Self {
45        variant as _
46    }
47}
48#[doc = "Reader of field `RXPRSSEL`"]
49pub type RXPRSSEL_R = crate::R<u8, RXPRSSEL_A>;
50impl RXPRSSEL_R {
51    #[doc = r"Get enumerated values variant"]
52    #[inline(always)]
53    pub fn variant(&self) -> crate::Variant<u8, RXPRSSEL_A> {
54        use crate::Variant::*;
55        match self.bits {
56            0 => Val(RXPRSSEL_A::PRSCH0),
57            1 => Val(RXPRSSEL_A::PRSCH1),
58            2 => Val(RXPRSSEL_A::PRSCH2),
59            3 => Val(RXPRSSEL_A::PRSCH3),
60            4 => Val(RXPRSSEL_A::PRSCH4),
61            5 => Val(RXPRSSEL_A::PRSCH5),
62            6 => Val(RXPRSSEL_A::PRSCH6),
63            7 => Val(RXPRSSEL_A::PRSCH7),
64            8 => Val(RXPRSSEL_A::PRSCH8),
65            9 => Val(RXPRSSEL_A::PRSCH9),
66            10 => Val(RXPRSSEL_A::PRSCH10),
67            11 => Val(RXPRSSEL_A::PRSCH11),
68            i => Res(i),
69        }
70    }
71    #[doc = "Checks if the value of the field is `PRSCH0`"]
72    #[inline(always)]
73    pub fn is_prsch0(&self) -> bool {
74        *self == RXPRSSEL_A::PRSCH0
75    }
76    #[doc = "Checks if the value of the field is `PRSCH1`"]
77    #[inline(always)]
78    pub fn is_prsch1(&self) -> bool {
79        *self == RXPRSSEL_A::PRSCH1
80    }
81    #[doc = "Checks if the value of the field is `PRSCH2`"]
82    #[inline(always)]
83    pub fn is_prsch2(&self) -> bool {
84        *self == RXPRSSEL_A::PRSCH2
85    }
86    #[doc = "Checks if the value of the field is `PRSCH3`"]
87    #[inline(always)]
88    pub fn is_prsch3(&self) -> bool {
89        *self == RXPRSSEL_A::PRSCH3
90    }
91    #[doc = "Checks if the value of the field is `PRSCH4`"]
92    #[inline(always)]
93    pub fn is_prsch4(&self) -> bool {
94        *self == RXPRSSEL_A::PRSCH4
95    }
96    #[doc = "Checks if the value of the field is `PRSCH5`"]
97    #[inline(always)]
98    pub fn is_prsch5(&self) -> bool {
99        *self == RXPRSSEL_A::PRSCH5
100    }
101    #[doc = "Checks if the value of the field is `PRSCH6`"]
102    #[inline(always)]
103    pub fn is_prsch6(&self) -> bool {
104        *self == RXPRSSEL_A::PRSCH6
105    }
106    #[doc = "Checks if the value of the field is `PRSCH7`"]
107    #[inline(always)]
108    pub fn is_prsch7(&self) -> bool {
109        *self == RXPRSSEL_A::PRSCH7
110    }
111    #[doc = "Checks if the value of the field is `PRSCH8`"]
112    #[inline(always)]
113    pub fn is_prsch8(&self) -> bool {
114        *self == RXPRSSEL_A::PRSCH8
115    }
116    #[doc = "Checks if the value of the field is `PRSCH9`"]
117    #[inline(always)]
118    pub fn is_prsch9(&self) -> bool {
119        *self == RXPRSSEL_A::PRSCH9
120    }
121    #[doc = "Checks if the value of the field is `PRSCH10`"]
122    #[inline(always)]
123    pub fn is_prsch10(&self) -> bool {
124        *self == RXPRSSEL_A::PRSCH10
125    }
126    #[doc = "Checks if the value of the field is `PRSCH11`"]
127    #[inline(always)]
128    pub fn is_prsch11(&self) -> bool {
129        *self == RXPRSSEL_A::PRSCH11
130    }
131}
132#[doc = "Write proxy for field `RXPRSSEL`"]
133pub struct RXPRSSEL_W<'a> {
134    w: &'a mut W,
135}
136impl<'a> RXPRSSEL_W<'a> {
137    #[doc = r"Writes `variant` to the field"]
138    #[inline(always)]
139    pub fn variant(self, variant: RXPRSSEL_A) -> &'a mut W {
140        unsafe { self.bits(variant.into()) }
141    }
142    #[doc = "PRS Channel 0 selected"]
143    #[inline(always)]
144    pub fn prsch0(self) -> &'a mut W {
145        self.variant(RXPRSSEL_A::PRSCH0)
146    }
147    #[doc = "PRS Channel 1 selected"]
148    #[inline(always)]
149    pub fn prsch1(self) -> &'a mut W {
150        self.variant(RXPRSSEL_A::PRSCH1)
151    }
152    #[doc = "PRS Channel 2 selected"]
153    #[inline(always)]
154    pub fn prsch2(self) -> &'a mut W {
155        self.variant(RXPRSSEL_A::PRSCH2)
156    }
157    #[doc = "PRS Channel 3 selected"]
158    #[inline(always)]
159    pub fn prsch3(self) -> &'a mut W {
160        self.variant(RXPRSSEL_A::PRSCH3)
161    }
162    #[doc = "PRS Channel 4 selected"]
163    #[inline(always)]
164    pub fn prsch4(self) -> &'a mut W {
165        self.variant(RXPRSSEL_A::PRSCH4)
166    }
167    #[doc = "PRS Channel 5 selected"]
168    #[inline(always)]
169    pub fn prsch5(self) -> &'a mut W {
170        self.variant(RXPRSSEL_A::PRSCH5)
171    }
172    #[doc = "PRS Channel 6 selected"]
173    #[inline(always)]
174    pub fn prsch6(self) -> &'a mut W {
175        self.variant(RXPRSSEL_A::PRSCH6)
176    }
177    #[doc = "PRS Channel 7 selected"]
178    #[inline(always)]
179    pub fn prsch7(self) -> &'a mut W {
180        self.variant(RXPRSSEL_A::PRSCH7)
181    }
182    #[doc = "PRS Channel 8 selected"]
183    #[inline(always)]
184    pub fn prsch8(self) -> &'a mut W {
185        self.variant(RXPRSSEL_A::PRSCH8)
186    }
187    #[doc = "PRS Channel 9 selected"]
188    #[inline(always)]
189    pub fn prsch9(self) -> &'a mut W {
190        self.variant(RXPRSSEL_A::PRSCH9)
191    }
192    #[doc = "PRS Channel 10 selected"]
193    #[inline(always)]
194    pub fn prsch10(self) -> &'a mut W {
195        self.variant(RXPRSSEL_A::PRSCH10)
196    }
197    #[doc = "PRS Channel 11 selected"]
198    #[inline(always)]
199    pub fn prsch11(self) -> &'a mut W {
200        self.variant(RXPRSSEL_A::PRSCH11)
201    }
202    #[doc = r"Writes raw bits to the field"]
203    #[inline(always)]
204    pub unsafe fn bits(self, value: u8) -> &'a mut W {
205        self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
206        self.w
207    }
208}
209#[doc = "Reader of field `RXPRS`"]
210pub type RXPRS_R = crate::R<bool, bool>;
211#[doc = "Write proxy for field `RXPRS`"]
212pub struct RXPRS_W<'a> {
213    w: &'a mut W,
214}
215impl<'a> RXPRS_W<'a> {
216    #[doc = r"Sets the field bit"]
217    #[inline(always)]
218    pub fn set_bit(self) -> &'a mut W {
219        self.bit(true)
220    }
221    #[doc = r"Clears the field bit"]
222    #[inline(always)]
223    pub fn clear_bit(self) -> &'a mut W {
224        self.bit(false)
225    }
226    #[doc = r"Writes raw bits to the field"]
227    #[inline(always)]
228    pub fn bit(self, value: bool) -> &'a mut W {
229        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
230        self.w
231    }
232}
233#[doc = "CLK PRS Channel Select\n\nValue on reset: 0"]
234#[derive(Clone, Copy, Debug, PartialEq)]
235#[repr(u8)]
236pub enum CLKPRSSEL_A {
237    #[doc = "0: PRS Channel 0 selected"]
238    PRSCH0 = 0,
239    #[doc = "1: PRS Channel 1 selected"]
240    PRSCH1 = 1,
241    #[doc = "2: PRS Channel 2 selected"]
242    PRSCH2 = 2,
243    #[doc = "3: PRS Channel 3 selected"]
244    PRSCH3 = 3,
245    #[doc = "4: PRS Channel 4 selected"]
246    PRSCH4 = 4,
247    #[doc = "5: PRS Channel 5 selected"]
248    PRSCH5 = 5,
249    #[doc = "6: PRS Channel 6 selected"]
250    PRSCH6 = 6,
251    #[doc = "7: PRS Channel 7 selected"]
252    PRSCH7 = 7,
253    #[doc = "8: PRS Channel 8 selected"]
254    PRSCH8 = 8,
255    #[doc = "9: PRS Channel 9 selected"]
256    PRSCH9 = 9,
257    #[doc = "10: PRS Channel 10 selected"]
258    PRSCH10 = 10,
259    #[doc = "11: PRS Channel 11 selected"]
260    PRSCH11 = 11,
261}
262impl From<CLKPRSSEL_A> for u8 {
263    #[inline(always)]
264    fn from(variant: CLKPRSSEL_A) -> Self {
265        variant as _
266    }
267}
268#[doc = "Reader of field `CLKPRSSEL`"]
269pub type CLKPRSSEL_R = crate::R<u8, CLKPRSSEL_A>;
270impl CLKPRSSEL_R {
271    #[doc = r"Get enumerated values variant"]
272    #[inline(always)]
273    pub fn variant(&self) -> crate::Variant<u8, CLKPRSSEL_A> {
274        use crate::Variant::*;
275        match self.bits {
276            0 => Val(CLKPRSSEL_A::PRSCH0),
277            1 => Val(CLKPRSSEL_A::PRSCH1),
278            2 => Val(CLKPRSSEL_A::PRSCH2),
279            3 => Val(CLKPRSSEL_A::PRSCH3),
280            4 => Val(CLKPRSSEL_A::PRSCH4),
281            5 => Val(CLKPRSSEL_A::PRSCH5),
282            6 => Val(CLKPRSSEL_A::PRSCH6),
283            7 => Val(CLKPRSSEL_A::PRSCH7),
284            8 => Val(CLKPRSSEL_A::PRSCH8),
285            9 => Val(CLKPRSSEL_A::PRSCH9),
286            10 => Val(CLKPRSSEL_A::PRSCH10),
287            11 => Val(CLKPRSSEL_A::PRSCH11),
288            i => Res(i),
289        }
290    }
291    #[doc = "Checks if the value of the field is `PRSCH0`"]
292    #[inline(always)]
293    pub fn is_prsch0(&self) -> bool {
294        *self == CLKPRSSEL_A::PRSCH0
295    }
296    #[doc = "Checks if the value of the field is `PRSCH1`"]
297    #[inline(always)]
298    pub fn is_prsch1(&self) -> bool {
299        *self == CLKPRSSEL_A::PRSCH1
300    }
301    #[doc = "Checks if the value of the field is `PRSCH2`"]
302    #[inline(always)]
303    pub fn is_prsch2(&self) -> bool {
304        *self == CLKPRSSEL_A::PRSCH2
305    }
306    #[doc = "Checks if the value of the field is `PRSCH3`"]
307    #[inline(always)]
308    pub fn is_prsch3(&self) -> bool {
309        *self == CLKPRSSEL_A::PRSCH3
310    }
311    #[doc = "Checks if the value of the field is `PRSCH4`"]
312    #[inline(always)]
313    pub fn is_prsch4(&self) -> bool {
314        *self == CLKPRSSEL_A::PRSCH4
315    }
316    #[doc = "Checks if the value of the field is `PRSCH5`"]
317    #[inline(always)]
318    pub fn is_prsch5(&self) -> bool {
319        *self == CLKPRSSEL_A::PRSCH5
320    }
321    #[doc = "Checks if the value of the field is `PRSCH6`"]
322    #[inline(always)]
323    pub fn is_prsch6(&self) -> bool {
324        *self == CLKPRSSEL_A::PRSCH6
325    }
326    #[doc = "Checks if the value of the field is `PRSCH7`"]
327    #[inline(always)]
328    pub fn is_prsch7(&self) -> bool {
329        *self == CLKPRSSEL_A::PRSCH7
330    }
331    #[doc = "Checks if the value of the field is `PRSCH8`"]
332    #[inline(always)]
333    pub fn is_prsch8(&self) -> bool {
334        *self == CLKPRSSEL_A::PRSCH8
335    }
336    #[doc = "Checks if the value of the field is `PRSCH9`"]
337    #[inline(always)]
338    pub fn is_prsch9(&self) -> bool {
339        *self == CLKPRSSEL_A::PRSCH9
340    }
341    #[doc = "Checks if the value of the field is `PRSCH10`"]
342    #[inline(always)]
343    pub fn is_prsch10(&self) -> bool {
344        *self == CLKPRSSEL_A::PRSCH10
345    }
346    #[doc = "Checks if the value of the field is `PRSCH11`"]
347    #[inline(always)]
348    pub fn is_prsch11(&self) -> bool {
349        *self == CLKPRSSEL_A::PRSCH11
350    }
351}
352#[doc = "Write proxy for field `CLKPRSSEL`"]
353pub struct CLKPRSSEL_W<'a> {
354    w: &'a mut W,
355}
356impl<'a> CLKPRSSEL_W<'a> {
357    #[doc = r"Writes `variant` to the field"]
358    #[inline(always)]
359    pub fn variant(self, variant: CLKPRSSEL_A) -> &'a mut W {
360        unsafe { self.bits(variant.into()) }
361    }
362    #[doc = "PRS Channel 0 selected"]
363    #[inline(always)]
364    pub fn prsch0(self) -> &'a mut W {
365        self.variant(CLKPRSSEL_A::PRSCH0)
366    }
367    #[doc = "PRS Channel 1 selected"]
368    #[inline(always)]
369    pub fn prsch1(self) -> &'a mut W {
370        self.variant(CLKPRSSEL_A::PRSCH1)
371    }
372    #[doc = "PRS Channel 2 selected"]
373    #[inline(always)]
374    pub fn prsch2(self) -> &'a mut W {
375        self.variant(CLKPRSSEL_A::PRSCH2)
376    }
377    #[doc = "PRS Channel 3 selected"]
378    #[inline(always)]
379    pub fn prsch3(self) -> &'a mut W {
380        self.variant(CLKPRSSEL_A::PRSCH3)
381    }
382    #[doc = "PRS Channel 4 selected"]
383    #[inline(always)]
384    pub fn prsch4(self) -> &'a mut W {
385        self.variant(CLKPRSSEL_A::PRSCH4)
386    }
387    #[doc = "PRS Channel 5 selected"]
388    #[inline(always)]
389    pub fn prsch5(self) -> &'a mut W {
390        self.variant(CLKPRSSEL_A::PRSCH5)
391    }
392    #[doc = "PRS Channel 6 selected"]
393    #[inline(always)]
394    pub fn prsch6(self) -> &'a mut W {
395        self.variant(CLKPRSSEL_A::PRSCH6)
396    }
397    #[doc = "PRS Channel 7 selected"]
398    #[inline(always)]
399    pub fn prsch7(self) -> &'a mut W {
400        self.variant(CLKPRSSEL_A::PRSCH7)
401    }
402    #[doc = "PRS Channel 8 selected"]
403    #[inline(always)]
404    pub fn prsch8(self) -> &'a mut W {
405        self.variant(CLKPRSSEL_A::PRSCH8)
406    }
407    #[doc = "PRS Channel 9 selected"]
408    #[inline(always)]
409    pub fn prsch9(self) -> &'a mut W {
410        self.variant(CLKPRSSEL_A::PRSCH9)
411    }
412    #[doc = "PRS Channel 10 selected"]
413    #[inline(always)]
414    pub fn prsch10(self) -> &'a mut W {
415        self.variant(CLKPRSSEL_A::PRSCH10)
416    }
417    #[doc = "PRS Channel 11 selected"]
418    #[inline(always)]
419    pub fn prsch11(self) -> &'a mut W {
420        self.variant(CLKPRSSEL_A::PRSCH11)
421    }
422    #[doc = r"Writes raw bits to the field"]
423    #[inline(always)]
424    pub unsafe fn bits(self, value: u8) -> &'a mut W {
425        self.w.bits = (self.w.bits & !(0x0f << 8)) | (((value as u32) & 0x0f) << 8);
426        self.w
427    }
428}
429#[doc = "Reader of field `CLKPRS`"]
430pub type CLKPRS_R = crate::R<bool, bool>;
431#[doc = "Write proxy for field `CLKPRS`"]
432pub struct CLKPRS_W<'a> {
433    w: &'a mut W,
434}
435impl<'a> CLKPRS_W<'a> {
436    #[doc = r"Sets the field bit"]
437    #[inline(always)]
438    pub fn set_bit(self) -> &'a mut W {
439        self.bit(true)
440    }
441    #[doc = r"Clears the field bit"]
442    #[inline(always)]
443    pub fn clear_bit(self) -> &'a mut W {
444        self.bit(false)
445    }
446    #[doc = r"Writes raw bits to the field"]
447    #[inline(always)]
448    pub fn bit(self, value: bool) -> &'a mut W {
449        self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
450        self.w
451    }
452}
453impl R {
454    #[doc = "Bits 0:3 - RX PRS Channel Select"]
455    #[inline(always)]
456    pub fn rxprssel(&self) -> RXPRSSEL_R {
457        RXPRSSEL_R::new((self.bits & 0x0f) as u8)
458    }
459    #[doc = "Bit 7 - PRS RX Enable"]
460    #[inline(always)]
461    pub fn rxprs(&self) -> RXPRS_R {
462        RXPRS_R::new(((self.bits >> 7) & 0x01) != 0)
463    }
464    #[doc = "Bits 8:11 - CLK PRS Channel Select"]
465    #[inline(always)]
466    pub fn clkprssel(&self) -> CLKPRSSEL_R {
467        CLKPRSSEL_R::new(((self.bits >> 8) & 0x0f) as u8)
468    }
469    #[doc = "Bit 15 - PRS CLK Enable"]
470    #[inline(always)]
471    pub fn clkprs(&self) -> CLKPRS_R {
472        CLKPRS_R::new(((self.bits >> 15) & 0x01) != 0)
473    }
474}
475impl W {
476    #[doc = "Bits 0:3 - RX PRS Channel Select"]
477    #[inline(always)]
478    pub fn rxprssel(&mut self) -> RXPRSSEL_W {
479        RXPRSSEL_W { w: self }
480    }
481    #[doc = "Bit 7 - PRS RX Enable"]
482    #[inline(always)]
483    pub fn rxprs(&mut self) -> RXPRS_W {
484        RXPRS_W { w: self }
485    }
486    #[doc = "Bits 8:11 - CLK PRS Channel Select"]
487    #[inline(always)]
488    pub fn clkprssel(&mut self) -> CLKPRSSEL_W {
489        CLKPRSSEL_W { w: self }
490    }
491    #[doc = "Bit 15 - PRS CLK Enable"]
492    #[inline(always)]
493    pub fn clkprs(&mut self) -> CLKPRS_W {
494        CLKPRS_W { w: self }
495    }
496}