py32f0/py32f030/gpioa/
afrh.rs

1///Register `AFRH` reader
2pub struct R(crate::R<AFRH_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<AFRH_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<AFRH_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<AFRH_SPEC>) -> Self {
13        R(reader)
14    }
15}
16///Register `AFRH` writer
17pub struct W(crate::W<AFRH_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<AFRH_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<AFRH_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<AFRH_SPEC>) -> Self {
34        W(writer)
35    }
36}
37///Field `AFSEL8` reader - Alternate function selection for port x bit y (y = 8..15)
38pub type AFSEL8_R = crate::FieldReader<u8, AFSEL8_A>;
39/**Alternate function selection for port x bit y (y = 8..15)
40
41Value on reset: 0*/
42#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43#[repr(u8)]
44pub enum AFSEL8_A {
45    ///0: AF0
46    Af0 = 0,
47    ///1: AF1
48    Af1 = 1,
49    ///2: AF2
50    Af2 = 2,
51    ///3: AF3
52    Af3 = 3,
53    ///4: AF4
54    Af4 = 4,
55    ///5: AF5
56    Af5 = 5,
57    ///6: AF6
58    Af6 = 6,
59    ///7: AF7
60    Af7 = 7,
61    ///8: AF8
62    Af8 = 8,
63    ///9: AF9
64    Af9 = 9,
65    ///10: AF10
66    Af10 = 10,
67    ///11: AF11
68    Af11 = 11,
69    ///12: AF12
70    Af12 = 12,
71    ///13: AF13
72    Af13 = 13,
73    ///14: AF14
74    Af14 = 14,
75    ///15: AF15
76    Af15 = 15,
77}
78impl From<AFSEL8_A> for u8 {
79    #[inline(always)]
80    fn from(variant: AFSEL8_A) -> Self {
81        variant as _
82    }
83}
84impl AFSEL8_R {
85    ///Get enumerated values variant
86    #[inline(always)]
87    pub fn variant(&self) -> AFSEL8_A {
88        match self.bits {
89            0 => AFSEL8_A::Af0,
90            1 => AFSEL8_A::Af1,
91            2 => AFSEL8_A::Af2,
92            3 => AFSEL8_A::Af3,
93            4 => AFSEL8_A::Af4,
94            5 => AFSEL8_A::Af5,
95            6 => AFSEL8_A::Af6,
96            7 => AFSEL8_A::Af7,
97            8 => AFSEL8_A::Af8,
98            9 => AFSEL8_A::Af9,
99            10 => AFSEL8_A::Af10,
100            11 => AFSEL8_A::Af11,
101            12 => AFSEL8_A::Af12,
102            13 => AFSEL8_A::Af13,
103            14 => AFSEL8_A::Af14,
104            15 => AFSEL8_A::Af15,
105            _ => unreachable!(),
106        }
107    }
108    ///Checks if the value of the field is `Af0`
109    #[inline(always)]
110    pub fn is_af0(&self) -> bool {
111        *self == AFSEL8_A::Af0
112    }
113    ///Checks if the value of the field is `Af1`
114    #[inline(always)]
115    pub fn is_af1(&self) -> bool {
116        *self == AFSEL8_A::Af1
117    }
118    ///Checks if the value of the field is `Af2`
119    #[inline(always)]
120    pub fn is_af2(&self) -> bool {
121        *self == AFSEL8_A::Af2
122    }
123    ///Checks if the value of the field is `Af3`
124    #[inline(always)]
125    pub fn is_af3(&self) -> bool {
126        *self == AFSEL8_A::Af3
127    }
128    ///Checks if the value of the field is `Af4`
129    #[inline(always)]
130    pub fn is_af4(&self) -> bool {
131        *self == AFSEL8_A::Af4
132    }
133    ///Checks if the value of the field is `Af5`
134    #[inline(always)]
135    pub fn is_af5(&self) -> bool {
136        *self == AFSEL8_A::Af5
137    }
138    ///Checks if the value of the field is `Af6`
139    #[inline(always)]
140    pub fn is_af6(&self) -> bool {
141        *self == AFSEL8_A::Af6
142    }
143    ///Checks if the value of the field is `Af7`
144    #[inline(always)]
145    pub fn is_af7(&self) -> bool {
146        *self == AFSEL8_A::Af7
147    }
148    ///Checks if the value of the field is `Af8`
149    #[inline(always)]
150    pub fn is_af8(&self) -> bool {
151        *self == AFSEL8_A::Af8
152    }
153    ///Checks if the value of the field is `Af9`
154    #[inline(always)]
155    pub fn is_af9(&self) -> bool {
156        *self == AFSEL8_A::Af9
157    }
158    ///Checks if the value of the field is `Af10`
159    #[inline(always)]
160    pub fn is_af10(&self) -> bool {
161        *self == AFSEL8_A::Af10
162    }
163    ///Checks if the value of the field is `Af11`
164    #[inline(always)]
165    pub fn is_af11(&self) -> bool {
166        *self == AFSEL8_A::Af11
167    }
168    ///Checks if the value of the field is `Af12`
169    #[inline(always)]
170    pub fn is_af12(&self) -> bool {
171        *self == AFSEL8_A::Af12
172    }
173    ///Checks if the value of the field is `Af13`
174    #[inline(always)]
175    pub fn is_af13(&self) -> bool {
176        *self == AFSEL8_A::Af13
177    }
178    ///Checks if the value of the field is `Af14`
179    #[inline(always)]
180    pub fn is_af14(&self) -> bool {
181        *self == AFSEL8_A::Af14
182    }
183    ///Checks if the value of the field is `Af15`
184    #[inline(always)]
185    pub fn is_af15(&self) -> bool {
186        *self == AFSEL8_A::Af15
187    }
188}
189///Field `AFSEL8` writer - Alternate function selection for port x bit y (y = 8..15)
190pub type AFSEL8_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, AFRH_SPEC, u8, AFSEL8_A, 4, O>;
191impl<'a, const O: u8> AFSEL8_W<'a, O> {
192    ///AF0
193    #[inline(always)]
194    pub fn af0(self) -> &'a mut W {
195        self.variant(AFSEL8_A::Af0)
196    }
197    ///AF1
198    #[inline(always)]
199    pub fn af1(self) -> &'a mut W {
200        self.variant(AFSEL8_A::Af1)
201    }
202    ///AF2
203    #[inline(always)]
204    pub fn af2(self) -> &'a mut W {
205        self.variant(AFSEL8_A::Af2)
206    }
207    ///AF3
208    #[inline(always)]
209    pub fn af3(self) -> &'a mut W {
210        self.variant(AFSEL8_A::Af3)
211    }
212    ///AF4
213    #[inline(always)]
214    pub fn af4(self) -> &'a mut W {
215        self.variant(AFSEL8_A::Af4)
216    }
217    ///AF5
218    #[inline(always)]
219    pub fn af5(self) -> &'a mut W {
220        self.variant(AFSEL8_A::Af5)
221    }
222    ///AF6
223    #[inline(always)]
224    pub fn af6(self) -> &'a mut W {
225        self.variant(AFSEL8_A::Af6)
226    }
227    ///AF7
228    #[inline(always)]
229    pub fn af7(self) -> &'a mut W {
230        self.variant(AFSEL8_A::Af7)
231    }
232    ///AF8
233    #[inline(always)]
234    pub fn af8(self) -> &'a mut W {
235        self.variant(AFSEL8_A::Af8)
236    }
237    ///AF9
238    #[inline(always)]
239    pub fn af9(self) -> &'a mut W {
240        self.variant(AFSEL8_A::Af9)
241    }
242    ///AF10
243    #[inline(always)]
244    pub fn af10(self) -> &'a mut W {
245        self.variant(AFSEL8_A::Af10)
246    }
247    ///AF11
248    #[inline(always)]
249    pub fn af11(self) -> &'a mut W {
250        self.variant(AFSEL8_A::Af11)
251    }
252    ///AF12
253    #[inline(always)]
254    pub fn af12(self) -> &'a mut W {
255        self.variant(AFSEL8_A::Af12)
256    }
257    ///AF13
258    #[inline(always)]
259    pub fn af13(self) -> &'a mut W {
260        self.variant(AFSEL8_A::Af13)
261    }
262    ///AF14
263    #[inline(always)]
264    pub fn af14(self) -> &'a mut W {
265        self.variant(AFSEL8_A::Af14)
266    }
267    ///AF15
268    #[inline(always)]
269    pub fn af15(self) -> &'a mut W {
270        self.variant(AFSEL8_A::Af15)
271    }
272}
273///Field `AFSEL9` reader - Alternate function selection for port x bit y (y = 8..15)
274pub use AFSEL8_R as AFSEL9_R;
275///Field `AFSEL10` reader - Alternate function selection for port x bit y (y = 8..15)
276pub use AFSEL8_R as AFSEL10_R;
277///Field `AFSEL11` reader - Alternate function selection for port x bit y (y = 8..15)
278pub use AFSEL8_R as AFSEL11_R;
279///Field `AFSEL12` reader - Alternate function selection for port x bit y (y = 8..15)
280pub use AFSEL8_R as AFSEL12_R;
281///Field `AFSEL13` reader - Alternate function selection for port x bit y (y = 8..15)
282pub use AFSEL8_R as AFSEL13_R;
283///Field `AFSEL14` reader - Alternate function selection for port x bit y (y = 8..15)
284pub use AFSEL8_R as AFSEL14_R;
285///Field `AFSEL15` reader - Alternate function selection for port x bit y (y = 8..15)
286pub use AFSEL8_R as AFSEL15_R;
287///Field `AFSEL9` writer - Alternate function selection for port x bit y (y = 8..15)
288pub use AFSEL8_W as AFSEL9_W;
289///Field `AFSEL10` writer - Alternate function selection for port x bit y (y = 8..15)
290pub use AFSEL8_W as AFSEL10_W;
291///Field `AFSEL11` writer - Alternate function selection for port x bit y (y = 8..15)
292pub use AFSEL8_W as AFSEL11_W;
293///Field `AFSEL12` writer - Alternate function selection for port x bit y (y = 8..15)
294pub use AFSEL8_W as AFSEL12_W;
295///Field `AFSEL13` writer - Alternate function selection for port x bit y (y = 8..15)
296pub use AFSEL8_W as AFSEL13_W;
297///Field `AFSEL14` writer - Alternate function selection for port x bit y (y = 8..15)
298pub use AFSEL8_W as AFSEL14_W;
299///Field `AFSEL15` writer - Alternate function selection for port x bit y (y = 8..15)
300pub use AFSEL8_W as AFSEL15_W;
301impl R {
302    ///Bits 0:3 - Alternate function selection for port x bit y (y = 8..15)
303    #[inline(always)]
304    pub fn afsel8(&self) -> AFSEL8_R {
305        AFSEL8_R::new((self.bits & 0x0f) as u8)
306    }
307    ///Bits 4:7 - Alternate function selection for port x bit y (y = 8..15)
308    #[inline(always)]
309    pub fn afsel9(&self) -> AFSEL9_R {
310        AFSEL9_R::new(((self.bits >> 4) & 0x0f) as u8)
311    }
312    ///Bits 8:11 - Alternate function selection for port x bit y (y = 8..15)
313    #[inline(always)]
314    pub fn afsel10(&self) -> AFSEL10_R {
315        AFSEL10_R::new(((self.bits >> 8) & 0x0f) as u8)
316    }
317    ///Bits 12:15 - Alternate function selection for port x bit y (y = 8..15)
318    #[inline(always)]
319    pub fn afsel11(&self) -> AFSEL11_R {
320        AFSEL11_R::new(((self.bits >> 12) & 0x0f) as u8)
321    }
322    ///Bits 16:19 - Alternate function selection for port x bit y (y = 8..15)
323    #[inline(always)]
324    pub fn afsel12(&self) -> AFSEL12_R {
325        AFSEL12_R::new(((self.bits >> 16) & 0x0f) as u8)
326    }
327    ///Bits 20:23 - Alternate function selection for port x bit y (y = 8..15)
328    #[inline(always)]
329    pub fn afsel13(&self) -> AFSEL13_R {
330        AFSEL13_R::new(((self.bits >> 20) & 0x0f) as u8)
331    }
332    ///Bits 24:27 - Alternate function selection for port x bit y (y = 8..15)
333    #[inline(always)]
334    pub fn afsel14(&self) -> AFSEL14_R {
335        AFSEL14_R::new(((self.bits >> 24) & 0x0f) as u8)
336    }
337    ///Bits 28:31 - Alternate function selection for port x bit y (y = 8..15)
338    #[inline(always)]
339    pub fn afsel15(&self) -> AFSEL15_R {
340        AFSEL15_R::new(((self.bits >> 28) & 0x0f) as u8)
341    }
342}
343impl W {
344    ///Bits 0:3 - Alternate function selection for port x bit y (y = 8..15)
345    #[inline(always)]
346    #[must_use]
347    pub fn afsel8(&mut self) -> AFSEL8_W<0> {
348        AFSEL8_W::new(self)
349    }
350    ///Bits 4:7 - Alternate function selection for port x bit y (y = 8..15)
351    #[inline(always)]
352    #[must_use]
353    pub fn afsel9(&mut self) -> AFSEL9_W<4> {
354        AFSEL9_W::new(self)
355    }
356    ///Bits 8:11 - Alternate function selection for port x bit y (y = 8..15)
357    #[inline(always)]
358    #[must_use]
359    pub fn afsel10(&mut self) -> AFSEL10_W<8> {
360        AFSEL10_W::new(self)
361    }
362    ///Bits 12:15 - Alternate function selection for port x bit y (y = 8..15)
363    #[inline(always)]
364    #[must_use]
365    pub fn afsel11(&mut self) -> AFSEL11_W<12> {
366        AFSEL11_W::new(self)
367    }
368    ///Bits 16:19 - Alternate function selection for port x bit y (y = 8..15)
369    #[inline(always)]
370    #[must_use]
371    pub fn afsel12(&mut self) -> AFSEL12_W<16> {
372        AFSEL12_W::new(self)
373    }
374    ///Bits 20:23 - Alternate function selection for port x bit y (y = 8..15)
375    #[inline(always)]
376    #[must_use]
377    pub fn afsel13(&mut self) -> AFSEL13_W<20> {
378        AFSEL13_W::new(self)
379    }
380    ///Bits 24:27 - Alternate function selection for port x bit y (y = 8..15)
381    #[inline(always)]
382    #[must_use]
383    pub fn afsel14(&mut self) -> AFSEL14_W<24> {
384        AFSEL14_W::new(self)
385    }
386    ///Bits 28:31 - Alternate function selection for port x bit y (y = 8..15)
387    #[inline(always)]
388    #[must_use]
389    pub fn afsel15(&mut self) -> AFSEL15_W<28> {
390        AFSEL15_W::new(self)
391    }
392    ///Writes raw bits to the register.
393    #[inline(always)]
394    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
395        self.0.bits(bits);
396        self
397    }
398}
399/**GPIO alternate function high register
400
401This 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).
402
403For information about available fields see [afrh](index.html) module*/
404pub struct AFRH_SPEC;
405impl crate::RegisterSpec for AFRH_SPEC {
406    type Ux = u32;
407}
408///`read()` method returns [afrh::R](R) reader structure
409impl crate::Readable for AFRH_SPEC {
410    type Reader = R;
411}
412///`write(|w| ..)` method takes [afrh::W](W) writer structure
413impl crate::Writable for AFRH_SPEC {
414    type Writer = W;
415    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
416    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
417}
418///`reset()` method sets AFRH to value 0
419impl crate::Resettable for AFRH_SPEC {
420    const RESET_VALUE: Self::Ux = 0;
421}