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