efm32tg11b_pac/efm32tg11b540/usart2/
routeloc1.rs

1#[doc = "Register `ROUTELOC1` reader"]
2pub struct R(crate::R<ROUTELOC1_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ROUTELOC1_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ROUTELOC1_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ROUTELOC1_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `ROUTELOC1` writer"]
17pub struct W(crate::W<ROUTELOC1_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ROUTELOC1_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<ROUTELOC1_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ROUTELOC1_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CTSLOC` reader - I/O Location"]
38pub type CTSLOC_R = crate::FieldReader<u8, CTSLOC_A>;
39#[doc = "I/O Location\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum CTSLOC_A {
43    #[doc = "0: Location 0"]
44    LOC0 = 0,
45    #[doc = "1: Location 1"]
46    LOC1 = 1,
47    #[doc = "2: Location 2"]
48    LOC2 = 2,
49    #[doc = "3: Location 3"]
50    LOC3 = 3,
51    #[doc = "4: Location 4"]
52    LOC4 = 4,
53    #[doc = "5: Location 5"]
54    LOC5 = 5,
55    #[doc = "6: Location 6"]
56    LOC6 = 6,
57}
58impl From<CTSLOC_A> for u8 {
59    #[inline(always)]
60    fn from(variant: CTSLOC_A) -> Self {
61        variant as _
62    }
63}
64impl CTSLOC_R {
65    #[doc = "Get enumerated values variant"]
66    #[inline(always)]
67    pub fn variant(&self) -> Option<CTSLOC_A> {
68        match self.bits {
69            0 => Some(CTSLOC_A::LOC0),
70            1 => Some(CTSLOC_A::LOC1),
71            2 => Some(CTSLOC_A::LOC2),
72            3 => Some(CTSLOC_A::LOC3),
73            4 => Some(CTSLOC_A::LOC4),
74            5 => Some(CTSLOC_A::LOC5),
75            6 => Some(CTSLOC_A::LOC6),
76            _ => None,
77        }
78    }
79    #[doc = "Checks if the value of the field is `LOC0`"]
80    #[inline(always)]
81    pub fn is_loc0(&self) -> bool {
82        *self == CTSLOC_A::LOC0
83    }
84    #[doc = "Checks if the value of the field is `LOC1`"]
85    #[inline(always)]
86    pub fn is_loc1(&self) -> bool {
87        *self == CTSLOC_A::LOC1
88    }
89    #[doc = "Checks if the value of the field is `LOC2`"]
90    #[inline(always)]
91    pub fn is_loc2(&self) -> bool {
92        *self == CTSLOC_A::LOC2
93    }
94    #[doc = "Checks if the value of the field is `LOC3`"]
95    #[inline(always)]
96    pub fn is_loc3(&self) -> bool {
97        *self == CTSLOC_A::LOC3
98    }
99    #[doc = "Checks if the value of the field is `LOC4`"]
100    #[inline(always)]
101    pub fn is_loc4(&self) -> bool {
102        *self == CTSLOC_A::LOC4
103    }
104    #[doc = "Checks if the value of the field is `LOC5`"]
105    #[inline(always)]
106    pub fn is_loc5(&self) -> bool {
107        *self == CTSLOC_A::LOC5
108    }
109    #[doc = "Checks if the value of the field is `LOC6`"]
110    #[inline(always)]
111    pub fn is_loc6(&self) -> bool {
112        *self == CTSLOC_A::LOC6
113    }
114}
115#[doc = "Field `CTSLOC` writer - I/O Location"]
116pub type CTSLOC_W<'a, const O: u8> =
117    crate::FieldWriter<'a, u32, ROUTELOC1_SPEC, u8, CTSLOC_A, 6, O>;
118impl<'a, const O: u8> CTSLOC_W<'a, O> {
119    #[doc = "Location 0"]
120    #[inline(always)]
121    pub fn loc0(self) -> &'a mut W {
122        self.variant(CTSLOC_A::LOC0)
123    }
124    #[doc = "Location 1"]
125    #[inline(always)]
126    pub fn loc1(self) -> &'a mut W {
127        self.variant(CTSLOC_A::LOC1)
128    }
129    #[doc = "Location 2"]
130    #[inline(always)]
131    pub fn loc2(self) -> &'a mut W {
132        self.variant(CTSLOC_A::LOC2)
133    }
134    #[doc = "Location 3"]
135    #[inline(always)]
136    pub fn loc3(self) -> &'a mut W {
137        self.variant(CTSLOC_A::LOC3)
138    }
139    #[doc = "Location 4"]
140    #[inline(always)]
141    pub fn loc4(self) -> &'a mut W {
142        self.variant(CTSLOC_A::LOC4)
143    }
144    #[doc = "Location 5"]
145    #[inline(always)]
146    pub fn loc5(self) -> &'a mut W {
147        self.variant(CTSLOC_A::LOC5)
148    }
149    #[doc = "Location 6"]
150    #[inline(always)]
151    pub fn loc6(self) -> &'a mut W {
152        self.variant(CTSLOC_A::LOC6)
153    }
154}
155#[doc = "Field `RTSLOC` reader - I/O Location"]
156pub type RTSLOC_R = crate::FieldReader<u8, RTSLOC_A>;
157#[doc = "I/O Location\n\nValue on reset: 0"]
158#[derive(Clone, Copy, Debug, PartialEq, Eq)]
159#[repr(u8)]
160pub enum RTSLOC_A {
161    #[doc = "0: Location 0"]
162    LOC0 = 0,
163    #[doc = "1: Location 1"]
164    LOC1 = 1,
165    #[doc = "2: Location 2"]
166    LOC2 = 2,
167    #[doc = "3: Location 3"]
168    LOC3 = 3,
169    #[doc = "4: Location 4"]
170    LOC4 = 4,
171    #[doc = "5: Location 5"]
172    LOC5 = 5,
173    #[doc = "6: Location 6"]
174    LOC6 = 6,
175}
176impl From<RTSLOC_A> for u8 {
177    #[inline(always)]
178    fn from(variant: RTSLOC_A) -> Self {
179        variant as _
180    }
181}
182impl RTSLOC_R {
183    #[doc = "Get enumerated values variant"]
184    #[inline(always)]
185    pub fn variant(&self) -> Option<RTSLOC_A> {
186        match self.bits {
187            0 => Some(RTSLOC_A::LOC0),
188            1 => Some(RTSLOC_A::LOC1),
189            2 => Some(RTSLOC_A::LOC2),
190            3 => Some(RTSLOC_A::LOC3),
191            4 => Some(RTSLOC_A::LOC4),
192            5 => Some(RTSLOC_A::LOC5),
193            6 => Some(RTSLOC_A::LOC6),
194            _ => None,
195        }
196    }
197    #[doc = "Checks if the value of the field is `LOC0`"]
198    #[inline(always)]
199    pub fn is_loc0(&self) -> bool {
200        *self == RTSLOC_A::LOC0
201    }
202    #[doc = "Checks if the value of the field is `LOC1`"]
203    #[inline(always)]
204    pub fn is_loc1(&self) -> bool {
205        *self == RTSLOC_A::LOC1
206    }
207    #[doc = "Checks if the value of the field is `LOC2`"]
208    #[inline(always)]
209    pub fn is_loc2(&self) -> bool {
210        *self == RTSLOC_A::LOC2
211    }
212    #[doc = "Checks if the value of the field is `LOC3`"]
213    #[inline(always)]
214    pub fn is_loc3(&self) -> bool {
215        *self == RTSLOC_A::LOC3
216    }
217    #[doc = "Checks if the value of the field is `LOC4`"]
218    #[inline(always)]
219    pub fn is_loc4(&self) -> bool {
220        *self == RTSLOC_A::LOC4
221    }
222    #[doc = "Checks if the value of the field is `LOC5`"]
223    #[inline(always)]
224    pub fn is_loc5(&self) -> bool {
225        *self == RTSLOC_A::LOC5
226    }
227    #[doc = "Checks if the value of the field is `LOC6`"]
228    #[inline(always)]
229    pub fn is_loc6(&self) -> bool {
230        *self == RTSLOC_A::LOC6
231    }
232}
233#[doc = "Field `RTSLOC` writer - I/O Location"]
234pub type RTSLOC_W<'a, const O: u8> =
235    crate::FieldWriter<'a, u32, ROUTELOC1_SPEC, u8, RTSLOC_A, 6, O>;
236impl<'a, const O: u8> RTSLOC_W<'a, O> {
237    #[doc = "Location 0"]
238    #[inline(always)]
239    pub fn loc0(self) -> &'a mut W {
240        self.variant(RTSLOC_A::LOC0)
241    }
242    #[doc = "Location 1"]
243    #[inline(always)]
244    pub fn loc1(self) -> &'a mut W {
245        self.variant(RTSLOC_A::LOC1)
246    }
247    #[doc = "Location 2"]
248    #[inline(always)]
249    pub fn loc2(self) -> &'a mut W {
250        self.variant(RTSLOC_A::LOC2)
251    }
252    #[doc = "Location 3"]
253    #[inline(always)]
254    pub fn loc3(self) -> &'a mut W {
255        self.variant(RTSLOC_A::LOC3)
256    }
257    #[doc = "Location 4"]
258    #[inline(always)]
259    pub fn loc4(self) -> &'a mut W {
260        self.variant(RTSLOC_A::LOC4)
261    }
262    #[doc = "Location 5"]
263    #[inline(always)]
264    pub fn loc5(self) -> &'a mut W {
265        self.variant(RTSLOC_A::LOC5)
266    }
267    #[doc = "Location 6"]
268    #[inline(always)]
269    pub fn loc6(self) -> &'a mut W {
270        self.variant(RTSLOC_A::LOC6)
271    }
272}
273impl R {
274    #[doc = "Bits 0:5 - I/O Location"]
275    #[inline(always)]
276    pub fn ctsloc(&self) -> CTSLOC_R {
277        CTSLOC_R::new((self.bits & 0x3f) as u8)
278    }
279    #[doc = "Bits 8:13 - I/O Location"]
280    #[inline(always)]
281    pub fn rtsloc(&self) -> RTSLOC_R {
282        RTSLOC_R::new(((self.bits >> 8) & 0x3f) as u8)
283    }
284}
285impl W {
286    #[doc = "Bits 0:5 - I/O Location"]
287    #[inline(always)]
288    #[must_use]
289    pub fn ctsloc(&mut self) -> CTSLOC_W<0> {
290        CTSLOC_W::new(self)
291    }
292    #[doc = "Bits 8:13 - I/O Location"]
293    #[inline(always)]
294    #[must_use]
295    pub fn rtsloc(&mut self) -> RTSLOC_W<8> {
296        RTSLOC_W::new(self)
297    }
298    #[doc = "Writes raw bits to the register."]
299    #[inline(always)]
300    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
301        self.0.bits(bits);
302        self
303    }
304}
305#[doc = "I/O Routing Location 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 [routeloc1](index.html) module"]
306pub struct ROUTELOC1_SPEC;
307impl crate::RegisterSpec for ROUTELOC1_SPEC {
308    type Ux = u32;
309}
310#[doc = "`read()` method returns [routeloc1::R](R) reader structure"]
311impl crate::Readable for ROUTELOC1_SPEC {
312    type Reader = R;
313}
314#[doc = "`write(|w| ..)` method takes [routeloc1::W](W) writer structure"]
315impl crate::Writable for ROUTELOC1_SPEC {
316    type Writer = W;
317    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
318    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
319}
320#[doc = "`reset()` method sets ROUTELOC1 to value 0"]
321impl crate::Resettable for ROUTELOC1_SPEC {
322    const RESET_VALUE: Self::Ux = 0;
323}