1pub type R = crate::R<CFGR2rs>;
3pub type W = crate::W<CFGR2rs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum OVSE {
11 Disabled = 0,
13 Enabled = 1,
15}
16impl From<OVSE> for bool {
17 #[inline(always)]
18 fn from(variant: OVSE) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type OVSE_R = crate::BitReader<OVSE>;
24impl OVSE_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> OVSE {
28 match self.bits {
29 false => OVSE::Disabled,
30 true => OVSE::Enabled,
31 }
32 }
33 #[inline(always)]
35 pub fn is_disabled(&self) -> bool {
36 *self == OVSE::Disabled
37 }
38 #[inline(always)]
40 pub fn is_enabled(&self) -> bool {
41 *self == OVSE::Enabled
42 }
43}
44pub type OVSE_W<'a, REG> = crate::BitWriter<'a, REG, OVSE>;
46impl<'a, REG> OVSE_W<'a, REG>
47where
48 REG: crate::Writable + crate::RegisterSpec,
49{
50 #[inline(always)]
52 pub fn disabled(self) -> &'a mut crate::W<REG> {
53 self.variant(OVSE::Disabled)
54 }
55 #[inline(always)]
57 pub fn enabled(self) -> &'a mut crate::W<REG> {
58 self.variant(OVSE::Enabled)
59 }
60}
61#[cfg_attr(feature = "defmt", derive(defmt::Format))]
65#[derive(Clone, Copy, Debug, PartialEq, Eq)]
66#[repr(u8)]
67pub enum OVSR {
68 Mul2 = 0,
70 Mul4 = 1,
72 Mul8 = 2,
74 Mul16 = 3,
76 Mul32 = 4,
78 Mul64 = 5,
80 Mul128 = 6,
82 Mul256 = 7,
84}
85impl From<OVSR> for u8 {
86 #[inline(always)]
87 fn from(variant: OVSR) -> Self {
88 variant as _
89 }
90}
91impl crate::FieldSpec for OVSR {
92 type Ux = u8;
93}
94impl crate::IsEnum for OVSR {}
95pub type OVSR_R = crate::FieldReader<OVSR>;
97impl OVSR_R {
98 #[inline(always)]
100 pub const fn variant(&self) -> OVSR {
101 match self.bits {
102 0 => OVSR::Mul2,
103 1 => OVSR::Mul4,
104 2 => OVSR::Mul8,
105 3 => OVSR::Mul16,
106 4 => OVSR::Mul32,
107 5 => OVSR::Mul64,
108 6 => OVSR::Mul128,
109 7 => OVSR::Mul256,
110 _ => unreachable!(),
111 }
112 }
113 #[inline(always)]
115 pub fn is_mul2(&self) -> bool {
116 *self == OVSR::Mul2
117 }
118 #[inline(always)]
120 pub fn is_mul4(&self) -> bool {
121 *self == OVSR::Mul4
122 }
123 #[inline(always)]
125 pub fn is_mul8(&self) -> bool {
126 *self == OVSR::Mul8
127 }
128 #[inline(always)]
130 pub fn is_mul16(&self) -> bool {
131 *self == OVSR::Mul16
132 }
133 #[inline(always)]
135 pub fn is_mul32(&self) -> bool {
136 *self == OVSR::Mul32
137 }
138 #[inline(always)]
140 pub fn is_mul64(&self) -> bool {
141 *self == OVSR::Mul64
142 }
143 #[inline(always)]
145 pub fn is_mul128(&self) -> bool {
146 *self == OVSR::Mul128
147 }
148 #[inline(always)]
150 pub fn is_mul256(&self) -> bool {
151 *self == OVSR::Mul256
152 }
153}
154pub type OVSR_W<'a, REG> = crate::FieldWriter<'a, REG, 3, OVSR, crate::Safe>;
156impl<'a, REG> OVSR_W<'a, REG>
157where
158 REG: crate::Writable + crate::RegisterSpec,
159 REG::Ux: From<u8>,
160{
161 #[inline(always)]
163 pub fn mul2(self) -> &'a mut crate::W<REG> {
164 self.variant(OVSR::Mul2)
165 }
166 #[inline(always)]
168 pub fn mul4(self) -> &'a mut crate::W<REG> {
169 self.variant(OVSR::Mul4)
170 }
171 #[inline(always)]
173 pub fn mul8(self) -> &'a mut crate::W<REG> {
174 self.variant(OVSR::Mul8)
175 }
176 #[inline(always)]
178 pub fn mul16(self) -> &'a mut crate::W<REG> {
179 self.variant(OVSR::Mul16)
180 }
181 #[inline(always)]
183 pub fn mul32(self) -> &'a mut crate::W<REG> {
184 self.variant(OVSR::Mul32)
185 }
186 #[inline(always)]
188 pub fn mul64(self) -> &'a mut crate::W<REG> {
189 self.variant(OVSR::Mul64)
190 }
191 #[inline(always)]
193 pub fn mul128(self) -> &'a mut crate::W<REG> {
194 self.variant(OVSR::Mul128)
195 }
196 #[inline(always)]
198 pub fn mul256(self) -> &'a mut crate::W<REG> {
199 self.variant(OVSR::Mul256)
200 }
201}
202#[cfg_attr(feature = "defmt", derive(defmt::Format))]
206#[derive(Clone, Copy, Debug, PartialEq, Eq)]
207#[repr(u8)]
208pub enum OVSS {
209 NoShift = 0,
211 Shift1 = 1,
213 Shift2 = 2,
215 Shift3 = 3,
217 Shift4 = 4,
219 Shift5 = 5,
221 Shift6 = 6,
223 Shift7 = 7,
225 Shift8 = 8,
227}
228impl From<OVSS> for u8 {
229 #[inline(always)]
230 fn from(variant: OVSS) -> Self {
231 variant as _
232 }
233}
234impl crate::FieldSpec for OVSS {
235 type Ux = u8;
236}
237impl crate::IsEnum for OVSS {}
238pub type OVSS_R = crate::FieldReader<OVSS>;
240impl OVSS_R {
241 #[inline(always)]
243 pub const fn variant(&self) -> Option<OVSS> {
244 match self.bits {
245 0 => Some(OVSS::NoShift),
246 1 => Some(OVSS::Shift1),
247 2 => Some(OVSS::Shift2),
248 3 => Some(OVSS::Shift3),
249 4 => Some(OVSS::Shift4),
250 5 => Some(OVSS::Shift5),
251 6 => Some(OVSS::Shift6),
252 7 => Some(OVSS::Shift7),
253 8 => Some(OVSS::Shift8),
254 _ => None,
255 }
256 }
257 #[inline(always)]
259 pub fn is_no_shift(&self) -> bool {
260 *self == OVSS::NoShift
261 }
262 #[inline(always)]
264 pub fn is_shift1(&self) -> bool {
265 *self == OVSS::Shift1
266 }
267 #[inline(always)]
269 pub fn is_shift2(&self) -> bool {
270 *self == OVSS::Shift2
271 }
272 #[inline(always)]
274 pub fn is_shift3(&self) -> bool {
275 *self == OVSS::Shift3
276 }
277 #[inline(always)]
279 pub fn is_shift4(&self) -> bool {
280 *self == OVSS::Shift4
281 }
282 #[inline(always)]
284 pub fn is_shift5(&self) -> bool {
285 *self == OVSS::Shift5
286 }
287 #[inline(always)]
289 pub fn is_shift6(&self) -> bool {
290 *self == OVSS::Shift6
291 }
292 #[inline(always)]
294 pub fn is_shift7(&self) -> bool {
295 *self == OVSS::Shift7
296 }
297 #[inline(always)]
299 pub fn is_shift8(&self) -> bool {
300 *self == OVSS::Shift8
301 }
302}
303pub type OVSS_W<'a, REG> = crate::FieldWriter<'a, REG, 4, OVSS>;
305impl<'a, REG> OVSS_W<'a, REG>
306where
307 REG: crate::Writable + crate::RegisterSpec,
308 REG::Ux: From<u8>,
309{
310 #[inline(always)]
312 pub fn no_shift(self) -> &'a mut crate::W<REG> {
313 self.variant(OVSS::NoShift)
314 }
315 #[inline(always)]
317 pub fn shift1(self) -> &'a mut crate::W<REG> {
318 self.variant(OVSS::Shift1)
319 }
320 #[inline(always)]
322 pub fn shift2(self) -> &'a mut crate::W<REG> {
323 self.variant(OVSS::Shift2)
324 }
325 #[inline(always)]
327 pub fn shift3(self) -> &'a mut crate::W<REG> {
328 self.variant(OVSS::Shift3)
329 }
330 #[inline(always)]
332 pub fn shift4(self) -> &'a mut crate::W<REG> {
333 self.variant(OVSS::Shift4)
334 }
335 #[inline(always)]
337 pub fn shift5(self) -> &'a mut crate::W<REG> {
338 self.variant(OVSS::Shift5)
339 }
340 #[inline(always)]
342 pub fn shift6(self) -> &'a mut crate::W<REG> {
343 self.variant(OVSS::Shift6)
344 }
345 #[inline(always)]
347 pub fn shift7(self) -> &'a mut crate::W<REG> {
348 self.variant(OVSS::Shift7)
349 }
350 #[inline(always)]
352 pub fn shift8(self) -> &'a mut crate::W<REG> {
353 self.variant(OVSS::Shift8)
354 }
355}
356#[cfg_attr(feature = "defmt", derive(defmt::Format))]
360#[derive(Clone, Copy, Debug, PartialEq, Eq)]
361pub enum TOVS {
362 TriggerAll = 0,
364 TriggerEach = 1,
366}
367impl From<TOVS> for bool {
368 #[inline(always)]
369 fn from(variant: TOVS) -> Self {
370 variant as u8 != 0
371 }
372}
373pub type TOVS_R = crate::BitReader<TOVS>;
375impl TOVS_R {
376 #[inline(always)]
378 pub const fn variant(&self) -> TOVS {
379 match self.bits {
380 false => TOVS::TriggerAll,
381 true => TOVS::TriggerEach,
382 }
383 }
384 #[inline(always)]
386 pub fn is_trigger_all(&self) -> bool {
387 *self == TOVS::TriggerAll
388 }
389 #[inline(always)]
391 pub fn is_trigger_each(&self) -> bool {
392 *self == TOVS::TriggerEach
393 }
394}
395pub type TOVS_W<'a, REG> = crate::BitWriter<'a, REG, TOVS>;
397impl<'a, REG> TOVS_W<'a, REG>
398where
399 REG: crate::Writable + crate::RegisterSpec,
400{
401 #[inline(always)]
403 pub fn trigger_all(self) -> &'a mut crate::W<REG> {
404 self.variant(TOVS::TriggerAll)
405 }
406 #[inline(always)]
408 pub fn trigger_each(self) -> &'a mut crate::W<REG> {
409 self.variant(TOVS::TriggerEach)
410 }
411}
412#[cfg_attr(feature = "defmt", derive(defmt::Format))]
416#[derive(Clone, Copy, Debug, PartialEq, Eq)]
417pub enum LFTRIG {
418 Disabled = 0,
420 Enabled = 1,
422}
423impl From<LFTRIG> for bool {
424 #[inline(always)]
425 fn from(variant: LFTRIG) -> Self {
426 variant as u8 != 0
427 }
428}
429pub type LFTRIG_R = crate::BitReader<LFTRIG>;
431impl LFTRIG_R {
432 #[inline(always)]
434 pub const fn variant(&self) -> LFTRIG {
435 match self.bits {
436 false => LFTRIG::Disabled,
437 true => LFTRIG::Enabled,
438 }
439 }
440 #[inline(always)]
442 pub fn is_disabled(&self) -> bool {
443 *self == LFTRIG::Disabled
444 }
445 #[inline(always)]
447 pub fn is_enabled(&self) -> bool {
448 *self == LFTRIG::Enabled
449 }
450}
451pub type LFTRIG_W<'a, REG> = crate::BitWriter<'a, REG, LFTRIG>;
453impl<'a, REG> LFTRIG_W<'a, REG>
454where
455 REG: crate::Writable + crate::RegisterSpec,
456{
457 #[inline(always)]
459 pub fn disabled(self) -> &'a mut crate::W<REG> {
460 self.variant(LFTRIG::Disabled)
461 }
462 #[inline(always)]
464 pub fn enabled(self) -> &'a mut crate::W<REG> {
465 self.variant(LFTRIG::Enabled)
466 }
467}
468#[cfg_attr(feature = "defmt", derive(defmt::Format))]
472#[derive(Clone, Copy, Debug, PartialEq, Eq)]
473#[repr(u8)]
474pub enum CKMODE {
475 Adclk = 0,
477 PclkDiv2 = 1,
479 PclkDiv4 = 2,
481 Pclk = 3,
483}
484impl From<CKMODE> for u8 {
485 #[inline(always)]
486 fn from(variant: CKMODE) -> Self {
487 variant as _
488 }
489}
490impl crate::FieldSpec for CKMODE {
491 type Ux = u8;
492}
493impl crate::IsEnum for CKMODE {}
494pub type CKMODE_R = crate::FieldReader<CKMODE>;
496impl CKMODE_R {
497 #[inline(always)]
499 pub const fn variant(&self) -> CKMODE {
500 match self.bits {
501 0 => CKMODE::Adclk,
502 1 => CKMODE::PclkDiv2,
503 2 => CKMODE::PclkDiv4,
504 3 => CKMODE::Pclk,
505 _ => unreachable!(),
506 }
507 }
508 #[inline(always)]
510 pub fn is_adclk(&self) -> bool {
511 *self == CKMODE::Adclk
512 }
513 #[inline(always)]
515 pub fn is_pclk_div2(&self) -> bool {
516 *self == CKMODE::PclkDiv2
517 }
518 #[inline(always)]
520 pub fn is_pclk_div4(&self) -> bool {
521 *self == CKMODE::PclkDiv4
522 }
523 #[inline(always)]
525 pub fn is_pclk(&self) -> bool {
526 *self == CKMODE::Pclk
527 }
528}
529pub type CKMODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CKMODE, crate::Safe>;
531impl<'a, REG> CKMODE_W<'a, REG>
532where
533 REG: crate::Writable + crate::RegisterSpec,
534 REG::Ux: From<u8>,
535{
536 #[inline(always)]
538 pub fn adclk(self) -> &'a mut crate::W<REG> {
539 self.variant(CKMODE::Adclk)
540 }
541 #[inline(always)]
543 pub fn pclk_div2(self) -> &'a mut crate::W<REG> {
544 self.variant(CKMODE::PclkDiv2)
545 }
546 #[inline(always)]
548 pub fn pclk_div4(self) -> &'a mut crate::W<REG> {
549 self.variant(CKMODE::PclkDiv4)
550 }
551 #[inline(always)]
553 pub fn pclk(self) -> &'a mut crate::W<REG> {
554 self.variant(CKMODE::Pclk)
555 }
556}
557impl R {
558 #[inline(always)]
560 pub fn ovse(&self) -> OVSE_R {
561 OVSE_R::new((self.bits & 1) != 0)
562 }
563 #[inline(always)]
565 pub fn ovsr(&self) -> OVSR_R {
566 OVSR_R::new(((self.bits >> 2) & 7) as u8)
567 }
568 #[inline(always)]
570 pub fn ovss(&self) -> OVSS_R {
571 OVSS_R::new(((self.bits >> 5) & 0x0f) as u8)
572 }
573 #[inline(always)]
575 pub fn tovs(&self) -> TOVS_R {
576 TOVS_R::new(((self.bits >> 9) & 1) != 0)
577 }
578 #[inline(always)]
580 pub fn lftrig(&self) -> LFTRIG_R {
581 LFTRIG_R::new(((self.bits >> 29) & 1) != 0)
582 }
583 #[inline(always)]
585 pub fn ckmode(&self) -> CKMODE_R {
586 CKMODE_R::new(((self.bits >> 30) & 3) as u8)
587 }
588}
589impl core::fmt::Debug for R {
590 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
591 f.debug_struct("CFGR2")
592 .field("ovse", &self.ovse())
593 .field("ovsr", &self.ovsr())
594 .field("ovss", &self.ovss())
595 .field("tovs", &self.tovs())
596 .field("lftrig", &self.lftrig())
597 .field("ckmode", &self.ckmode())
598 .finish()
599 }
600}
601impl W {
602 #[inline(always)]
604 pub fn ovse(&mut self) -> OVSE_W<CFGR2rs> {
605 OVSE_W::new(self, 0)
606 }
607 #[inline(always)]
609 pub fn ovsr(&mut self) -> OVSR_W<CFGR2rs> {
610 OVSR_W::new(self, 2)
611 }
612 #[inline(always)]
614 pub fn ovss(&mut self) -> OVSS_W<CFGR2rs> {
615 OVSS_W::new(self, 5)
616 }
617 #[inline(always)]
619 pub fn tovs(&mut self) -> TOVS_W<CFGR2rs> {
620 TOVS_W::new(self, 9)
621 }
622 #[inline(always)]
624 pub fn lftrig(&mut self) -> LFTRIG_W<CFGR2rs> {
625 LFTRIG_W::new(self, 29)
626 }
627 #[inline(always)]
629 pub fn ckmode(&mut self) -> CKMODE_W<CFGR2rs> {
630 CKMODE_W::new(self, 30)
631 }
632}
633pub struct CFGR2rs;
639impl crate::RegisterSpec for CFGR2rs {
640 type Ux = u32;
641}
642impl crate::Readable for CFGR2rs {}
644impl crate::Writable for CFGR2rs {
646 type Safety = crate::Unsafe;
647}
648impl crate::Resettable for CFGR2rs {}