stm32f4/stm32f469/gpiok/
afrl.rs

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