efm32wg230_pac/gpio/
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 `SWCLKPEN` reader - Serial Wire Clock Pin Enable"]
38pub type SWCLKPEN_R = crate::BitReader<bool>;
39#[doc = "Field `SWCLKPEN` writer - Serial Wire Clock Pin Enable"]
40pub type SWCLKPEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 0>;
41#[doc = "Field `SWDIOPEN` reader - Serial Wire Data Pin Enable"]
42pub type SWDIOPEN_R = crate::BitReader<bool>;
43#[doc = "Field `SWDIOPEN` writer - Serial Wire Data Pin Enable"]
44pub type SWDIOPEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 1>;
45#[doc = "Field `SWOPEN` reader - Serial Wire Viewer Output Pin Enable"]
46pub type SWOPEN_R = crate::BitReader<bool>;
47#[doc = "Field `SWOPEN` writer - Serial Wire Viewer Output Pin Enable"]
48pub type SWOPEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 2>;
49#[doc = "I/O Location\n\nValue on reset: 0"]
50#[derive(Clone, Copy, Debug, PartialEq)]
51#[repr(u8)]
52pub enum SWLOCATION_A {
53 #[doc = "0: Location 0"]
54 LOC0 = 0,
55 #[doc = "1: Location 1"]
56 LOC1 = 1,
57 #[doc = "2: Location 2"]
58 LOC2 = 2,
59 #[doc = "3: Location 3"]
60 LOC3 = 3,
61}
62impl From<SWLOCATION_A> for u8 {
63 #[inline(always)]
64 fn from(variant: SWLOCATION_A) -> Self {
65 variant as _
66 }
67}
68#[doc = "Field `SWLOCATION` reader - I/O Location"]
69pub type SWLOCATION_R = crate::FieldReader<u8, SWLOCATION_A>;
70impl SWLOCATION_R {
71 #[doc = "Get enumerated values variant"]
72 #[inline(always)]
73 pub fn variant(&self) -> SWLOCATION_A {
74 match self.bits {
75 0 => SWLOCATION_A::LOC0,
76 1 => SWLOCATION_A::LOC1,
77 2 => SWLOCATION_A::LOC2,
78 3 => SWLOCATION_A::LOC3,
79 _ => unreachable!(),
80 }
81 }
82 #[doc = "Checks if the value of the field is `LOC0`"]
83 #[inline(always)]
84 pub fn is_loc0(&self) -> bool {
85 *self == SWLOCATION_A::LOC0
86 }
87 #[doc = "Checks if the value of the field is `LOC1`"]
88 #[inline(always)]
89 pub fn is_loc1(&self) -> bool {
90 *self == SWLOCATION_A::LOC1
91 }
92 #[doc = "Checks if the value of the field is `LOC2`"]
93 #[inline(always)]
94 pub fn is_loc2(&self) -> bool {
95 *self == SWLOCATION_A::LOC2
96 }
97 #[doc = "Checks if the value of the field is `LOC3`"]
98 #[inline(always)]
99 pub fn is_loc3(&self) -> bool {
100 *self == SWLOCATION_A::LOC3
101 }
102}
103#[doc = "Field `SWLOCATION` writer - I/O Location"]
104pub type SWLOCATION_W<'a> = crate::FieldWriterSafe<'a, u32, ROUTE_SPEC, u8, SWLOCATION_A, 2, 8>;
105impl<'a> SWLOCATION_W<'a> {
106 #[doc = "Location 0"]
107 #[inline(always)]
108 pub fn loc0(self) -> &'a mut W {
109 self.variant(SWLOCATION_A::LOC0)
110 }
111 #[doc = "Location 1"]
112 #[inline(always)]
113 pub fn loc1(self) -> &'a mut W {
114 self.variant(SWLOCATION_A::LOC1)
115 }
116 #[doc = "Location 2"]
117 #[inline(always)]
118 pub fn loc2(self) -> &'a mut W {
119 self.variant(SWLOCATION_A::LOC2)
120 }
121 #[doc = "Location 3"]
122 #[inline(always)]
123 pub fn loc3(self) -> &'a mut W {
124 self.variant(SWLOCATION_A::LOC3)
125 }
126}
127#[doc = "Field `TCLKPEN` reader - ETM Trace Clock Pin Enable"]
128pub type TCLKPEN_R = crate::BitReader<bool>;
129#[doc = "Field `TCLKPEN` writer - ETM Trace Clock Pin Enable"]
130pub type TCLKPEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 12>;
131#[doc = "Field `TD0PEN` reader - ETM Trace Data Pin Enable"]
132pub type TD0PEN_R = crate::BitReader<bool>;
133#[doc = "Field `TD0PEN` writer - ETM Trace Data Pin Enable"]
134pub type TD0PEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 13>;
135#[doc = "Field `TD1PEN` reader - ETM Trace Data Pin Enable"]
136pub type TD1PEN_R = crate::BitReader<bool>;
137#[doc = "Field `TD1PEN` writer - ETM Trace Data Pin Enable"]
138pub type TD1PEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 14>;
139#[doc = "Field `TD2PEN` reader - ETM Trace Data Pin Enable"]
140pub type TD2PEN_R = crate::BitReader<bool>;
141#[doc = "Field `TD2PEN` writer - ETM Trace Data Pin Enable"]
142pub type TD2PEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 15>;
143#[doc = "Field `TD3PEN` reader - ETM Trace Data Pin Enable"]
144pub type TD3PEN_R = crate::BitReader<bool>;
145#[doc = "Field `TD3PEN` writer - ETM Trace Data Pin Enable"]
146pub type TD3PEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 16>;
147#[doc = "I/O Location\n\nValue on reset: 0"]
148#[derive(Clone, Copy, Debug, PartialEq)]
149#[repr(u8)]
150pub enum ETMLOCATION_A {
151 #[doc = "0: Location 0"]
152 LOC0 = 0,
153 #[doc = "1: Location 1"]
154 LOC1 = 1,
155 #[doc = "2: Location 2"]
156 LOC2 = 2,
157 #[doc = "3: Location 3"]
158 LOC3 = 3,
159}
160impl From<ETMLOCATION_A> for u8 {
161 #[inline(always)]
162 fn from(variant: ETMLOCATION_A) -> Self {
163 variant as _
164 }
165}
166#[doc = "Field `ETMLOCATION` reader - I/O Location"]
167pub type ETMLOCATION_R = crate::FieldReader<u8, ETMLOCATION_A>;
168impl ETMLOCATION_R {
169 #[doc = "Get enumerated values variant"]
170 #[inline(always)]
171 pub fn variant(&self) -> ETMLOCATION_A {
172 match self.bits {
173 0 => ETMLOCATION_A::LOC0,
174 1 => ETMLOCATION_A::LOC1,
175 2 => ETMLOCATION_A::LOC2,
176 3 => ETMLOCATION_A::LOC3,
177 _ => unreachable!(),
178 }
179 }
180 #[doc = "Checks if the value of the field is `LOC0`"]
181 #[inline(always)]
182 pub fn is_loc0(&self) -> bool {
183 *self == ETMLOCATION_A::LOC0
184 }
185 #[doc = "Checks if the value of the field is `LOC1`"]
186 #[inline(always)]
187 pub fn is_loc1(&self) -> bool {
188 *self == ETMLOCATION_A::LOC1
189 }
190 #[doc = "Checks if the value of the field is `LOC2`"]
191 #[inline(always)]
192 pub fn is_loc2(&self) -> bool {
193 *self == ETMLOCATION_A::LOC2
194 }
195 #[doc = "Checks if the value of the field is `LOC3`"]
196 #[inline(always)]
197 pub fn is_loc3(&self) -> bool {
198 *self == ETMLOCATION_A::LOC3
199 }
200}
201#[doc = "Field `ETMLOCATION` writer - I/O Location"]
202pub type ETMLOCATION_W<'a> = crate::FieldWriterSafe<'a, u32, ROUTE_SPEC, u8, ETMLOCATION_A, 2, 24>;
203impl<'a> ETMLOCATION_W<'a> {
204 #[doc = "Location 0"]
205 #[inline(always)]
206 pub fn loc0(self) -> &'a mut W {
207 self.variant(ETMLOCATION_A::LOC0)
208 }
209 #[doc = "Location 1"]
210 #[inline(always)]
211 pub fn loc1(self) -> &'a mut W {
212 self.variant(ETMLOCATION_A::LOC1)
213 }
214 #[doc = "Location 2"]
215 #[inline(always)]
216 pub fn loc2(self) -> &'a mut W {
217 self.variant(ETMLOCATION_A::LOC2)
218 }
219 #[doc = "Location 3"]
220 #[inline(always)]
221 pub fn loc3(self) -> &'a mut W {
222 self.variant(ETMLOCATION_A::LOC3)
223 }
224}
225impl R {
226 #[doc = "Bit 0 - Serial Wire Clock Pin Enable"]
227 #[inline(always)]
228 pub fn swclkpen(&self) -> SWCLKPEN_R {
229 SWCLKPEN_R::new((self.bits & 1) != 0)
230 }
231 #[doc = "Bit 1 - Serial Wire Data Pin Enable"]
232 #[inline(always)]
233 pub fn swdiopen(&self) -> SWDIOPEN_R {
234 SWDIOPEN_R::new(((self.bits >> 1) & 1) != 0)
235 }
236 #[doc = "Bit 2 - Serial Wire Viewer Output Pin Enable"]
237 #[inline(always)]
238 pub fn swopen(&self) -> SWOPEN_R {
239 SWOPEN_R::new(((self.bits >> 2) & 1) != 0)
240 }
241 #[doc = "Bits 8:9 - I/O Location"]
242 #[inline(always)]
243 pub fn swlocation(&self) -> SWLOCATION_R {
244 SWLOCATION_R::new(((self.bits >> 8) & 3) as u8)
245 }
246 #[doc = "Bit 12 - ETM Trace Clock Pin Enable"]
247 #[inline(always)]
248 pub fn tclkpen(&self) -> TCLKPEN_R {
249 TCLKPEN_R::new(((self.bits >> 12) & 1) != 0)
250 }
251 #[doc = "Bit 13 - ETM Trace Data Pin Enable"]
252 #[inline(always)]
253 pub fn td0pen(&self) -> TD0PEN_R {
254 TD0PEN_R::new(((self.bits >> 13) & 1) != 0)
255 }
256 #[doc = "Bit 14 - ETM Trace Data Pin Enable"]
257 #[inline(always)]
258 pub fn td1pen(&self) -> TD1PEN_R {
259 TD1PEN_R::new(((self.bits >> 14) & 1) != 0)
260 }
261 #[doc = "Bit 15 - ETM Trace Data Pin Enable"]
262 #[inline(always)]
263 pub fn td2pen(&self) -> TD2PEN_R {
264 TD2PEN_R::new(((self.bits >> 15) & 1) != 0)
265 }
266 #[doc = "Bit 16 - ETM Trace Data Pin Enable"]
267 #[inline(always)]
268 pub fn td3pen(&self) -> TD3PEN_R {
269 TD3PEN_R::new(((self.bits >> 16) & 1) != 0)
270 }
271 #[doc = "Bits 24:25 - I/O Location"]
272 #[inline(always)]
273 pub fn etmlocation(&self) -> ETMLOCATION_R {
274 ETMLOCATION_R::new(((self.bits >> 24) & 3) as u8)
275 }
276}
277impl W {
278 #[doc = "Bit 0 - Serial Wire Clock Pin Enable"]
279 #[inline(always)]
280 pub fn swclkpen(&mut self) -> SWCLKPEN_W {
281 SWCLKPEN_W::new(self)
282 }
283 #[doc = "Bit 1 - Serial Wire Data Pin Enable"]
284 #[inline(always)]
285 pub fn swdiopen(&mut self) -> SWDIOPEN_W {
286 SWDIOPEN_W::new(self)
287 }
288 #[doc = "Bit 2 - Serial Wire Viewer Output Pin Enable"]
289 #[inline(always)]
290 pub fn swopen(&mut self) -> SWOPEN_W {
291 SWOPEN_W::new(self)
292 }
293 #[doc = "Bits 8:9 - I/O Location"]
294 #[inline(always)]
295 pub fn swlocation(&mut self) -> SWLOCATION_W {
296 SWLOCATION_W::new(self)
297 }
298 #[doc = "Bit 12 - ETM Trace Clock Pin Enable"]
299 #[inline(always)]
300 pub fn tclkpen(&mut self) -> TCLKPEN_W {
301 TCLKPEN_W::new(self)
302 }
303 #[doc = "Bit 13 - ETM Trace Data Pin Enable"]
304 #[inline(always)]
305 pub fn td0pen(&mut self) -> TD0PEN_W {
306 TD0PEN_W::new(self)
307 }
308 #[doc = "Bit 14 - ETM Trace Data Pin Enable"]
309 #[inline(always)]
310 pub fn td1pen(&mut self) -> TD1PEN_W {
311 TD1PEN_W::new(self)
312 }
313 #[doc = "Bit 15 - ETM Trace Data Pin Enable"]
314 #[inline(always)]
315 pub fn td2pen(&mut self) -> TD2PEN_W {
316 TD2PEN_W::new(self)
317 }
318 #[doc = "Bit 16 - ETM Trace Data Pin Enable"]
319 #[inline(always)]
320 pub fn td3pen(&mut self) -> TD3PEN_W {
321 TD3PEN_W::new(self)
322 }
323 #[doc = "Bits 24:25 - I/O Location"]
324 #[inline(always)]
325 pub fn etmlocation(&mut self) -> ETMLOCATION_W {
326 ETMLOCATION_W::new(self)
327 }
328 #[doc = "Writes raw bits to the register."]
329 #[inline(always)]
330 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
331 self.0.bits(bits);
332 self
333 }
334}
335#[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"]
336pub struct ROUTE_SPEC;
337impl crate::RegisterSpec for ROUTE_SPEC {
338 type Ux = u32;
339}
340#[doc = "`read()` method returns [route::R](R) reader structure"]
341impl crate::Readable for ROUTE_SPEC {
342 type Reader = R;
343}
344#[doc = "`write(|w| ..)` method takes [route::W](W) writer structure"]
345impl crate::Writable for ROUTE_SPEC {
346 type Writer = W;
347}
348#[doc = "`reset()` method sets ROUTE to value 0x03"]
349impl crate::Resettable for ROUTE_SPEC {
350 #[inline(always)]
351 fn reset_value() -> Self::Ux {
352 0x03
353 }
354}