stm32f103xx/fsmc/pcr2/
mod.rs1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u32,
8}
9impl super::PCR2 {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = r" Value of the field"]
46pub struct ECCPSR {
47 bits: u8,
48}
49impl ECCPSR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bits(&self) -> u8 {
53 self.bits
54 }
55}
56#[doc = r" Value of the field"]
57pub struct TARR {
58 bits: u8,
59}
60impl TARR {
61 #[doc = r" Value of the field as raw bits"]
62 #[inline]
63 pub fn bits(&self) -> u8 {
64 self.bits
65 }
66}
67#[doc = r" Value of the field"]
68pub struct TCLRR {
69 bits: u8,
70}
71impl TCLRR {
72 #[doc = r" Value of the field as raw bits"]
73 #[inline]
74 pub fn bits(&self) -> u8 {
75 self.bits
76 }
77}
78#[doc = r" Value of the field"]
79pub struct ECCENR {
80 bits: bool,
81}
82impl ECCENR {
83 #[doc = r" Value of the field as raw bits"]
84 #[inline]
85 pub fn bit(&self) -> bool {
86 self.bits
87 }
88 #[doc = r" Returns `true` if the bit is clear (0)"]
89 #[inline]
90 pub fn bit_is_clear(&self) -> bool {
91 !self.bit()
92 }
93 #[doc = r" Returns `true` if the bit is set (1)"]
94 #[inline]
95 pub fn bit_is_set(&self) -> bool {
96 self.bit()
97 }
98}
99#[doc = r" Value of the field"]
100pub struct PWIDR {
101 bits: u8,
102}
103impl PWIDR {
104 #[doc = r" Value of the field as raw bits"]
105 #[inline]
106 pub fn bits(&self) -> u8 {
107 self.bits
108 }
109}
110#[doc = r" Value of the field"]
111pub struct PTYPR {
112 bits: bool,
113}
114impl PTYPR {
115 #[doc = r" Value of the field as raw bits"]
116 #[inline]
117 pub fn bit(&self) -> bool {
118 self.bits
119 }
120 #[doc = r" Returns `true` if the bit is clear (0)"]
121 #[inline]
122 pub fn bit_is_clear(&self) -> bool {
123 !self.bit()
124 }
125 #[doc = r" Returns `true` if the bit is set (1)"]
126 #[inline]
127 pub fn bit_is_set(&self) -> bool {
128 self.bit()
129 }
130}
131#[doc = r" Value of the field"]
132pub struct PBKENR {
133 bits: bool,
134}
135impl PBKENR {
136 #[doc = r" Value of the field as raw bits"]
137 #[inline]
138 pub fn bit(&self) -> bool {
139 self.bits
140 }
141 #[doc = r" Returns `true` if the bit is clear (0)"]
142 #[inline]
143 pub fn bit_is_clear(&self) -> bool {
144 !self.bit()
145 }
146 #[doc = r" Returns `true` if the bit is set (1)"]
147 #[inline]
148 pub fn bit_is_set(&self) -> bool {
149 self.bit()
150 }
151}
152#[doc = r" Value of the field"]
153pub struct PWAITENR {
154 bits: bool,
155}
156impl PWAITENR {
157 #[doc = r" Value of the field as raw bits"]
158 #[inline]
159 pub fn bit(&self) -> bool {
160 self.bits
161 }
162 #[doc = r" Returns `true` if the bit is clear (0)"]
163 #[inline]
164 pub fn bit_is_clear(&self) -> bool {
165 !self.bit()
166 }
167 #[doc = r" Returns `true` if the bit is set (1)"]
168 #[inline]
169 pub fn bit_is_set(&self) -> bool {
170 self.bit()
171 }
172}
173#[doc = r" Proxy"]
174pub struct _ECCPSW<'a> {
175 w: &'a mut W,
176}
177impl<'a> _ECCPSW<'a> {
178 #[doc = r" Writes raw bits to the field"]
179 #[inline]
180 pub unsafe fn bits(self, value: u8) -> &'a mut W {
181 const MASK: u8 = 7;
182 const OFFSET: u8 = 17;
183 self.w.bits &= !((MASK as u32) << OFFSET);
184 self.w.bits |= ((value & MASK) as u32) << OFFSET;
185 self.w
186 }
187}
188#[doc = r" Proxy"]
189pub struct _TARW<'a> {
190 w: &'a mut W,
191}
192impl<'a> _TARW<'a> {
193 #[doc = r" Writes raw bits to the field"]
194 #[inline]
195 pub unsafe fn bits(self, value: u8) -> &'a mut W {
196 const MASK: u8 = 15;
197 const OFFSET: u8 = 13;
198 self.w.bits &= !((MASK as u32) << OFFSET);
199 self.w.bits |= ((value & MASK) as u32) << OFFSET;
200 self.w
201 }
202}
203#[doc = r" Proxy"]
204pub struct _TCLRW<'a> {
205 w: &'a mut W,
206}
207impl<'a> _TCLRW<'a> {
208 #[doc = r" Writes raw bits to the field"]
209 #[inline]
210 pub unsafe fn bits(self, value: u8) -> &'a mut W {
211 const MASK: u8 = 15;
212 const OFFSET: u8 = 9;
213 self.w.bits &= !((MASK as u32) << OFFSET);
214 self.w.bits |= ((value & MASK) as u32) << OFFSET;
215 self.w
216 }
217}
218#[doc = r" Proxy"]
219pub struct _ECCENW<'a> {
220 w: &'a mut W,
221}
222impl<'a> _ECCENW<'a> {
223 #[doc = r" Sets the field bit"]
224 pub fn set_bit(self) -> &'a mut W {
225 self.bit(true)
226 }
227 #[doc = r" Clears the field bit"]
228 pub fn clear_bit(self) -> &'a mut W {
229 self.bit(false)
230 }
231 #[doc = r" Writes raw bits to the field"]
232 #[inline]
233 pub fn bit(self, value: bool) -> &'a mut W {
234 const MASK: bool = true;
235 const OFFSET: u8 = 6;
236 self.w.bits &= !((MASK as u32) << OFFSET);
237 self.w.bits |= ((value & MASK) as u32) << OFFSET;
238 self.w
239 }
240}
241#[doc = r" Proxy"]
242pub struct _PWIDW<'a> {
243 w: &'a mut W,
244}
245impl<'a> _PWIDW<'a> {
246 #[doc = r" Writes raw bits to the field"]
247 #[inline]
248 pub unsafe fn bits(self, value: u8) -> &'a mut W {
249 const MASK: u8 = 3;
250 const OFFSET: u8 = 4;
251 self.w.bits &= !((MASK as u32) << OFFSET);
252 self.w.bits |= ((value & MASK) as u32) << OFFSET;
253 self.w
254 }
255}
256#[doc = r" Proxy"]
257pub struct _PTYPW<'a> {
258 w: &'a mut W,
259}
260impl<'a> _PTYPW<'a> {
261 #[doc = r" Sets the field bit"]
262 pub fn set_bit(self) -> &'a mut W {
263 self.bit(true)
264 }
265 #[doc = r" Clears the field bit"]
266 pub fn clear_bit(self) -> &'a mut W {
267 self.bit(false)
268 }
269 #[doc = r" Writes raw bits to the field"]
270 #[inline]
271 pub fn bit(self, value: bool) -> &'a mut W {
272 const MASK: bool = true;
273 const OFFSET: u8 = 3;
274 self.w.bits &= !((MASK as u32) << OFFSET);
275 self.w.bits |= ((value & MASK) as u32) << OFFSET;
276 self.w
277 }
278}
279#[doc = r" Proxy"]
280pub struct _PBKENW<'a> {
281 w: &'a mut W,
282}
283impl<'a> _PBKENW<'a> {
284 #[doc = r" Sets the field bit"]
285 pub fn set_bit(self) -> &'a mut W {
286 self.bit(true)
287 }
288 #[doc = r" Clears the field bit"]
289 pub fn clear_bit(self) -> &'a mut W {
290 self.bit(false)
291 }
292 #[doc = r" Writes raw bits to the field"]
293 #[inline]
294 pub fn bit(self, value: bool) -> &'a mut W {
295 const MASK: bool = true;
296 const OFFSET: u8 = 2;
297 self.w.bits &= !((MASK as u32) << OFFSET);
298 self.w.bits |= ((value & MASK) as u32) << OFFSET;
299 self.w
300 }
301}
302#[doc = r" Proxy"]
303pub struct _PWAITENW<'a> {
304 w: &'a mut W,
305}
306impl<'a> _PWAITENW<'a> {
307 #[doc = r" Sets the field bit"]
308 pub fn set_bit(self) -> &'a mut W {
309 self.bit(true)
310 }
311 #[doc = r" Clears the field bit"]
312 pub fn clear_bit(self) -> &'a mut W {
313 self.bit(false)
314 }
315 #[doc = r" Writes raw bits to the field"]
316 #[inline]
317 pub fn bit(self, value: bool) -> &'a mut W {
318 const MASK: bool = true;
319 const OFFSET: u8 = 1;
320 self.w.bits &= !((MASK as u32) << OFFSET);
321 self.w.bits |= ((value & MASK) as u32) << OFFSET;
322 self.w
323 }
324}
325impl R {
326 #[doc = r" Value of the register as raw bits"]
327 #[inline]
328 pub fn bits(&self) -> u32 {
329 self.bits
330 }
331 #[doc = "Bits 17:19 - ECCPS"]
332 #[inline]
333 pub fn eccps(&self) -> ECCPSR {
334 let bits = {
335 const MASK: u8 = 7;
336 const OFFSET: u8 = 17;
337 ((self.bits >> OFFSET) & MASK as u32) as u8
338 };
339 ECCPSR { bits }
340 }
341 #[doc = "Bits 13:16 - TAR"]
342 #[inline]
343 pub fn tar(&self) -> TARR {
344 let bits = {
345 const MASK: u8 = 15;
346 const OFFSET: u8 = 13;
347 ((self.bits >> OFFSET) & MASK as u32) as u8
348 };
349 TARR { bits }
350 }
351 #[doc = "Bits 9:12 - TCLR"]
352 #[inline]
353 pub fn tclr(&self) -> TCLRR {
354 let bits = {
355 const MASK: u8 = 15;
356 const OFFSET: u8 = 9;
357 ((self.bits >> OFFSET) & MASK as u32) as u8
358 };
359 TCLRR { bits }
360 }
361 #[doc = "Bit 6 - ECCEN"]
362 #[inline]
363 pub fn eccen(&self) -> ECCENR {
364 let bits = {
365 const MASK: bool = true;
366 const OFFSET: u8 = 6;
367 ((self.bits >> OFFSET) & MASK as u32) != 0
368 };
369 ECCENR { bits }
370 }
371 #[doc = "Bits 4:5 - PWID"]
372 #[inline]
373 pub fn pwid(&self) -> PWIDR {
374 let bits = {
375 const MASK: u8 = 3;
376 const OFFSET: u8 = 4;
377 ((self.bits >> OFFSET) & MASK as u32) as u8
378 };
379 PWIDR { bits }
380 }
381 #[doc = "Bit 3 - PTYP"]
382 #[inline]
383 pub fn ptyp(&self) -> PTYPR {
384 let bits = {
385 const MASK: bool = true;
386 const OFFSET: u8 = 3;
387 ((self.bits >> OFFSET) & MASK as u32) != 0
388 };
389 PTYPR { bits }
390 }
391 #[doc = "Bit 2 - PBKEN"]
392 #[inline]
393 pub fn pbken(&self) -> PBKENR {
394 let bits = {
395 const MASK: bool = true;
396 const OFFSET: u8 = 2;
397 ((self.bits >> OFFSET) & MASK as u32) != 0
398 };
399 PBKENR { bits }
400 }
401 #[doc = "Bit 1 - PWAITEN"]
402 #[inline]
403 pub fn pwaiten(&self) -> PWAITENR {
404 let bits = {
405 const MASK: bool = true;
406 const OFFSET: u8 = 1;
407 ((self.bits >> OFFSET) & MASK as u32) != 0
408 };
409 PWAITENR { bits }
410 }
411}
412impl W {
413 #[doc = r" Reset value of the register"]
414 #[inline]
415 pub fn reset_value() -> W {
416 W { bits: 24 }
417 }
418 #[doc = r" Writes raw bits to the register"]
419 #[inline]
420 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
421 self.bits = bits;
422 self
423 }
424 #[doc = "Bits 17:19 - ECCPS"]
425 #[inline]
426 pub fn eccps(&mut self) -> _ECCPSW {
427 _ECCPSW { w: self }
428 }
429 #[doc = "Bits 13:16 - TAR"]
430 #[inline]
431 pub fn tar(&mut self) -> _TARW {
432 _TARW { w: self }
433 }
434 #[doc = "Bits 9:12 - TCLR"]
435 #[inline]
436 pub fn tclr(&mut self) -> _TCLRW {
437 _TCLRW { w: self }
438 }
439 #[doc = "Bit 6 - ECCEN"]
440 #[inline]
441 pub fn eccen(&mut self) -> _ECCENW {
442 _ECCENW { w: self }
443 }
444 #[doc = "Bits 4:5 - PWID"]
445 #[inline]
446 pub fn pwid(&mut self) -> _PWIDW {
447 _PWIDW { w: self }
448 }
449 #[doc = "Bit 3 - PTYP"]
450 #[inline]
451 pub fn ptyp(&mut self) -> _PTYPW {
452 _PTYPW { w: self }
453 }
454 #[doc = "Bit 2 - PBKEN"]
455 #[inline]
456 pub fn pbken(&mut self) -> _PBKENW {
457 _PBKENW { w: self }
458 }
459 #[doc = "Bit 1 - PWAITEN"]
460 #[inline]
461 pub fn pwaiten(&mut self) -> _PWAITENW {
462 _PWAITENW { w: self }
463 }
464}