1#[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::CR2 {
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 USVR {
47 bits: bool,
48}
49impl USVR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bit(&self) -> bool {
53 self.bits
54 }
55 #[doc = r" Returns `true` if the bit is clear (0)"]
56 #[inline]
57 pub fn bit_is_clear(&self) -> bool {
58 !self.bit()
59 }
60 #[doc = r" Returns `true` if the bit is set (1)"]
61 #[inline]
62 pub fn bit_is_set(&self) -> bool {
63 self.bit()
64 }
65}
66#[doc = r" Value of the field"]
67pub struct IOSVR {
68 bits: bool,
69}
70impl IOSVR {
71 #[doc = r" Value of the field as raw bits"]
72 #[inline]
73 pub fn bit(&self) -> bool {
74 self.bits
75 }
76 #[doc = r" Returns `true` if the bit is clear (0)"]
77 #[inline]
78 pub fn bit_is_clear(&self) -> bool {
79 !self.bit()
80 }
81 #[doc = r" Returns `true` if the bit is set (1)"]
82 #[inline]
83 pub fn bit_is_set(&self) -> bool {
84 self.bit()
85 }
86}
87#[doc = r" Value of the field"]
88pub struct PVME4R {
89 bits: bool,
90}
91impl PVME4R {
92 #[doc = r" Value of the field as raw bits"]
93 #[inline]
94 pub fn bit(&self) -> bool {
95 self.bits
96 }
97 #[doc = r" Returns `true` if the bit is clear (0)"]
98 #[inline]
99 pub fn bit_is_clear(&self) -> bool {
100 !self.bit()
101 }
102 #[doc = r" Returns `true` if the bit is set (1)"]
103 #[inline]
104 pub fn bit_is_set(&self) -> bool {
105 self.bit()
106 }
107}
108#[doc = r" Value of the field"]
109pub struct PVME3R {
110 bits: bool,
111}
112impl PVME3R {
113 #[doc = r" Value of the field as raw bits"]
114 #[inline]
115 pub fn bit(&self) -> bool {
116 self.bits
117 }
118 #[doc = r" Returns `true` if the bit is clear (0)"]
119 #[inline]
120 pub fn bit_is_clear(&self) -> bool {
121 !self.bit()
122 }
123 #[doc = r" Returns `true` if the bit is set (1)"]
124 #[inline]
125 pub fn bit_is_set(&self) -> bool {
126 self.bit()
127 }
128}
129#[doc = r" Value of the field"]
130pub struct PVME2R {
131 bits: bool,
132}
133impl PVME2R {
134 #[doc = r" Value of the field as raw bits"]
135 #[inline]
136 pub fn bit(&self) -> bool {
137 self.bits
138 }
139 #[doc = r" Returns `true` if the bit is clear (0)"]
140 #[inline]
141 pub fn bit_is_clear(&self) -> bool {
142 !self.bit()
143 }
144 #[doc = r" Returns `true` if the bit is set (1)"]
145 #[inline]
146 pub fn bit_is_set(&self) -> bool {
147 self.bit()
148 }
149}
150#[doc = r" Value of the field"]
151pub struct PVME1R {
152 bits: bool,
153}
154impl PVME1R {
155 #[doc = r" Value of the field as raw bits"]
156 #[inline]
157 pub fn bit(&self) -> bool {
158 self.bits
159 }
160 #[doc = r" Returns `true` if the bit is clear (0)"]
161 #[inline]
162 pub fn bit_is_clear(&self) -> bool {
163 !self.bit()
164 }
165 #[doc = r" Returns `true` if the bit is set (1)"]
166 #[inline]
167 pub fn bit_is_set(&self) -> bool {
168 self.bit()
169 }
170}
171#[doc = r" Value of the field"]
172pub struct PLSR {
173 bits: u8,
174}
175impl PLSR {
176 #[doc = r" Value of the field as raw bits"]
177 #[inline]
178 pub fn bits(&self) -> u8 {
179 self.bits
180 }
181}
182#[doc = r" Value of the field"]
183pub struct PVDER {
184 bits: bool,
185}
186impl PVDER {
187 #[doc = r" Value of the field as raw bits"]
188 #[inline]
189 pub fn bit(&self) -> bool {
190 self.bits
191 }
192 #[doc = r" Returns `true` if the bit is clear (0)"]
193 #[inline]
194 pub fn bit_is_clear(&self) -> bool {
195 !self.bit()
196 }
197 #[doc = r" Returns `true` if the bit is set (1)"]
198 #[inline]
199 pub fn bit_is_set(&self) -> bool {
200 self.bit()
201 }
202}
203#[doc = r" Proxy"]
204pub struct _USVW<'a> {
205 w: &'a mut W,
206}
207impl<'a> _USVW<'a> {
208 #[doc = r" Sets the field bit"]
209 pub fn set_bit(self) -> &'a mut W {
210 self.bit(true)
211 }
212 #[doc = r" Clears the field bit"]
213 pub fn clear_bit(self) -> &'a mut W {
214 self.bit(false)
215 }
216 #[doc = r" Writes raw bits to the field"]
217 #[inline]
218 pub fn bit(self, value: bool) -> &'a mut W {
219 const MASK: bool = true;
220 const OFFSET: u8 = 10;
221 self.w.bits &= !((MASK as u32) << OFFSET);
222 self.w.bits |= ((value & MASK) as u32) << OFFSET;
223 self.w
224 }
225}
226#[doc = r" Proxy"]
227pub struct _IOSVW<'a> {
228 w: &'a mut W,
229}
230impl<'a> _IOSVW<'a> {
231 #[doc = r" Sets the field bit"]
232 pub fn set_bit(self) -> &'a mut W {
233 self.bit(true)
234 }
235 #[doc = r" Clears the field bit"]
236 pub fn clear_bit(self) -> &'a mut W {
237 self.bit(false)
238 }
239 #[doc = r" Writes raw bits to the field"]
240 #[inline]
241 pub fn bit(self, value: bool) -> &'a mut W {
242 const MASK: bool = true;
243 const OFFSET: u8 = 9;
244 self.w.bits &= !((MASK as u32) << OFFSET);
245 self.w.bits |= ((value & MASK) as u32) << OFFSET;
246 self.w
247 }
248}
249#[doc = r" Proxy"]
250pub struct _PVME4W<'a> {
251 w: &'a mut W,
252}
253impl<'a> _PVME4W<'a> {
254 #[doc = r" Sets the field bit"]
255 pub fn set_bit(self) -> &'a mut W {
256 self.bit(true)
257 }
258 #[doc = r" Clears the field bit"]
259 pub fn clear_bit(self) -> &'a mut W {
260 self.bit(false)
261 }
262 #[doc = r" Writes raw bits to the field"]
263 #[inline]
264 pub fn bit(self, value: bool) -> &'a mut W {
265 const MASK: bool = true;
266 const OFFSET: u8 = 7;
267 self.w.bits &= !((MASK as u32) << OFFSET);
268 self.w.bits |= ((value & MASK) as u32) << OFFSET;
269 self.w
270 }
271}
272#[doc = r" Proxy"]
273pub struct _PVME3W<'a> {
274 w: &'a mut W,
275}
276impl<'a> _PVME3W<'a> {
277 #[doc = r" Sets the field bit"]
278 pub fn set_bit(self) -> &'a mut W {
279 self.bit(true)
280 }
281 #[doc = r" Clears the field bit"]
282 pub fn clear_bit(self) -> &'a mut W {
283 self.bit(false)
284 }
285 #[doc = r" Writes raw bits to the field"]
286 #[inline]
287 pub fn bit(self, value: bool) -> &'a mut W {
288 const MASK: bool = true;
289 const OFFSET: u8 = 6;
290 self.w.bits &= !((MASK as u32) << OFFSET);
291 self.w.bits |= ((value & MASK) as u32) << OFFSET;
292 self.w
293 }
294}
295#[doc = r" Proxy"]
296pub struct _PVME2W<'a> {
297 w: &'a mut W,
298}
299impl<'a> _PVME2W<'a> {
300 #[doc = r" Sets the field bit"]
301 pub fn set_bit(self) -> &'a mut W {
302 self.bit(true)
303 }
304 #[doc = r" Clears the field bit"]
305 pub fn clear_bit(self) -> &'a mut W {
306 self.bit(false)
307 }
308 #[doc = r" Writes raw bits to the field"]
309 #[inline]
310 pub fn bit(self, value: bool) -> &'a mut W {
311 const MASK: bool = true;
312 const OFFSET: u8 = 5;
313 self.w.bits &= !((MASK as u32) << OFFSET);
314 self.w.bits |= ((value & MASK) as u32) << OFFSET;
315 self.w
316 }
317}
318#[doc = r" Proxy"]
319pub struct _PVME1W<'a> {
320 w: &'a mut W,
321}
322impl<'a> _PVME1W<'a> {
323 #[doc = r" Sets the field bit"]
324 pub fn set_bit(self) -> &'a mut W {
325 self.bit(true)
326 }
327 #[doc = r" Clears the field bit"]
328 pub fn clear_bit(self) -> &'a mut W {
329 self.bit(false)
330 }
331 #[doc = r" Writes raw bits to the field"]
332 #[inline]
333 pub fn bit(self, value: bool) -> &'a mut W {
334 const MASK: bool = true;
335 const OFFSET: u8 = 4;
336 self.w.bits &= !((MASK as u32) << OFFSET);
337 self.w.bits |= ((value & MASK) as u32) << OFFSET;
338 self.w
339 }
340}
341#[doc = r" Proxy"]
342pub struct _PLSW<'a> {
343 w: &'a mut W,
344}
345impl<'a> _PLSW<'a> {
346 #[doc = r" Writes raw bits to the field"]
347 #[inline]
348 pub unsafe fn bits(self, value: u8) -> &'a mut W {
349 const MASK: u8 = 7;
350 const OFFSET: u8 = 1;
351 self.w.bits &= !((MASK as u32) << OFFSET);
352 self.w.bits |= ((value & MASK) as u32) << OFFSET;
353 self.w
354 }
355}
356#[doc = r" Proxy"]
357pub struct _PVDEW<'a> {
358 w: &'a mut W,
359}
360impl<'a> _PVDEW<'a> {
361 #[doc = r" Sets the field bit"]
362 pub fn set_bit(self) -> &'a mut W {
363 self.bit(true)
364 }
365 #[doc = r" Clears the field bit"]
366 pub fn clear_bit(self) -> &'a mut W {
367 self.bit(false)
368 }
369 #[doc = r" Writes raw bits to the field"]
370 #[inline]
371 pub fn bit(self, value: bool) -> &'a mut W {
372 const MASK: bool = true;
373 const OFFSET: u8 = 0;
374 self.w.bits &= !((MASK as u32) << OFFSET);
375 self.w.bits |= ((value & MASK) as u32) << OFFSET;
376 self.w
377 }
378}
379impl R {
380 #[doc = r" Value of the register as raw bits"]
381 #[inline]
382 pub fn bits(&self) -> u32 {
383 self.bits
384 }
385 #[doc = "Bit 10 - VDDUSB USB supply valid"]
386 #[inline]
387 pub fn usv(&self) -> USVR {
388 let bits = {
389 const MASK: bool = true;
390 const OFFSET: u8 = 10;
391 ((self.bits >> OFFSET) & MASK as u32) != 0
392 };
393 USVR { bits }
394 }
395 #[doc = "Bit 9 - VDDIO2 Independent I/Os supply valid"]
396 #[inline]
397 pub fn iosv(&self) -> IOSVR {
398 let bits = {
399 const MASK: bool = true;
400 const OFFSET: u8 = 9;
401 ((self.bits >> OFFSET) & MASK as u32) != 0
402 };
403 IOSVR { bits }
404 }
405 #[doc = "Bit 7 - Peripheral voltage monitoring 4 enable: VDDA vs. 2.2V"]
406 #[inline]
407 pub fn pvme4(&self) -> PVME4R {
408 let bits = {
409 const MASK: bool = true;
410 const OFFSET: u8 = 7;
411 ((self.bits >> OFFSET) & MASK as u32) != 0
412 };
413 PVME4R { bits }
414 }
415 #[doc = "Bit 6 - Peripheral voltage monitoring 3 enable: VDDA vs. 1.62V"]
416 #[inline]
417 pub fn pvme3(&self) -> PVME3R {
418 let bits = {
419 const MASK: bool = true;
420 const OFFSET: u8 = 6;
421 ((self.bits >> OFFSET) & MASK as u32) != 0
422 };
423 PVME3R { bits }
424 }
425 #[doc = "Bit 5 - Peripheral voltage monitoring 2 enable: VDDIO2 vs. 0.9V"]
426 #[inline]
427 pub fn pvme2(&self) -> PVME2R {
428 let bits = {
429 const MASK: bool = true;
430 const OFFSET: u8 = 5;
431 ((self.bits >> OFFSET) & MASK as u32) != 0
432 };
433 PVME2R { bits }
434 }
435 #[doc = "Bit 4 - Peripheral voltage monitoring 1 enable: VDDUSB vs. 1.2V"]
436 #[inline]
437 pub fn pvme1(&self) -> PVME1R {
438 let bits = {
439 const MASK: bool = true;
440 const OFFSET: u8 = 4;
441 ((self.bits >> OFFSET) & MASK as u32) != 0
442 };
443 PVME1R { bits }
444 }
445 #[doc = "Bits 1:3 - Power voltage detector level selection"]
446 #[inline]
447 pub fn pls(&self) -> PLSR {
448 let bits = {
449 const MASK: u8 = 7;
450 const OFFSET: u8 = 1;
451 ((self.bits >> OFFSET) & MASK as u32) as u8
452 };
453 PLSR { bits }
454 }
455 #[doc = "Bit 0 - Power voltage detector enable"]
456 #[inline]
457 pub fn pvde(&self) -> PVDER {
458 let bits = {
459 const MASK: bool = true;
460 const OFFSET: u8 = 0;
461 ((self.bits >> OFFSET) & MASK as u32) != 0
462 };
463 PVDER { bits }
464 }
465}
466impl W {
467 #[doc = r" Reset value of the register"]
468 #[inline]
469 pub fn reset_value() -> W {
470 W { bits: 0 }
471 }
472 #[doc = r" Writes raw bits to the register"]
473 #[inline]
474 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
475 self.bits = bits;
476 self
477 }
478 #[doc = "Bit 10 - VDDUSB USB supply valid"]
479 #[inline]
480 pub fn usv(&mut self) -> _USVW {
481 _USVW { w: self }
482 }
483 #[doc = "Bit 9 - VDDIO2 Independent I/Os supply valid"]
484 #[inline]
485 pub fn iosv(&mut self) -> _IOSVW {
486 _IOSVW { w: self }
487 }
488 #[doc = "Bit 7 - Peripheral voltage monitoring 4 enable: VDDA vs. 2.2V"]
489 #[inline]
490 pub fn pvme4(&mut self) -> _PVME4W {
491 _PVME4W { w: self }
492 }
493 #[doc = "Bit 6 - Peripheral voltage monitoring 3 enable: VDDA vs. 1.62V"]
494 #[inline]
495 pub fn pvme3(&mut self) -> _PVME3W {
496 _PVME3W { w: self }
497 }
498 #[doc = "Bit 5 - Peripheral voltage monitoring 2 enable: VDDIO2 vs. 0.9V"]
499 #[inline]
500 pub fn pvme2(&mut self) -> _PVME2W {
501 _PVME2W { w: self }
502 }
503 #[doc = "Bit 4 - Peripheral voltage monitoring 1 enable: VDDUSB vs. 1.2V"]
504 #[inline]
505 pub fn pvme1(&mut self) -> _PVME1W {
506 _PVME1W { w: self }
507 }
508 #[doc = "Bits 1:3 - Power voltage detector level selection"]
509 #[inline]
510 pub fn pls(&mut self) -> _PLSW {
511 _PLSW { w: self }
512 }
513 #[doc = "Bit 0 - Power voltage detector enable"]
514 #[inline]
515 pub fn pvde(&mut self) -> _PVDEW {
516 _PVDEW { w: self }
517 }
518}