efm32gg11b510_pac/gpio/
routeloc0.rs

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