stm32f7_staging/stm32f733/gpiob/
moder.rs

1///Register `MODER` reader
2pub type R = crate::R<MODERrs>;
3///Register `MODER` writer
4pub type W = crate::W<MODERrs>;
5///Port x configuration pin %s
6pub use crate::stm32f733::gpioa::moder::MODE;
7///Field `MODER(0-15)` reader - Port x configuration pin %s
8pub use crate::stm32f733::gpioa::moder::MODER_R;
9///Field `MODER(0-15)` writer - Port x configuration pin %s
10pub use crate::stm32f733::gpioa::moder::MODER_W;
11impl R {
12    ///Port x configuration pin (0-15)
13    ///
14    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `MODER0` field.</div>
15    #[inline(always)]
16    pub fn moder(&self, n: u8) -> MODER_R {
17        #[allow(clippy::no_effect)]
18        [(); 16][n as usize];
19        MODER_R::new(((self.bits >> (n * 2)) & 3) as u8)
20    }
21    ///Iterator for array of:
22    ///Port x configuration pin (0-15)
23    #[inline(always)]
24    pub fn moder_iter(&self) -> impl Iterator<Item = MODER_R> + '_ {
25        (0..16).map(move |n| MODER_R::new(((self.bits >> (n * 2)) & 3) as u8))
26    }
27    ///Bits 0:1 - Port x configuration pin 0
28    #[inline(always)]
29    pub fn moder0(&self) -> MODER_R {
30        MODER_R::new((self.bits & 3) as u8)
31    }
32    ///Bits 2:3 - Port x configuration pin 1
33    #[inline(always)]
34    pub fn moder1(&self) -> MODER_R {
35        MODER_R::new(((self.bits >> 2) & 3) as u8)
36    }
37    ///Bits 4:5 - Port x configuration pin 2
38    #[inline(always)]
39    pub fn moder2(&self) -> MODER_R {
40        MODER_R::new(((self.bits >> 4) & 3) as u8)
41    }
42    ///Bits 6:7 - Port x configuration pin 3
43    #[inline(always)]
44    pub fn moder3(&self) -> MODER_R {
45        MODER_R::new(((self.bits >> 6) & 3) as u8)
46    }
47    ///Bits 8:9 - Port x configuration pin 4
48    #[inline(always)]
49    pub fn moder4(&self) -> MODER_R {
50        MODER_R::new(((self.bits >> 8) & 3) as u8)
51    }
52    ///Bits 10:11 - Port x configuration pin 5
53    #[inline(always)]
54    pub fn moder5(&self) -> MODER_R {
55        MODER_R::new(((self.bits >> 10) & 3) as u8)
56    }
57    ///Bits 12:13 - Port x configuration pin 6
58    #[inline(always)]
59    pub fn moder6(&self) -> MODER_R {
60        MODER_R::new(((self.bits >> 12) & 3) as u8)
61    }
62    ///Bits 14:15 - Port x configuration pin 7
63    #[inline(always)]
64    pub fn moder7(&self) -> MODER_R {
65        MODER_R::new(((self.bits >> 14) & 3) as u8)
66    }
67    ///Bits 16:17 - Port x configuration pin 8
68    #[inline(always)]
69    pub fn moder8(&self) -> MODER_R {
70        MODER_R::new(((self.bits >> 16) & 3) as u8)
71    }
72    ///Bits 18:19 - Port x configuration pin 9
73    #[inline(always)]
74    pub fn moder9(&self) -> MODER_R {
75        MODER_R::new(((self.bits >> 18) & 3) as u8)
76    }
77    ///Bits 20:21 - Port x configuration pin 10
78    #[inline(always)]
79    pub fn moder10(&self) -> MODER_R {
80        MODER_R::new(((self.bits >> 20) & 3) as u8)
81    }
82    ///Bits 22:23 - Port x configuration pin 11
83    #[inline(always)]
84    pub fn moder11(&self) -> MODER_R {
85        MODER_R::new(((self.bits >> 22) & 3) as u8)
86    }
87    ///Bits 24:25 - Port x configuration pin 12
88    #[inline(always)]
89    pub fn moder12(&self) -> MODER_R {
90        MODER_R::new(((self.bits >> 24) & 3) as u8)
91    }
92    ///Bits 26:27 - Port x configuration pin 13
93    #[inline(always)]
94    pub fn moder13(&self) -> MODER_R {
95        MODER_R::new(((self.bits >> 26) & 3) as u8)
96    }
97    ///Bits 28:29 - Port x configuration pin 14
98    #[inline(always)]
99    pub fn moder14(&self) -> MODER_R {
100        MODER_R::new(((self.bits >> 28) & 3) as u8)
101    }
102    ///Bits 30:31 - Port x configuration pin 15
103    #[inline(always)]
104    pub fn moder15(&self) -> MODER_R {
105        MODER_R::new(((self.bits >> 30) & 3) as u8)
106    }
107}
108impl core::fmt::Debug for R {
109    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
110        f.debug_struct("MODER")
111            .field("moder0", &self.moder0())
112            .field("moder1", &self.moder1())
113            .field("moder2", &self.moder2())
114            .field("moder3", &self.moder3())
115            .field("moder4", &self.moder4())
116            .field("moder5", &self.moder5())
117            .field("moder6", &self.moder6())
118            .field("moder7", &self.moder7())
119            .field("moder8", &self.moder8())
120            .field("moder9", &self.moder9())
121            .field("moder10", &self.moder10())
122            .field("moder11", &self.moder11())
123            .field("moder12", &self.moder12())
124            .field("moder13", &self.moder13())
125            .field("moder14", &self.moder14())
126            .field("moder15", &self.moder15())
127            .finish()
128    }
129}
130impl W {
131    ///Port x configuration pin (0-15)
132    ///
133    ///<div class="warning">`n` is number of field in register. `n == 0` corresponds to `MODER0` field.</div>
134    #[inline(always)]
135    pub fn moder(&mut self, n: u8) -> MODER_W<MODERrs> {
136        #[allow(clippy::no_effect)]
137        [(); 16][n as usize];
138        MODER_W::new(self, n * 2)
139    }
140    ///Bits 0:1 - Port x configuration pin 0
141    #[inline(always)]
142    pub fn moder0(&mut self) -> MODER_W<MODERrs> {
143        MODER_W::new(self, 0)
144    }
145    ///Bits 2:3 - Port x configuration pin 1
146    #[inline(always)]
147    pub fn moder1(&mut self) -> MODER_W<MODERrs> {
148        MODER_W::new(self, 2)
149    }
150    ///Bits 4:5 - Port x configuration pin 2
151    #[inline(always)]
152    pub fn moder2(&mut self) -> MODER_W<MODERrs> {
153        MODER_W::new(self, 4)
154    }
155    ///Bits 6:7 - Port x configuration pin 3
156    #[inline(always)]
157    pub fn moder3(&mut self) -> MODER_W<MODERrs> {
158        MODER_W::new(self, 6)
159    }
160    ///Bits 8:9 - Port x configuration pin 4
161    #[inline(always)]
162    pub fn moder4(&mut self) -> MODER_W<MODERrs> {
163        MODER_W::new(self, 8)
164    }
165    ///Bits 10:11 - Port x configuration pin 5
166    #[inline(always)]
167    pub fn moder5(&mut self) -> MODER_W<MODERrs> {
168        MODER_W::new(self, 10)
169    }
170    ///Bits 12:13 - Port x configuration pin 6
171    #[inline(always)]
172    pub fn moder6(&mut self) -> MODER_W<MODERrs> {
173        MODER_W::new(self, 12)
174    }
175    ///Bits 14:15 - Port x configuration pin 7
176    #[inline(always)]
177    pub fn moder7(&mut self) -> MODER_W<MODERrs> {
178        MODER_W::new(self, 14)
179    }
180    ///Bits 16:17 - Port x configuration pin 8
181    #[inline(always)]
182    pub fn moder8(&mut self) -> MODER_W<MODERrs> {
183        MODER_W::new(self, 16)
184    }
185    ///Bits 18:19 - Port x configuration pin 9
186    #[inline(always)]
187    pub fn moder9(&mut self) -> MODER_W<MODERrs> {
188        MODER_W::new(self, 18)
189    }
190    ///Bits 20:21 - Port x configuration pin 10
191    #[inline(always)]
192    pub fn moder10(&mut self) -> MODER_W<MODERrs> {
193        MODER_W::new(self, 20)
194    }
195    ///Bits 22:23 - Port x configuration pin 11
196    #[inline(always)]
197    pub fn moder11(&mut self) -> MODER_W<MODERrs> {
198        MODER_W::new(self, 22)
199    }
200    ///Bits 24:25 - Port x configuration pin 12
201    #[inline(always)]
202    pub fn moder12(&mut self) -> MODER_W<MODERrs> {
203        MODER_W::new(self, 24)
204    }
205    ///Bits 26:27 - Port x configuration pin 13
206    #[inline(always)]
207    pub fn moder13(&mut self) -> MODER_W<MODERrs> {
208        MODER_W::new(self, 26)
209    }
210    ///Bits 28:29 - Port x configuration pin 14
211    #[inline(always)]
212    pub fn moder14(&mut self) -> MODER_W<MODERrs> {
213        MODER_W::new(self, 28)
214    }
215    ///Bits 30:31 - Port x configuration pin 15
216    #[inline(always)]
217    pub fn moder15(&mut self) -> MODER_W<MODERrs> {
218        MODER_W::new(self, 30)
219    }
220}
221/**GPIO port mode register
222
223You can [`read`](crate::Reg::read) this register and get [`moder::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`moder::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
224
225See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F733.html#GPIOB:MODER)*/
226pub struct MODERrs;
227impl crate::RegisterSpec for MODERrs {
228    type Ux = u32;
229}
230///`read()` method returns [`moder::R`](R) reader structure
231impl crate::Readable for MODERrs {}
232///`write(|w| ..)` method takes [`moder::W`](W) writer structure
233impl crate::Writable for MODERrs {
234    type Safety = crate::Unsafe;
235}
236///`reset()` method sets MODER to value 0x0280
237impl crate::Resettable for MODERrs {
238    const RESET_VALUE: u32 = 0x0280;
239}