efm32gg_pac/efm32gg995/leuart1/
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 = "Field `RXPRSSEL` reader - RX PRS Channel Select"]
38pub type RXPRSSEL_R = crate::FieldReader<u8, RXPRSSEL_A>;
39#[doc = "RX PRS Channel Select\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum RXPRSSEL_A {
43    #[doc = "0: PRS Channel 0 selected"]
44    PRSCH0 = 0,
45    #[doc = "1: PRS Channel 1 selected"]
46    PRSCH1 = 1,
47    #[doc = "2: PRS Channel 2 selected"]
48    PRSCH2 = 2,
49    #[doc = "3: PRS Channel 3 selected"]
50    PRSCH3 = 3,
51    #[doc = "4: PRS Channel 4 selected"]
52    PRSCH4 = 4,
53    #[doc = "5: PRS Channel 5 selected"]
54    PRSCH5 = 5,
55    #[doc = "6: PRS Channel 6 selected"]
56    PRSCH6 = 6,
57    #[doc = "7: PRS Channel 7 selected"]
58    PRSCH7 = 7,
59    #[doc = "8: PRS Channel 8 selected"]
60    PRSCH8 = 8,
61    #[doc = "9: PRS Channel 9 selected"]
62    PRSCH9 = 9,
63    #[doc = "10: PRS Channel 10 selected"]
64    PRSCH10 = 10,
65    #[doc = "11: PRS Channel 11 selected"]
66    PRSCH11 = 11,
67}
68impl From<RXPRSSEL_A> for u8 {
69    #[inline(always)]
70    fn from(variant: RXPRSSEL_A) -> Self {
71        variant as _
72    }
73}
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, const O: u8> =
157    crate::FieldWriter<'a, u32, INPUT_SPEC, u8, RXPRSSEL_A, 4, O>;
158impl<'a, const O: u8> RXPRSSEL_W<'a, O> {
159    #[doc = "PRS Channel 0 selected"]
160    #[inline(always)]
161    pub fn prsch0(self) -> &'a mut W {
162        self.variant(RXPRSSEL_A::PRSCH0)
163    }
164    #[doc = "PRS Channel 1 selected"]
165    #[inline(always)]
166    pub fn prsch1(self) -> &'a mut W {
167        self.variant(RXPRSSEL_A::PRSCH1)
168    }
169    #[doc = "PRS Channel 2 selected"]
170    #[inline(always)]
171    pub fn prsch2(self) -> &'a mut W {
172        self.variant(RXPRSSEL_A::PRSCH2)
173    }
174    #[doc = "PRS Channel 3 selected"]
175    #[inline(always)]
176    pub fn prsch3(self) -> &'a mut W {
177        self.variant(RXPRSSEL_A::PRSCH3)
178    }
179    #[doc = "PRS Channel 4 selected"]
180    #[inline(always)]
181    pub fn prsch4(self) -> &'a mut W {
182        self.variant(RXPRSSEL_A::PRSCH4)
183    }
184    #[doc = "PRS Channel 5 selected"]
185    #[inline(always)]
186    pub fn prsch5(self) -> &'a mut W {
187        self.variant(RXPRSSEL_A::PRSCH5)
188    }
189    #[doc = "PRS Channel 6 selected"]
190    #[inline(always)]
191    pub fn prsch6(self) -> &'a mut W {
192        self.variant(RXPRSSEL_A::PRSCH6)
193    }
194    #[doc = "PRS Channel 7 selected"]
195    #[inline(always)]
196    pub fn prsch7(self) -> &'a mut W {
197        self.variant(RXPRSSEL_A::PRSCH7)
198    }
199    #[doc = "PRS Channel 8 selected"]
200    #[inline(always)]
201    pub fn prsch8(self) -> &'a mut W {
202        self.variant(RXPRSSEL_A::PRSCH8)
203    }
204    #[doc = "PRS Channel 9 selected"]
205    #[inline(always)]
206    pub fn prsch9(self) -> &'a mut W {
207        self.variant(RXPRSSEL_A::PRSCH9)
208    }
209    #[doc = "PRS Channel 10 selected"]
210    #[inline(always)]
211    pub fn prsch10(self) -> &'a mut W {
212        self.variant(RXPRSSEL_A::PRSCH10)
213    }
214    #[doc = "PRS Channel 11 selected"]
215    #[inline(always)]
216    pub fn prsch11(self) -> &'a mut W {
217        self.variant(RXPRSSEL_A::PRSCH11)
218    }
219}
220#[doc = "Field `RXPRS` reader - PRS RX Enable"]
221pub type RXPRS_R = crate::BitReader<bool>;
222#[doc = "Field `RXPRS` writer - PRS RX Enable"]
223pub type RXPRS_W<'a, const O: u8> = crate::BitWriter<'a, u32, INPUT_SPEC, bool, O>;
224impl R {
225    #[doc = "Bits 0:3 - RX PRS Channel Select"]
226    #[inline(always)]
227    pub fn rxprssel(&self) -> RXPRSSEL_R {
228        RXPRSSEL_R::new((self.bits & 0x0f) as u8)
229    }
230    #[doc = "Bit 4 - PRS RX Enable"]
231    #[inline(always)]
232    pub fn rxprs(&self) -> RXPRS_R {
233        RXPRS_R::new(((self.bits >> 4) & 1) != 0)
234    }
235}
236impl W {
237    #[doc = "Bits 0:3 - RX PRS Channel Select"]
238    #[inline(always)]
239    #[must_use]
240    pub fn rxprssel(&mut self) -> RXPRSSEL_W<0> {
241        RXPRSSEL_W::new(self)
242    }
243    #[doc = "Bit 4 - PRS RX Enable"]
244    #[inline(always)]
245    #[must_use]
246    pub fn rxprs(&mut self) -> RXPRS_W<4> {
247        RXPRS_W::new(self)
248    }
249    #[doc = "Writes raw bits to the register."]
250    #[inline(always)]
251    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
252        self.0.bits(bits);
253        self
254    }
255}
256#[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"]
257pub struct INPUT_SPEC;
258impl crate::RegisterSpec for INPUT_SPEC {
259    type Ux = u32;
260}
261#[doc = "`read()` method returns [input::R](R) reader structure"]
262impl crate::Readable for INPUT_SPEC {
263    type Reader = R;
264}
265#[doc = "`write(|w| ..)` method takes [input::W](W) writer structure"]
266impl crate::Writable for INPUT_SPEC {
267    type Writer = W;
268    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
269    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
270}
271#[doc = "`reset()` method sets INPUT to value 0"]
272impl crate::Resettable for INPUT_SPEC {
273    const RESET_VALUE: Self::Ux = 0;
274}