1pub struct R(crate::R<CR2_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CR2_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CR2_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CR2_SPEC>) -> Self {
13 R(reader)
14 }
15}
16pub struct W(crate::W<CR2_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CR2_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<CR2_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CR2_SPEC>) -> Self {
34 W(writer)
35 }
36}
37pub type PVDE_R = crate::BitReader<PVDE_A>;
39#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum PVDE_A {
44 Disabled = 0,
46 Enabled = 1,
48}
49impl From<PVDE_A> for bool {
50 #[inline(always)]
51 fn from(variant: PVDE_A) -> Self {
52 variant as u8 != 0
53 }
54}
55impl PVDE_R {
56 #[inline(always)]
58 pub fn variant(&self) -> PVDE_A {
59 match self.bits {
60 false => PVDE_A::Disabled,
61 true => PVDE_A::Enabled,
62 }
63 }
64 #[inline(always)]
66 pub fn is_disabled(&self) -> bool {
67 *self == PVDE_A::Disabled
68 }
69 #[inline(always)]
71 pub fn is_enabled(&self) -> bool {
72 *self == PVDE_A::Enabled
73 }
74}
75pub type PVDE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, PVDE_A, O>;
77impl<'a, const O: u8> PVDE_W<'a, O> {
78 #[inline(always)]
80 pub fn disabled(self) -> &'a mut W {
81 self.variant(PVDE_A::Disabled)
82 }
83 #[inline(always)]
85 pub fn enabled(self) -> &'a mut W {
86 self.variant(PVDE_A::Enabled)
87 }
88}
89pub type PVD_SRCSEL_R = crate::BitReader<PVD_SRCSEL_A>;
91#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum PVD_SRCSEL_A {
96 Vcc = 0,
98 Pb7 = 1,
100}
101impl From<PVD_SRCSEL_A> for bool {
102 #[inline(always)]
103 fn from(variant: PVD_SRCSEL_A) -> Self {
104 variant as u8 != 0
105 }
106}
107impl PVD_SRCSEL_R {
108 #[inline(always)]
110 pub fn variant(&self) -> PVD_SRCSEL_A {
111 match self.bits {
112 false => PVD_SRCSEL_A::Vcc,
113 true => PVD_SRCSEL_A::Pb7,
114 }
115 }
116 #[inline(always)]
118 pub fn is_vcc(&self) -> bool {
119 *self == PVD_SRCSEL_A::Vcc
120 }
121 #[inline(always)]
123 pub fn is_pb7(&self) -> bool {
124 *self == PVD_SRCSEL_A::Pb7
125 }
126}
127pub type PVD_SRCSEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, PVD_SRCSEL_A, O>;
129impl<'a, const O: u8> PVD_SRCSEL_W<'a, O> {
130 #[inline(always)]
132 pub fn vcc(self) -> &'a mut W {
133 self.variant(PVD_SRCSEL_A::Vcc)
134 }
135 #[inline(always)]
137 pub fn pb7(self) -> &'a mut W {
138 self.variant(PVD_SRCSEL_A::Pb7)
139 }
140}
141pub type PVDT_R = crate::FieldReader<u8, PVDT_A>;
143#[derive(Clone, Copy, Debug, PartialEq, Eq)]
147#[repr(u8)]
148pub enum PVDT_A {
149 V18 = 0,
151 V20 = 1,
153 V22 = 2,
155 V24 = 3,
157 V26 = 4,
159 V28 = 5,
161 V30 = 6,
163 V32 = 7,
165}
166impl From<PVDT_A> for u8 {
167 #[inline(always)]
168 fn from(variant: PVDT_A) -> Self {
169 variant as _
170 }
171}
172impl PVDT_R {
173 #[inline(always)]
175 pub fn variant(&self) -> PVDT_A {
176 match self.bits {
177 0 => PVDT_A::V18,
178 1 => PVDT_A::V20,
179 2 => PVDT_A::V22,
180 3 => PVDT_A::V24,
181 4 => PVDT_A::V26,
182 5 => PVDT_A::V28,
183 6 => PVDT_A::V30,
184 7 => PVDT_A::V32,
185 _ => unreachable!(),
186 }
187 }
188 #[inline(always)]
190 pub fn is_v1_8(&self) -> bool {
191 *self == PVDT_A::V18
192 }
193 #[inline(always)]
195 pub fn is_v2_0(&self) -> bool {
196 *self == PVDT_A::V20
197 }
198 #[inline(always)]
200 pub fn is_v2_2(&self) -> bool {
201 *self == PVDT_A::V22
202 }
203 #[inline(always)]
205 pub fn is_v2_4(&self) -> bool {
206 *self == PVDT_A::V24
207 }
208 #[inline(always)]
210 pub fn is_v2_6(&self) -> bool {
211 *self == PVDT_A::V26
212 }
213 #[inline(always)]
215 pub fn is_v2_8(&self) -> bool {
216 *self == PVDT_A::V28
217 }
218 #[inline(always)]
220 pub fn is_v3_0(&self) -> bool {
221 *self == PVDT_A::V30
222 }
223 #[inline(always)]
225 pub fn is_v3_2(&self) -> bool {
226 *self == PVDT_A::V32
227 }
228}
229pub type PVDT_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, CR2_SPEC, u8, PVDT_A, 3, O>;
231impl<'a, const O: u8> PVDT_W<'a, O> {
232 #[inline(always)]
234 pub fn v1_8(self) -> &'a mut W {
235 self.variant(PVDT_A::V18)
236 }
237 #[inline(always)]
239 pub fn v2_0(self) -> &'a mut W {
240 self.variant(PVDT_A::V20)
241 }
242 #[inline(always)]
244 pub fn v2_2(self) -> &'a mut W {
245 self.variant(PVDT_A::V22)
246 }
247 #[inline(always)]
249 pub fn v2_4(self) -> &'a mut W {
250 self.variant(PVDT_A::V24)
251 }
252 #[inline(always)]
254 pub fn v2_6(self) -> &'a mut W {
255 self.variant(PVDT_A::V26)
256 }
257 #[inline(always)]
259 pub fn v2_8(self) -> &'a mut W {
260 self.variant(PVDT_A::V28)
261 }
262 #[inline(always)]
264 pub fn v3_0(self) -> &'a mut W {
265 self.variant(PVDT_A::V30)
266 }
267 #[inline(always)]
269 pub fn v3_2(self) -> &'a mut W {
270 self.variant(PVDT_A::V32)
271 }
272}
273pub type FLTEN_R = crate::BitReader<FLTEN_A>;
275#[derive(Clone, Copy, Debug, PartialEq, Eq)]
279pub enum FLTEN_A {
280 Disabled = 0,
282 Enabled = 1,
284}
285impl From<FLTEN_A> for bool {
286 #[inline(always)]
287 fn from(variant: FLTEN_A) -> Self {
288 variant as u8 != 0
289 }
290}
291impl FLTEN_R {
292 #[inline(always)]
294 pub fn variant(&self) -> FLTEN_A {
295 match self.bits {
296 false => FLTEN_A::Disabled,
297 true => FLTEN_A::Enabled,
298 }
299 }
300 #[inline(always)]
302 pub fn is_disabled(&self) -> bool {
303 *self == FLTEN_A::Disabled
304 }
305 #[inline(always)]
307 pub fn is_enabled(&self) -> bool {
308 *self == FLTEN_A::Enabled
309 }
310}
311pub type FLTEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR2_SPEC, FLTEN_A, O>;
313impl<'a, const O: u8> FLTEN_W<'a, O> {
314 #[inline(always)]
316 pub fn disabled(self) -> &'a mut W {
317 self.variant(FLTEN_A::Disabled)
318 }
319 #[inline(always)]
321 pub fn enabled(self) -> &'a mut W {
322 self.variant(FLTEN_A::Enabled)
323 }
324}
325pub type FLT_TIME_R = crate::FieldReader<u8, FLT_TIME_A>;
327#[derive(Clone, Copy, Debug, PartialEq, Eq)]
331#[repr(u8)]
332pub enum FLT_TIME_A {
333 T30us = 0,
335 T60us = 1,
337 T120us = 2,
339 T480us = 3,
341 T192ms = 4,
343 T38ms = 5,
345 T307ms = 6,
347}
348impl From<FLT_TIME_A> for u8 {
349 #[inline(always)]
350 fn from(variant: FLT_TIME_A) -> Self {
351 variant as _
352 }
353}
354impl FLT_TIME_R {
355 #[inline(always)]
357 pub fn variant(&self) -> Option<FLT_TIME_A> {
358 match self.bits {
359 0 => Some(FLT_TIME_A::T30us),
360 1 => Some(FLT_TIME_A::T60us),
361 2 => Some(FLT_TIME_A::T120us),
362 3 => Some(FLT_TIME_A::T480us),
363 4 => Some(FLT_TIME_A::T192ms),
364 5 => Some(FLT_TIME_A::T38ms),
365 6 => Some(FLT_TIME_A::T307ms),
366 _ => None,
367 }
368 }
369 #[inline(always)]
371 pub fn is_t30us(&self) -> bool {
372 *self == FLT_TIME_A::T30us
373 }
374 #[inline(always)]
376 pub fn is_t60us(&self) -> bool {
377 *self == FLT_TIME_A::T60us
378 }
379 #[inline(always)]
381 pub fn is_t120us(&self) -> bool {
382 *self == FLT_TIME_A::T120us
383 }
384 #[inline(always)]
386 pub fn is_t480us(&self) -> bool {
387 *self == FLT_TIME_A::T480us
388 }
389 #[inline(always)]
391 pub fn is_t1_92ms(&self) -> bool {
392 *self == FLT_TIME_A::T192ms
393 }
394 #[inline(always)]
396 pub fn is_t3_8ms(&self) -> bool {
397 *self == FLT_TIME_A::T38ms
398 }
399 #[inline(always)]
401 pub fn is_t30_7ms(&self) -> bool {
402 *self == FLT_TIME_A::T307ms
403 }
404}
405pub type FLT_TIME_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CR2_SPEC, u8, FLT_TIME_A, 3, O>;
407impl<'a, const O: u8> FLT_TIME_W<'a, O> {
408 #[inline(always)]
410 pub fn t30us(self) -> &'a mut W {
411 self.variant(FLT_TIME_A::T30us)
412 }
413 #[inline(always)]
415 pub fn t60us(self) -> &'a mut W {
416 self.variant(FLT_TIME_A::T60us)
417 }
418 #[inline(always)]
420 pub fn t120us(self) -> &'a mut W {
421 self.variant(FLT_TIME_A::T120us)
422 }
423 #[inline(always)]
425 pub fn t480us(self) -> &'a mut W {
426 self.variant(FLT_TIME_A::T480us)
427 }
428 #[inline(always)]
430 pub fn t1_92ms(self) -> &'a mut W {
431 self.variant(FLT_TIME_A::T192ms)
432 }
433 #[inline(always)]
435 pub fn t3_8ms(self) -> &'a mut W {
436 self.variant(FLT_TIME_A::T38ms)
437 }
438 #[inline(always)]
440 pub fn t30_7ms(self) -> &'a mut W {
441 self.variant(FLT_TIME_A::T307ms)
442 }
443}
444impl R {
445 #[inline(always)]
447 pub fn pvde(&self) -> PVDE_R {
448 PVDE_R::new((self.bits & 1) != 0)
449 }
450 #[inline(always)]
452 pub fn pvd_srcsel(&self) -> PVD_SRCSEL_R {
453 PVD_SRCSEL_R::new(((self.bits >> 2) & 1) != 0)
454 }
455 #[inline(always)]
457 pub fn pvdt(&self) -> PVDT_R {
458 PVDT_R::new(((self.bits >> 4) & 7) as u8)
459 }
460 #[inline(always)]
462 pub fn flten(&self) -> FLTEN_R {
463 FLTEN_R::new(((self.bits >> 8) & 1) != 0)
464 }
465 #[inline(always)]
467 pub fn flt_time(&self) -> FLT_TIME_R {
468 FLT_TIME_R::new(((self.bits >> 9) & 7) as u8)
469 }
470}
471impl W {
472 #[inline(always)]
474 #[must_use]
475 pub fn pvde(&mut self) -> PVDE_W<0> {
476 PVDE_W::new(self)
477 }
478 #[inline(always)]
480 #[must_use]
481 pub fn pvd_srcsel(&mut self) -> PVD_SRCSEL_W<2> {
482 PVD_SRCSEL_W::new(self)
483 }
484 #[inline(always)]
486 #[must_use]
487 pub fn pvdt(&mut self) -> PVDT_W<4> {
488 PVDT_W::new(self)
489 }
490 #[inline(always)]
492 #[must_use]
493 pub fn flten(&mut self) -> FLTEN_W<8> {
494 FLTEN_W::new(self)
495 }
496 #[inline(always)]
498 #[must_use]
499 pub fn flt_time(&mut self) -> FLT_TIME_W<9> {
500 FLT_TIME_W::new(self)
501 }
502 #[inline(always)]
504 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
505 self.0.bits(bits);
506 self
507 }
508}
509pub struct CR2_SPEC;
515impl crate::RegisterSpec for CR2_SPEC {
516 type Ux = u32;
517}
518impl crate::Readable for CR2_SPEC {
520 type Reader = R;
521}
522impl crate::Writable for CR2_SPEC {
524 type Writer = W;
525 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
526 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
527}
528impl crate::Resettable for CR2_SPEC {
530 const RESET_VALUE: Self::Ux = 0x0500;
531}