efm32pg22_pac/efm32pg22c200/gpio_ns/
bbusalloc.rs

1#[doc = "Register `BBUSALLOC` reader"]
2pub struct R(crate::R<BBUSALLOC_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<BBUSALLOC_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<BBUSALLOC_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<BBUSALLOC_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `BBUSALLOC` writer"]
17pub struct W(crate::W<BBUSALLOC_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<BBUSALLOC_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<BBUSALLOC_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<BBUSALLOC_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `BEVEN0` reader - B Bus Even 0"]
38pub type BEVEN0_R = crate::FieldReader<u8, BEVEN0_A>;
39#[doc = "B Bus Even 0\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum BEVEN0_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<BEVEN0_A> for u8 {
49    #[inline(always)]
50    fn from(variant: BEVEN0_A) -> Self {
51        variant as _
52    }
53}
54impl BEVEN0_R {
55    #[doc = "Get enumerated values variant"]
56    #[inline(always)]
57    pub fn variant(&self) -> Option<BEVEN0_A> {
58        match self.bits {
59            0 => Some(BEVEN0_A::TRISTATE),
60            1 => Some(BEVEN0_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 == BEVEN0_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 == BEVEN0_A::ADC0
73    }
74}
75#[doc = "Field `BEVEN0` writer - B Bus Even 0"]
76pub type BEVEN0_W<'a, const O: u8> =
77    crate::FieldWriter<'a, u32, BBUSALLOC_SPEC, u8, BEVEN0_A, 4, O>;
78impl<'a, const O: u8> BEVEN0_W<'a, O> {
79    #[doc = "The bus is not allocated"]
80    #[inline(always)]
81    pub fn tristate(self) -> &'a mut W {
82        self.variant(BEVEN0_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(BEVEN0_A::ADC0)
88    }
89}
90#[doc = "Field `BEVEN1` reader - B Bus Even 1"]
91pub type BEVEN1_R = crate::FieldReader<u8, BEVEN1_A>;
92#[doc = "B Bus Even 1\n\nValue on reset: 0"]
93#[derive(Clone, Copy, Debug, PartialEq, Eq)]
94#[repr(u8)]
95pub enum BEVEN1_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<BEVEN1_A> for u8 {
102    #[inline(always)]
103    fn from(variant: BEVEN1_A) -> Self {
104        variant as _
105    }
106}
107impl BEVEN1_R {
108    #[doc = "Get enumerated values variant"]
109    #[inline(always)]
110    pub fn variant(&self) -> Option<BEVEN1_A> {
111        match self.bits {
112            0 => Some(BEVEN1_A::TRISTATE),
113            1 => Some(BEVEN1_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 == BEVEN1_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 == BEVEN1_A::ADC0
126    }
127}
128#[doc = "Field `BEVEN1` writer - B Bus Even 1"]
129pub type BEVEN1_W<'a, const O: u8> =
130    crate::FieldWriter<'a, u32, BBUSALLOC_SPEC, u8, BEVEN1_A, 4, O>;
131impl<'a, const O: u8> BEVEN1_W<'a, O> {
132    #[doc = "The bus is not allocated"]
133    #[inline(always)]
134    pub fn tristate(self) -> &'a mut W {
135        self.variant(BEVEN1_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(BEVEN1_A::ADC0)
141    }
142}
143#[doc = "Field `BODD0` reader - B Bus Odd 0"]
144pub type BODD0_R = crate::FieldReader<u8, BODD0_A>;
145#[doc = "B Bus Odd 0\n\nValue on reset: 0"]
146#[derive(Clone, Copy, Debug, PartialEq, Eq)]
147#[repr(u8)]
148pub enum BODD0_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<BODD0_A> for u8 {
155    #[inline(always)]
156    fn from(variant: BODD0_A) -> Self {
157        variant as _
158    }
159}
160impl BODD0_R {
161    #[doc = "Get enumerated values variant"]
162    #[inline(always)]
163    pub fn variant(&self) -> Option<BODD0_A> {
164        match self.bits {
165            0 => Some(BODD0_A::TRISTATE),
166            1 => Some(BODD0_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 == BODD0_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 == BODD0_A::ADC0
179    }
180}
181#[doc = "Field `BODD0` writer - B Bus Odd 0"]
182pub type BODD0_W<'a, const O: u8> = crate::FieldWriter<'a, u32, BBUSALLOC_SPEC, u8, BODD0_A, 4, O>;
183impl<'a, const O: u8> BODD0_W<'a, O> {
184    #[doc = "The bus is not allocated"]
185    #[inline(always)]
186    pub fn tristate(self) -> &'a mut W {
187        self.variant(BODD0_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(BODD0_A::ADC0)
193    }
194}
195#[doc = "Field `BODD1` reader - B Bus Odd 1"]
196pub type BODD1_R = crate::FieldReader<u8, BODD1_A>;
197#[doc = "B Bus Odd 1\n\nValue on reset: 0"]
198#[derive(Clone, Copy, Debug, PartialEq, Eq)]
199#[repr(u8)]
200pub enum BODD1_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<BODD1_A> for u8 {
207    #[inline(always)]
208    fn from(variant: BODD1_A) -> Self {
209        variant as _
210    }
211}
212impl BODD1_R {
213    #[doc = "Get enumerated values variant"]
214    #[inline(always)]
215    pub fn variant(&self) -> Option<BODD1_A> {
216        match self.bits {
217            0 => Some(BODD1_A::TRISTATE),
218            1 => Some(BODD1_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 == BODD1_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 == BODD1_A::ADC0
231    }
232}
233#[doc = "Field `BODD1` writer - B Bus Odd 1"]
234pub type BODD1_W<'a, const O: u8> = crate::FieldWriter<'a, u32, BBUSALLOC_SPEC, u8, BODD1_A, 4, O>;
235impl<'a, const O: u8> BODD1_W<'a, O> {
236    #[doc = "The bus is not allocated"]
237    #[inline(always)]
238    pub fn tristate(self) -> &'a mut W {
239        self.variant(BODD1_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(BODD1_A::ADC0)
245    }
246}
247impl R {
248    #[doc = "Bits 0:3 - B Bus Even 0"]
249    #[inline(always)]
250    pub fn beven0(&self) -> BEVEN0_R {
251        BEVEN0_R::new((self.bits & 0x0f) as u8)
252    }
253    #[doc = "Bits 8:11 - B Bus Even 1"]
254    #[inline(always)]
255    pub fn beven1(&self) -> BEVEN1_R {
256        BEVEN1_R::new(((self.bits >> 8) & 0x0f) as u8)
257    }
258    #[doc = "Bits 16:19 - B Bus Odd 0"]
259    #[inline(always)]
260    pub fn bodd0(&self) -> BODD0_R {
261        BODD0_R::new(((self.bits >> 16) & 0x0f) as u8)
262    }
263    #[doc = "Bits 24:27 - B Bus Odd 1"]
264    #[inline(always)]
265    pub fn bodd1(&self) -> BODD1_R {
266        BODD1_R::new(((self.bits >> 24) & 0x0f) as u8)
267    }
268}
269impl W {
270    #[doc = "Bits 0:3 - B Bus Even 0"]
271    #[inline(always)]
272    #[must_use]
273    pub fn beven0(&mut self) -> BEVEN0_W<0> {
274        BEVEN0_W::new(self)
275    }
276    #[doc = "Bits 8:11 - B Bus Even 1"]
277    #[inline(always)]
278    #[must_use]
279    pub fn beven1(&mut self) -> BEVEN1_W<8> {
280        BEVEN1_W::new(self)
281    }
282    #[doc = "Bits 16:19 - B Bus Odd 0"]
283    #[inline(always)]
284    #[must_use]
285    pub fn bodd0(&mut self) -> BODD0_W<16> {
286        BODD0_W::new(self)
287    }
288    #[doc = "Bits 24:27 - B Bus Odd 1"]
289    #[inline(always)]
290    #[must_use]
291    pub fn bodd1(&mut self) -> BODD1_W<24> {
292        BODD1_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 = "B 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 [bbusalloc](index.html) module"]
302pub struct BBUSALLOC_SPEC;
303impl crate::RegisterSpec for BBUSALLOC_SPEC {
304    type Ux = u32;
305}
306#[doc = "`read()` method returns [bbusalloc::R](R) reader structure"]
307impl crate::Readable for BBUSALLOC_SPEC {
308    type Reader = R;
309}
310#[doc = "`write(|w| ..)` method takes [bbusalloc::W](W) writer structure"]
311impl crate::Writable for BBUSALLOC_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 BBUSALLOC to value 0"]
317impl crate::Resettable for BBUSALLOC_SPEC {
318    const RESET_VALUE: Self::Ux = 0;
319}