efm32pg12_pac/leuart0/
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 << 5)) | (((value as u32) & 0x01) << 5);
230        self.w
231    }
232}
233impl R {
234    #[doc = "Bits 0:3 - RX PRS Channel Select"]
235    #[inline(always)]
236    pub fn rxprssel(&self) -> RXPRSSEL_R {
237        RXPRSSEL_R::new((self.bits & 0x0f) as u8)
238    }
239    #[doc = "Bit 5 - PRS RX Enable"]
240    #[inline(always)]
241    pub fn rxprs(&self) -> RXPRS_R {
242        RXPRS_R::new(((self.bits >> 5) & 0x01) != 0)
243    }
244}
245impl W {
246    #[doc = "Bits 0:3 - RX PRS Channel Select"]
247    #[inline(always)]
248    pub fn rxprssel(&mut self) -> RXPRSSEL_W {
249        RXPRSSEL_W { w: self }
250    }
251    #[doc = "Bit 5 - PRS RX Enable"]
252    #[inline(always)]
253    pub fn rxprs(&mut self) -> RXPRS_W {
254        RXPRS_W { w: self }
255    }
256}