stm32wb_pac/gpioc/
moder.rs

1#[doc = "Reader of register MODER"]
2pub type R = crate::R<u32, super::MODER>;
3#[doc = "Writer for register MODER"]
4pub type W = crate::W<u32, super::MODER>;
5#[doc = "Register MODER `reset()`'s with value 0xffff_ffff"]
6impl crate::ResetValue for super::MODER {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0xffff_ffff
11    }
12}
13#[doc = "Reader of field `MODER15`"]
14pub type MODER15_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `MODER15`"]
16pub struct MODER15_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> MODER15_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u8) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0x03 << 30)) | (((value as u32) & 0x03) << 30);
24        self.w
25    }
26}
27#[doc = "Reader of field `MODER14`"]
28pub type MODER14_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `MODER14`"]
30pub struct MODER14_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> MODER14_W<'a> {
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub unsafe fn bits(self, value: u8) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0x03 << 28)) | (((value as u32) & 0x03) << 28);
38        self.w
39    }
40}
41#[doc = "Reader of field `MODER13`"]
42pub type MODER13_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `MODER13`"]
44pub struct MODER13_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> MODER13_W<'a> {
48    #[doc = r"Writes raw bits to the field"]
49    #[inline(always)]
50    pub unsafe fn bits(self, value: u8) -> &'a mut W {
51        self.w.bits = (self.w.bits & !(0x03 << 26)) | (((value as u32) & 0x03) << 26);
52        self.w
53    }
54}
55#[doc = "Reader of field `MODER12`"]
56pub type MODER12_R = crate::R<u8, u8>;
57#[doc = "Write proxy for field `MODER12`"]
58pub struct MODER12_W<'a> {
59    w: &'a mut W,
60}
61impl<'a> MODER12_W<'a> {
62    #[doc = r"Writes raw bits to the field"]
63    #[inline(always)]
64    pub unsafe fn bits(self, value: u8) -> &'a mut W {
65        self.w.bits = (self.w.bits & !(0x03 << 24)) | (((value as u32) & 0x03) << 24);
66        self.w
67    }
68}
69#[doc = "Reader of field `MODER11`"]
70pub type MODER11_R = crate::R<u8, u8>;
71#[doc = "Write proxy for field `MODER11`"]
72pub struct MODER11_W<'a> {
73    w: &'a mut W,
74}
75impl<'a> MODER11_W<'a> {
76    #[doc = r"Writes raw bits to the field"]
77    #[inline(always)]
78    pub unsafe fn bits(self, value: u8) -> &'a mut W {
79        self.w.bits = (self.w.bits & !(0x03 << 22)) | (((value as u32) & 0x03) << 22);
80        self.w
81    }
82}
83#[doc = "Reader of field `MODER10`"]
84pub type MODER10_R = crate::R<u8, u8>;
85#[doc = "Write proxy for field `MODER10`"]
86pub struct MODER10_W<'a> {
87    w: &'a mut W,
88}
89impl<'a> MODER10_W<'a> {
90    #[doc = r"Writes raw bits to the field"]
91    #[inline(always)]
92    pub unsafe fn bits(self, value: u8) -> &'a mut W {
93        self.w.bits = (self.w.bits & !(0x03 << 20)) | (((value as u32) & 0x03) << 20);
94        self.w
95    }
96}
97#[doc = "Reader of field `MODER9`"]
98pub type MODER9_R = crate::R<u8, u8>;
99#[doc = "Write proxy for field `MODER9`"]
100pub struct MODER9_W<'a> {
101    w: &'a mut W,
102}
103impl<'a> MODER9_W<'a> {
104    #[doc = r"Writes raw bits to the field"]
105    #[inline(always)]
106    pub unsafe fn bits(self, value: u8) -> &'a mut W {
107        self.w.bits = (self.w.bits & !(0x03 << 18)) | (((value as u32) & 0x03) << 18);
108        self.w
109    }
110}
111#[doc = "Reader of field `MODER8`"]
112pub type MODER8_R = crate::R<u8, u8>;
113#[doc = "Write proxy for field `MODER8`"]
114pub struct MODER8_W<'a> {
115    w: &'a mut W,
116}
117impl<'a> MODER8_W<'a> {
118    #[doc = r"Writes raw bits to the field"]
119    #[inline(always)]
120    pub unsafe fn bits(self, value: u8) -> &'a mut W {
121        self.w.bits = (self.w.bits & !(0x03 << 16)) | (((value as u32) & 0x03) << 16);
122        self.w
123    }
124}
125#[doc = "Reader of field `MODER7`"]
126pub type MODER7_R = crate::R<u8, u8>;
127#[doc = "Write proxy for field `MODER7`"]
128pub struct MODER7_W<'a> {
129    w: &'a mut W,
130}
131impl<'a> MODER7_W<'a> {
132    #[doc = r"Writes raw bits to the field"]
133    #[inline(always)]
134    pub unsafe fn bits(self, value: u8) -> &'a mut W {
135        self.w.bits = (self.w.bits & !(0x03 << 14)) | (((value as u32) & 0x03) << 14);
136        self.w
137    }
138}
139#[doc = "Reader of field `MODER6`"]
140pub type MODER6_R = crate::R<u8, u8>;
141#[doc = "Write proxy for field `MODER6`"]
142pub struct MODER6_W<'a> {
143    w: &'a mut W,
144}
145impl<'a> MODER6_W<'a> {
146    #[doc = r"Writes raw bits to the field"]
147    #[inline(always)]
148    pub unsafe fn bits(self, value: u8) -> &'a mut W {
149        self.w.bits = (self.w.bits & !(0x03 << 12)) | (((value as u32) & 0x03) << 12);
150        self.w
151    }
152}
153#[doc = "Reader of field `MODER5`"]
154pub type MODER5_R = crate::R<u8, u8>;
155#[doc = "Write proxy for field `MODER5`"]
156pub struct MODER5_W<'a> {
157    w: &'a mut W,
158}
159impl<'a> MODER5_W<'a> {
160    #[doc = r"Writes raw bits to the field"]
161    #[inline(always)]
162    pub unsafe fn bits(self, value: u8) -> &'a mut W {
163        self.w.bits = (self.w.bits & !(0x03 << 10)) | (((value as u32) & 0x03) << 10);
164        self.w
165    }
166}
167#[doc = "Reader of field `MODER4`"]
168pub type MODER4_R = crate::R<u8, u8>;
169#[doc = "Write proxy for field `MODER4`"]
170pub struct MODER4_W<'a> {
171    w: &'a mut W,
172}
173impl<'a> MODER4_W<'a> {
174    #[doc = r"Writes raw bits to the field"]
175    #[inline(always)]
176    pub unsafe fn bits(self, value: u8) -> &'a mut W {
177        self.w.bits = (self.w.bits & !(0x03 << 8)) | (((value as u32) & 0x03) << 8);
178        self.w
179    }
180}
181#[doc = "Reader of field `MODER3`"]
182pub type MODER3_R = crate::R<u8, u8>;
183#[doc = "Write proxy for field `MODER3`"]
184pub struct MODER3_W<'a> {
185    w: &'a mut W,
186}
187impl<'a> MODER3_W<'a> {
188    #[doc = r"Writes raw bits to the field"]
189    #[inline(always)]
190    pub unsafe fn bits(self, value: u8) -> &'a mut W {
191        self.w.bits = (self.w.bits & !(0x03 << 6)) | (((value as u32) & 0x03) << 6);
192        self.w
193    }
194}
195#[doc = "Reader of field `MODER2`"]
196pub type MODER2_R = crate::R<u8, u8>;
197#[doc = "Write proxy for field `MODER2`"]
198pub struct MODER2_W<'a> {
199    w: &'a mut W,
200}
201impl<'a> MODER2_W<'a> {
202    #[doc = r"Writes raw bits to the field"]
203    #[inline(always)]
204    pub unsafe fn bits(self, value: u8) -> &'a mut W {
205        self.w.bits = (self.w.bits & !(0x03 << 4)) | (((value as u32) & 0x03) << 4);
206        self.w
207    }
208}
209#[doc = "Reader of field `MODER1`"]
210pub type MODER1_R = crate::R<u8, u8>;
211#[doc = "Write proxy for field `MODER1`"]
212pub struct MODER1_W<'a> {
213    w: &'a mut W,
214}
215impl<'a> MODER1_W<'a> {
216    #[doc = r"Writes raw bits to the field"]
217    #[inline(always)]
218    pub unsafe fn bits(self, value: u8) -> &'a mut W {
219        self.w.bits = (self.w.bits & !(0x03 << 2)) | (((value as u32) & 0x03) << 2);
220        self.w
221    }
222}
223#[doc = "Reader of field `MODER0`"]
224pub type MODER0_R = crate::R<u8, u8>;
225#[doc = "Write proxy for field `MODER0`"]
226pub struct MODER0_W<'a> {
227    w: &'a mut W,
228}
229impl<'a> MODER0_W<'a> {
230    #[doc = r"Writes raw bits to the field"]
231    #[inline(always)]
232    pub unsafe fn bits(self, value: u8) -> &'a mut W {
233        self.w.bits = (self.w.bits & !0x03) | ((value as u32) & 0x03);
234        self.w
235    }
236}
237impl R {
238    #[doc = "Bits 30:31 - Port x configuration bits (y = 0..15)"]
239    #[inline(always)]
240    pub fn moder15(&self) -> MODER15_R {
241        MODER15_R::new(((self.bits >> 30) & 0x03) as u8)
242    }
243    #[doc = "Bits 28:29 - Port x configuration bits (y = 0..15)"]
244    #[inline(always)]
245    pub fn moder14(&self) -> MODER14_R {
246        MODER14_R::new(((self.bits >> 28) & 0x03) as u8)
247    }
248    #[doc = "Bits 26:27 - Port x configuration bits (y = 0..15)"]
249    #[inline(always)]
250    pub fn moder13(&self) -> MODER13_R {
251        MODER13_R::new(((self.bits >> 26) & 0x03) as u8)
252    }
253    #[doc = "Bits 24:25 - Port x configuration bits (y = 0..15)"]
254    #[inline(always)]
255    pub fn moder12(&self) -> MODER12_R {
256        MODER12_R::new(((self.bits >> 24) & 0x03) as u8)
257    }
258    #[doc = "Bits 22:23 - Port x configuration bits (y = 0..15)"]
259    #[inline(always)]
260    pub fn moder11(&self) -> MODER11_R {
261        MODER11_R::new(((self.bits >> 22) & 0x03) as u8)
262    }
263    #[doc = "Bits 20:21 - Port x configuration bits (y = 0..15)"]
264    #[inline(always)]
265    pub fn moder10(&self) -> MODER10_R {
266        MODER10_R::new(((self.bits >> 20) & 0x03) as u8)
267    }
268    #[doc = "Bits 18:19 - Port x configuration bits (y = 0..15)"]
269    #[inline(always)]
270    pub fn moder9(&self) -> MODER9_R {
271        MODER9_R::new(((self.bits >> 18) & 0x03) as u8)
272    }
273    #[doc = "Bits 16:17 - Port x configuration bits (y = 0..15)"]
274    #[inline(always)]
275    pub fn moder8(&self) -> MODER8_R {
276        MODER8_R::new(((self.bits >> 16) & 0x03) as u8)
277    }
278    #[doc = "Bits 14:15 - Port x configuration bits (y = 0..15)"]
279    #[inline(always)]
280    pub fn moder7(&self) -> MODER7_R {
281        MODER7_R::new(((self.bits >> 14) & 0x03) as u8)
282    }
283    #[doc = "Bits 12:13 - Port x configuration bits (y = 0..15)"]
284    #[inline(always)]
285    pub fn moder6(&self) -> MODER6_R {
286        MODER6_R::new(((self.bits >> 12) & 0x03) as u8)
287    }
288    #[doc = "Bits 10:11 - Port x configuration bits (y = 0..15)"]
289    #[inline(always)]
290    pub fn moder5(&self) -> MODER5_R {
291        MODER5_R::new(((self.bits >> 10) & 0x03) as u8)
292    }
293    #[doc = "Bits 8:9 - Port x configuration bits (y = 0..15)"]
294    #[inline(always)]
295    pub fn moder4(&self) -> MODER4_R {
296        MODER4_R::new(((self.bits >> 8) & 0x03) as u8)
297    }
298    #[doc = "Bits 6:7 - Port x configuration bits (y = 0..15)"]
299    #[inline(always)]
300    pub fn moder3(&self) -> MODER3_R {
301        MODER3_R::new(((self.bits >> 6) & 0x03) as u8)
302    }
303    #[doc = "Bits 4:5 - Port x configuration bits (y = 0..15)"]
304    #[inline(always)]
305    pub fn moder2(&self) -> MODER2_R {
306        MODER2_R::new(((self.bits >> 4) & 0x03) as u8)
307    }
308    #[doc = "Bits 2:3 - Port x configuration bits (y = 0..15)"]
309    #[inline(always)]
310    pub fn moder1(&self) -> MODER1_R {
311        MODER1_R::new(((self.bits >> 2) & 0x03) as u8)
312    }
313    #[doc = "Bits 0:1 - Port x configuration bits (y = 0..15)"]
314    #[inline(always)]
315    pub fn moder0(&self) -> MODER0_R {
316        MODER0_R::new((self.bits & 0x03) as u8)
317    }
318}
319impl W {
320    #[doc = "Bits 30:31 - Port x configuration bits (y = 0..15)"]
321    #[inline(always)]
322    pub fn moder15(&mut self) -> MODER15_W {
323        MODER15_W { w: self }
324    }
325    #[doc = "Bits 28:29 - Port x configuration bits (y = 0..15)"]
326    #[inline(always)]
327    pub fn moder14(&mut self) -> MODER14_W {
328        MODER14_W { w: self }
329    }
330    #[doc = "Bits 26:27 - Port x configuration bits (y = 0..15)"]
331    #[inline(always)]
332    pub fn moder13(&mut self) -> MODER13_W {
333        MODER13_W { w: self }
334    }
335    #[doc = "Bits 24:25 - Port x configuration bits (y = 0..15)"]
336    #[inline(always)]
337    pub fn moder12(&mut self) -> MODER12_W {
338        MODER12_W { w: self }
339    }
340    #[doc = "Bits 22:23 - Port x configuration bits (y = 0..15)"]
341    #[inline(always)]
342    pub fn moder11(&mut self) -> MODER11_W {
343        MODER11_W { w: self }
344    }
345    #[doc = "Bits 20:21 - Port x configuration bits (y = 0..15)"]
346    #[inline(always)]
347    pub fn moder10(&mut self) -> MODER10_W {
348        MODER10_W { w: self }
349    }
350    #[doc = "Bits 18:19 - Port x configuration bits (y = 0..15)"]
351    #[inline(always)]
352    pub fn moder9(&mut self) -> MODER9_W {
353        MODER9_W { w: self }
354    }
355    #[doc = "Bits 16:17 - Port x configuration bits (y = 0..15)"]
356    #[inline(always)]
357    pub fn moder8(&mut self) -> MODER8_W {
358        MODER8_W { w: self }
359    }
360    #[doc = "Bits 14:15 - Port x configuration bits (y = 0..15)"]
361    #[inline(always)]
362    pub fn moder7(&mut self) -> MODER7_W {
363        MODER7_W { w: self }
364    }
365    #[doc = "Bits 12:13 - Port x configuration bits (y = 0..15)"]
366    #[inline(always)]
367    pub fn moder6(&mut self) -> MODER6_W {
368        MODER6_W { w: self }
369    }
370    #[doc = "Bits 10:11 - Port x configuration bits (y = 0..15)"]
371    #[inline(always)]
372    pub fn moder5(&mut self) -> MODER5_W {
373        MODER5_W { w: self }
374    }
375    #[doc = "Bits 8:9 - Port x configuration bits (y = 0..15)"]
376    #[inline(always)]
377    pub fn moder4(&mut self) -> MODER4_W {
378        MODER4_W { w: self }
379    }
380    #[doc = "Bits 6:7 - Port x configuration bits (y = 0..15)"]
381    #[inline(always)]
382    pub fn moder3(&mut self) -> MODER3_W {
383        MODER3_W { w: self }
384    }
385    #[doc = "Bits 4:5 - Port x configuration bits (y = 0..15)"]
386    #[inline(always)]
387    pub fn moder2(&mut self) -> MODER2_W {
388        MODER2_W { w: self }
389    }
390    #[doc = "Bits 2:3 - Port x configuration bits (y = 0..15)"]
391    #[inline(always)]
392    pub fn moder1(&mut self) -> MODER1_W {
393        MODER1_W { w: self }
394    }
395    #[doc = "Bits 0:1 - Port x configuration bits (y = 0..15)"]
396    #[inline(always)]
397    pub fn moder0(&mut self) -> MODER0_W {
398        MODER0_W { w: self }
399    }
400}