efm32hg310_pac/leuart0/
route.rs1#[doc = "Register `ROUTE` reader"]
2pub struct R(crate::R<ROUTE_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<ROUTE_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<ROUTE_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<ROUTE_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `ROUTE` writer"]
17pub struct W(crate::W<ROUTE_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<ROUTE_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<ROUTE_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<ROUTE_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `RXPEN` reader - RX Pin Enable"]
38pub type RXPEN_R = crate::BitReader<bool>;
39#[doc = "Field `RXPEN` writer - RX Pin Enable"]
40pub type RXPEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 0>;
41#[doc = "Field `TXPEN` reader - TX Pin Enable"]
42pub type TXPEN_R = crate::BitReader<bool>;
43#[doc = "Field `TXPEN` writer - TX Pin Enable"]
44pub type TXPEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 1>;
45#[doc = "I/O Location\n\nValue on reset: 0"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47#[repr(u8)]
48pub enum LOCATION_A {
49 #[doc = "0: Location 0"]
50 LOC0 = 0,
51 #[doc = "1: Location 1"]
52 LOC1 = 1,
53 #[doc = "2: Location 2"]
54 LOC2 = 2,
55 #[doc = "3: Location 3"]
56 LOC3 = 3,
57 #[doc = "4: Location 4"]
58 LOC4 = 4,
59 #[doc = "5: Location 5"]
60 LOC5 = 5,
61}
62impl From<LOCATION_A> for u8 {
63 #[inline(always)]
64 fn from(variant: LOCATION_A) -> Self {
65 variant as _
66 }
67}
68#[doc = "Field `LOCATION` reader - I/O Location"]
69pub type LOCATION_R = crate::FieldReader<u8, LOCATION_A>;
70impl LOCATION_R {
71 #[doc = "Get enumerated values variant"]
72 #[inline(always)]
73 pub fn variant(&self) -> Option<LOCATION_A> {
74 match self.bits {
75 0 => Some(LOCATION_A::LOC0),
76 1 => Some(LOCATION_A::LOC1),
77 2 => Some(LOCATION_A::LOC2),
78 3 => Some(LOCATION_A::LOC3),
79 4 => Some(LOCATION_A::LOC4),
80 5 => Some(LOCATION_A::LOC5),
81 _ => None,
82 }
83 }
84 #[doc = "Checks if the value of the field is `LOC0`"]
85 #[inline(always)]
86 pub fn is_loc0(&self) -> bool {
87 *self == LOCATION_A::LOC0
88 }
89 #[doc = "Checks if the value of the field is `LOC1`"]
90 #[inline(always)]
91 pub fn is_loc1(&self) -> bool {
92 *self == LOCATION_A::LOC1
93 }
94 #[doc = "Checks if the value of the field is `LOC2`"]
95 #[inline(always)]
96 pub fn is_loc2(&self) -> bool {
97 *self == LOCATION_A::LOC2
98 }
99 #[doc = "Checks if the value of the field is `LOC3`"]
100 #[inline(always)]
101 pub fn is_loc3(&self) -> bool {
102 *self == LOCATION_A::LOC3
103 }
104 #[doc = "Checks if the value of the field is `LOC4`"]
105 #[inline(always)]
106 pub fn is_loc4(&self) -> bool {
107 *self == LOCATION_A::LOC4
108 }
109 #[doc = "Checks if the value of the field is `LOC5`"]
110 #[inline(always)]
111 pub fn is_loc5(&self) -> bool {
112 *self == LOCATION_A::LOC5
113 }
114}
115#[doc = "Field `LOCATION` writer - I/O Location"]
116pub type LOCATION_W<'a> = crate::FieldWriter<'a, u32, ROUTE_SPEC, u8, LOCATION_A, 3, 8>;
117impl<'a> LOCATION_W<'a> {
118 #[doc = "Location 0"]
119 #[inline(always)]
120 pub fn loc0(self) -> &'a mut W {
121 self.variant(LOCATION_A::LOC0)
122 }
123 #[doc = "Location 1"]
124 #[inline(always)]
125 pub fn loc1(self) -> &'a mut W {
126 self.variant(LOCATION_A::LOC1)
127 }
128 #[doc = "Location 2"]
129 #[inline(always)]
130 pub fn loc2(self) -> &'a mut W {
131 self.variant(LOCATION_A::LOC2)
132 }
133 #[doc = "Location 3"]
134 #[inline(always)]
135 pub fn loc3(self) -> &'a mut W {
136 self.variant(LOCATION_A::LOC3)
137 }
138 #[doc = "Location 4"]
139 #[inline(always)]
140 pub fn loc4(self) -> &'a mut W {
141 self.variant(LOCATION_A::LOC4)
142 }
143 #[doc = "Location 5"]
144 #[inline(always)]
145 pub fn loc5(self) -> &'a mut W {
146 self.variant(LOCATION_A::LOC5)
147 }
148}
149impl R {
150 #[doc = "Bit 0 - RX Pin Enable"]
151 #[inline(always)]
152 pub fn rxpen(&self) -> RXPEN_R {
153 RXPEN_R::new((self.bits & 1) != 0)
154 }
155 #[doc = "Bit 1 - TX Pin Enable"]
156 #[inline(always)]
157 pub fn txpen(&self) -> TXPEN_R {
158 TXPEN_R::new(((self.bits >> 1) & 1) != 0)
159 }
160 #[doc = "Bits 8:10 - I/O Location"]
161 #[inline(always)]
162 pub fn location(&self) -> LOCATION_R {
163 LOCATION_R::new(((self.bits >> 8) & 7) as u8)
164 }
165}
166impl W {
167 #[doc = "Bit 0 - RX Pin Enable"]
168 #[inline(always)]
169 pub fn rxpen(&mut self) -> RXPEN_W {
170 RXPEN_W::new(self)
171 }
172 #[doc = "Bit 1 - TX Pin Enable"]
173 #[inline(always)]
174 pub fn txpen(&mut self) -> TXPEN_W {
175 TXPEN_W::new(self)
176 }
177 #[doc = "Bits 8:10 - I/O Location"]
178 #[inline(always)]
179 pub fn location(&mut self) -> LOCATION_W {
180 LOCATION_W::new(self)
181 }
182 #[doc = "Writes raw bits to the register."]
183 #[inline(always)]
184 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
185 self.0.bits(bits);
186 self
187 }
188}
189#[doc = "I/O Routing 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 [route](index.html) module"]
190pub struct ROUTE_SPEC;
191impl crate::RegisterSpec for ROUTE_SPEC {
192 type Ux = u32;
193}
194#[doc = "`read()` method returns [route::R](R) reader structure"]
195impl crate::Readable for ROUTE_SPEC {
196 type Reader = R;
197}
198#[doc = "`write(|w| ..)` method takes [route::W](W) writer structure"]
199impl crate::Writable for ROUTE_SPEC {
200 type Writer = W;
201}
202#[doc = "`reset()` method sets ROUTE to value 0"]
203impl crate::Resettable for ROUTE_SPEC {
204 #[inline(always)]
205 fn reset_value() -> Self::Ux {
206 0
207 }
208}