efm32wg230_pac/leuart0/
input.rs

1#[doc = "Register `INPUT` reader"]
2pub struct R(crate::R<INPUT_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<INPUT_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<INPUT_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<INPUT_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `INPUT` writer"]
17pub struct W(crate::W<INPUT_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<INPUT_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<INPUT_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<INPUT_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "RX PRS Channel Select\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum RXPRSSEL_A {
41    #[doc = "0: PRS Channel 0 selected"]
42    PRSCH0 = 0,
43    #[doc = "1: PRS Channel 1 selected"]
44    PRSCH1 = 1,
45    #[doc = "2: PRS Channel 2 selected"]
46    PRSCH2 = 2,
47    #[doc = "3: PRS Channel 3 selected"]
48    PRSCH3 = 3,
49    #[doc = "4: PRS Channel 4 selected"]
50    PRSCH4 = 4,
51    #[doc = "5: PRS Channel 5 selected"]
52    PRSCH5 = 5,
53    #[doc = "6: PRS Channel 6 selected"]
54    PRSCH6 = 6,
55    #[doc = "7: PRS Channel 7 selected"]
56    PRSCH7 = 7,
57    #[doc = "8: PRS Channel 8 selected"]
58    PRSCH8 = 8,
59    #[doc = "9: PRS Channel 9 selected"]
60    PRSCH9 = 9,
61    #[doc = "10: PRS Channel 10 selected"]
62    PRSCH10 = 10,
63    #[doc = "11: PRS Channel 11 selected"]
64    PRSCH11 = 11,
65}
66impl From<RXPRSSEL_A> for u8 {
67    #[inline(always)]
68    fn from(variant: RXPRSSEL_A) -> Self {
69        variant as _
70    }
71}
72#[doc = "Field `RXPRSSEL` reader - RX PRS Channel Select"]
73pub type RXPRSSEL_R = crate::FieldReader<u8, RXPRSSEL_A>;
74impl RXPRSSEL_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub fn variant(&self) -> Option<RXPRSSEL_A> {
78        match self.bits {
79            0 => Some(RXPRSSEL_A::PRSCH0),
80            1 => Some(RXPRSSEL_A::PRSCH1),
81            2 => Some(RXPRSSEL_A::PRSCH2),
82            3 => Some(RXPRSSEL_A::PRSCH3),
83            4 => Some(RXPRSSEL_A::PRSCH4),
84            5 => Some(RXPRSSEL_A::PRSCH5),
85            6 => Some(RXPRSSEL_A::PRSCH6),
86            7 => Some(RXPRSSEL_A::PRSCH7),
87            8 => Some(RXPRSSEL_A::PRSCH8),
88            9 => Some(RXPRSSEL_A::PRSCH9),
89            10 => Some(RXPRSSEL_A::PRSCH10),
90            11 => Some(RXPRSSEL_A::PRSCH11),
91            _ => None,
92        }
93    }
94    #[doc = "Checks if the value of the field is `PRSCH0`"]
95    #[inline(always)]
96    pub fn is_prsch0(&self) -> bool {
97        *self == RXPRSSEL_A::PRSCH0
98    }
99    #[doc = "Checks if the value of the field is `PRSCH1`"]
100    #[inline(always)]
101    pub fn is_prsch1(&self) -> bool {
102        *self == RXPRSSEL_A::PRSCH1
103    }
104    #[doc = "Checks if the value of the field is `PRSCH2`"]
105    #[inline(always)]
106    pub fn is_prsch2(&self) -> bool {
107        *self == RXPRSSEL_A::PRSCH2
108    }
109    #[doc = "Checks if the value of the field is `PRSCH3`"]
110    #[inline(always)]
111    pub fn is_prsch3(&self) -> bool {
112        *self == RXPRSSEL_A::PRSCH3
113    }
114    #[doc = "Checks if the value of the field is `PRSCH4`"]
115    #[inline(always)]
116    pub fn is_prsch4(&self) -> bool {
117        *self == RXPRSSEL_A::PRSCH4
118    }
119    #[doc = "Checks if the value of the field is `PRSCH5`"]
120    #[inline(always)]
121    pub fn is_prsch5(&self) -> bool {
122        *self == RXPRSSEL_A::PRSCH5
123    }
124    #[doc = "Checks if the value of the field is `PRSCH6`"]
125    #[inline(always)]
126    pub fn is_prsch6(&self) -> bool {
127        *self == RXPRSSEL_A::PRSCH6
128    }
129    #[doc = "Checks if the value of the field is `PRSCH7`"]
130    #[inline(always)]
131    pub fn is_prsch7(&self) -> bool {
132        *self == RXPRSSEL_A::PRSCH7
133    }
134    #[doc = "Checks if the value of the field is `PRSCH8`"]
135    #[inline(always)]
136    pub fn is_prsch8(&self) -> bool {
137        *self == RXPRSSEL_A::PRSCH8
138    }
139    #[doc = "Checks if the value of the field is `PRSCH9`"]
140    #[inline(always)]
141    pub fn is_prsch9(&self) -> bool {
142        *self == RXPRSSEL_A::PRSCH9
143    }
144    #[doc = "Checks if the value of the field is `PRSCH10`"]
145    #[inline(always)]
146    pub fn is_prsch10(&self) -> bool {
147        *self == RXPRSSEL_A::PRSCH10
148    }
149    #[doc = "Checks if the value of the field is `PRSCH11`"]
150    #[inline(always)]
151    pub fn is_prsch11(&self) -> bool {
152        *self == RXPRSSEL_A::PRSCH11
153    }
154}
155#[doc = "Field `RXPRSSEL` writer - RX PRS Channel Select"]
156pub type RXPRSSEL_W<'a> = crate::FieldWriter<'a, u32, INPUT_SPEC, u8, RXPRSSEL_A, 4, 0>;
157impl<'a> RXPRSSEL_W<'a> {
158    #[doc = "PRS Channel 0 selected"]
159    #[inline(always)]
160    pub fn prsch0(self) -> &'a mut W {
161        self.variant(RXPRSSEL_A::PRSCH0)
162    }
163    #[doc = "PRS Channel 1 selected"]
164    #[inline(always)]
165    pub fn prsch1(self) -> &'a mut W {
166        self.variant(RXPRSSEL_A::PRSCH1)
167    }
168    #[doc = "PRS Channel 2 selected"]
169    #[inline(always)]
170    pub fn prsch2(self) -> &'a mut W {
171        self.variant(RXPRSSEL_A::PRSCH2)
172    }
173    #[doc = "PRS Channel 3 selected"]
174    #[inline(always)]
175    pub fn prsch3(self) -> &'a mut W {
176        self.variant(RXPRSSEL_A::PRSCH3)
177    }
178    #[doc = "PRS Channel 4 selected"]
179    #[inline(always)]
180    pub fn prsch4(self) -> &'a mut W {
181        self.variant(RXPRSSEL_A::PRSCH4)
182    }
183    #[doc = "PRS Channel 5 selected"]
184    #[inline(always)]
185    pub fn prsch5(self) -> &'a mut W {
186        self.variant(RXPRSSEL_A::PRSCH5)
187    }
188    #[doc = "PRS Channel 6 selected"]
189    #[inline(always)]
190    pub fn prsch6(self) -> &'a mut W {
191        self.variant(RXPRSSEL_A::PRSCH6)
192    }
193    #[doc = "PRS Channel 7 selected"]
194    #[inline(always)]
195    pub fn prsch7(self) -> &'a mut W {
196        self.variant(RXPRSSEL_A::PRSCH7)
197    }
198    #[doc = "PRS Channel 8 selected"]
199    #[inline(always)]
200    pub fn prsch8(self) -> &'a mut W {
201        self.variant(RXPRSSEL_A::PRSCH8)
202    }
203    #[doc = "PRS Channel 9 selected"]
204    #[inline(always)]
205    pub fn prsch9(self) -> &'a mut W {
206        self.variant(RXPRSSEL_A::PRSCH9)
207    }
208    #[doc = "PRS Channel 10 selected"]
209    #[inline(always)]
210    pub fn prsch10(self) -> &'a mut W {
211        self.variant(RXPRSSEL_A::PRSCH10)
212    }
213    #[doc = "PRS Channel 11 selected"]
214    #[inline(always)]
215    pub fn prsch11(self) -> &'a mut W {
216        self.variant(RXPRSSEL_A::PRSCH11)
217    }
218}
219#[doc = "Field `RXPRS` reader - PRS RX Enable"]
220pub type RXPRS_R = crate::BitReader<bool>;
221#[doc = "Field `RXPRS` writer - PRS RX Enable"]
222pub type RXPRS_W<'a> = crate::BitWriter<'a, u32, INPUT_SPEC, bool, 4>;
223impl R {
224    #[doc = "Bits 0:3 - RX PRS Channel Select"]
225    #[inline(always)]
226    pub fn rxprssel(&self) -> RXPRSSEL_R {
227        RXPRSSEL_R::new((self.bits & 0x0f) as u8)
228    }
229    #[doc = "Bit 4 - PRS RX Enable"]
230    #[inline(always)]
231    pub fn rxprs(&self) -> RXPRS_R {
232        RXPRS_R::new(((self.bits >> 4) & 1) != 0)
233    }
234}
235impl W {
236    #[doc = "Bits 0:3 - RX PRS Channel Select"]
237    #[inline(always)]
238    pub fn rxprssel(&mut self) -> RXPRSSEL_W {
239        RXPRSSEL_W::new(self)
240    }
241    #[doc = "Bit 4 - PRS RX Enable"]
242    #[inline(always)]
243    pub fn rxprs(&mut self) -> RXPRS_W {
244        RXPRS_W::new(self)
245    }
246    #[doc = "Writes raw bits to the register."]
247    #[inline(always)]
248    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
249        self.0.bits(bits);
250        self
251    }
252}
253#[doc = "LEUART Input 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 [input](index.html) module"]
254pub struct INPUT_SPEC;
255impl crate::RegisterSpec for INPUT_SPEC {
256    type Ux = u32;
257}
258#[doc = "`read()` method returns [input::R](R) reader structure"]
259impl crate::Readable for INPUT_SPEC {
260    type Reader = R;
261}
262#[doc = "`write(|w| ..)` method takes [input::W](W) writer structure"]
263impl crate::Writable for INPUT_SPEC {
264    type Writer = W;
265}
266#[doc = "`reset()` method sets INPUT to value 0"]
267impl crate::Resettable for INPUT_SPEC {
268    #[inline(always)]
269    fn reset_value() -> Self::Ux {
270        0
271    }
272}