1#[doc = "Register `CCR1` reader"]
2pub type R = crate::R<Ccr1Spec>;
3#[doc = "Register `CCR1` writer"]
4pub type W = crate::W<Ccr1Spec>;
5#[doc = "Windowing Enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum WindowEn {
9 #[doc = "0: Disable"]
10 Disable = 0,
11 #[doc = "1: Enable"]
12 Enable = 1,
13}
14impl From<WindowEn> for bool {
15 #[inline(always)]
16 fn from(variant: WindowEn) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `WINDOW_EN` reader - Windowing Enable"]
21pub type WindowEnR = crate::BitReader<WindowEn>;
22impl WindowEnR {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> WindowEn {
26 match self.bits {
27 false => WindowEn::Disable,
28 true => WindowEn::Enable,
29 }
30 }
31 #[doc = "Disable"]
32 #[inline(always)]
33 pub fn is_disable(&self) -> bool {
34 *self == WindowEn::Disable
35 }
36 #[doc = "Enable"]
37 #[inline(always)]
38 pub fn is_enable(&self) -> bool {
39 *self == WindowEn::Enable
40 }
41}
42#[doc = "Field `WINDOW_EN` writer - Windowing Enable"]
43pub type WindowEnW<'a, REG> = crate::BitWriter<'a, REG, WindowEn>;
44impl<'a, REG> WindowEnW<'a, REG>
45where
46 REG: crate::Writable + crate::RegisterSpec,
47{
48 #[doc = "Disable"]
49 #[inline(always)]
50 pub fn disable(self) -> &'a mut crate::W<REG> {
51 self.variant(WindowEn::Disable)
52 }
53 #[doc = "Enable"]
54 #[inline(always)]
55 pub fn enable(self) -> &'a mut crate::W<REG> {
56 self.variant(WindowEn::Enable)
57 }
58}
59#[doc = "Sampling Enable\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum SampleEn {
63 #[doc = "0: Disable"]
64 Disable = 0,
65 #[doc = "1: Enable"]
66 Enable = 1,
67}
68impl From<SampleEn> for bool {
69 #[inline(always)]
70 fn from(variant: SampleEn) -> Self {
71 variant as u8 != 0
72 }
73}
74#[doc = "Field `SAMPLE_EN` reader - Sampling Enable"]
75pub type SampleEnR = crate::BitReader<SampleEn>;
76impl SampleEnR {
77 #[doc = "Get enumerated values variant"]
78 #[inline(always)]
79 pub const fn variant(&self) -> SampleEn {
80 match self.bits {
81 false => SampleEn::Disable,
82 true => SampleEn::Enable,
83 }
84 }
85 #[doc = "Disable"]
86 #[inline(always)]
87 pub fn is_disable(&self) -> bool {
88 *self == SampleEn::Disable
89 }
90 #[doc = "Enable"]
91 #[inline(always)]
92 pub fn is_enable(&self) -> bool {
93 *self == SampleEn::Enable
94 }
95}
96#[doc = "Field `SAMPLE_EN` writer - Sampling Enable"]
97pub type SampleEnW<'a, REG> = crate::BitWriter<'a, REG, SampleEn>;
98impl<'a, REG> SampleEnW<'a, REG>
99where
100 REG: crate::Writable + crate::RegisterSpec,
101{
102 #[doc = "Disable"]
103 #[inline(always)]
104 pub fn disable(self) -> &'a mut crate::W<REG> {
105 self.variant(SampleEn::Disable)
106 }
107 #[doc = "Enable"]
108 #[inline(always)]
109 pub fn enable(self) -> &'a mut crate::W<REG> {
110 self.variant(SampleEn::Enable)
111 }
112}
113#[doc = "DMA Enable\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum DmaEn {
117 #[doc = "0: Disable"]
118 Disable = 0,
119 #[doc = "1: Enable"]
120 Enable = 1,
121}
122impl From<DmaEn> for bool {
123 #[inline(always)]
124 fn from(variant: DmaEn) -> Self {
125 variant as u8 != 0
126 }
127}
128#[doc = "Field `DMA_EN` reader - DMA Enable"]
129pub type DmaEnR = crate::BitReader<DmaEn>;
130impl DmaEnR {
131 #[doc = "Get enumerated values variant"]
132 #[inline(always)]
133 pub const fn variant(&self) -> DmaEn {
134 match self.bits {
135 false => DmaEn::Disable,
136 true => DmaEn::Enable,
137 }
138 }
139 #[doc = "Disable"]
140 #[inline(always)]
141 pub fn is_disable(&self) -> bool {
142 *self == DmaEn::Disable
143 }
144 #[doc = "Enable"]
145 #[inline(always)]
146 pub fn is_enable(&self) -> bool {
147 *self == DmaEn::Enable
148 }
149}
150#[doc = "Field `DMA_EN` writer - DMA Enable"]
151pub type DmaEnW<'a, REG> = crate::BitWriter<'a, REG, DmaEn>;
152impl<'a, REG> DmaEnW<'a, REG>
153where
154 REG: crate::Writable + crate::RegisterSpec,
155{
156 #[doc = "Disable"]
157 #[inline(always)]
158 pub fn disable(self) -> &'a mut crate::W<REG> {
159 self.variant(DmaEn::Disable)
160 }
161 #[doc = "Enable"]
162 #[inline(always)]
163 pub fn enable(self) -> &'a mut crate::W<REG> {
164 self.variant(DmaEn::Enable)
165 }
166}
167#[doc = "Comparator Invert\n\nValue on reset: 0"]
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum CoutInv {
171 #[doc = "0: Do not invert"]
172 NoInvert = 0,
173 #[doc = "1: Invert"]
174 Invert = 1,
175}
176impl From<CoutInv> for bool {
177 #[inline(always)]
178 fn from(variant: CoutInv) -> Self {
179 variant as u8 != 0
180 }
181}
182#[doc = "Field `COUT_INV` reader - Comparator Invert"]
183pub type CoutInvR = crate::BitReader<CoutInv>;
184impl CoutInvR {
185 #[doc = "Get enumerated values variant"]
186 #[inline(always)]
187 pub const fn variant(&self) -> CoutInv {
188 match self.bits {
189 false => CoutInv::NoInvert,
190 true => CoutInv::Invert,
191 }
192 }
193 #[doc = "Do not invert"]
194 #[inline(always)]
195 pub fn is_no_invert(&self) -> bool {
196 *self == CoutInv::NoInvert
197 }
198 #[doc = "Invert"]
199 #[inline(always)]
200 pub fn is_invert(&self) -> bool {
201 *self == CoutInv::Invert
202 }
203}
204#[doc = "Field `COUT_INV` writer - Comparator Invert"]
205pub type CoutInvW<'a, REG> = crate::BitWriter<'a, REG, CoutInv>;
206impl<'a, REG> CoutInvW<'a, REG>
207where
208 REG: crate::Writable + crate::RegisterSpec,
209{
210 #[doc = "Do not invert"]
211 #[inline(always)]
212 pub fn no_invert(self) -> &'a mut crate::W<REG> {
213 self.variant(CoutInv::NoInvert)
214 }
215 #[doc = "Invert"]
216 #[inline(always)]
217 pub fn invert(self) -> &'a mut crate::W<REG> {
218 self.variant(CoutInv::Invert)
219 }
220}
221#[doc = "Comparator Output Select\n\nValue on reset: 0"]
222#[cfg_attr(feature = "defmt", derive(defmt::Format))]
223#[derive(Clone, Copy, Debug, PartialEq, Eq)]
224pub enum CoutSel {
225 #[doc = "0: Use COUT (filtered)"]
226 Cout = 0,
227 #[doc = "1: Use COUTA (unfiltered)"]
228 Couta = 1,
229}
230impl From<CoutSel> for bool {
231 #[inline(always)]
232 fn from(variant: CoutSel) -> Self {
233 variant as u8 != 0
234 }
235}
236#[doc = "Field `COUT_SEL` reader - Comparator Output Select"]
237pub type CoutSelR = crate::BitReader<CoutSel>;
238impl CoutSelR {
239 #[doc = "Get enumerated values variant"]
240 #[inline(always)]
241 pub const fn variant(&self) -> CoutSel {
242 match self.bits {
243 false => CoutSel::Cout,
244 true => CoutSel::Couta,
245 }
246 }
247 #[doc = "Use COUT (filtered)"]
248 #[inline(always)]
249 pub fn is_cout(&self) -> bool {
250 *self == CoutSel::Cout
251 }
252 #[doc = "Use COUTA (unfiltered)"]
253 #[inline(always)]
254 pub fn is_couta(&self) -> bool {
255 *self == CoutSel::Couta
256 }
257}
258#[doc = "Field `COUT_SEL` writer - Comparator Output Select"]
259pub type CoutSelW<'a, REG> = crate::BitWriter<'a, REG, CoutSel>;
260impl<'a, REG> CoutSelW<'a, REG>
261where
262 REG: crate::Writable + crate::RegisterSpec,
263{
264 #[doc = "Use COUT (filtered)"]
265 #[inline(always)]
266 pub fn cout(self) -> &'a mut crate::W<REG> {
267 self.variant(CoutSel::Cout)
268 }
269 #[doc = "Use COUTA (unfiltered)"]
270 #[inline(always)]
271 pub fn couta(self) -> &'a mut crate::W<REG> {
272 self.variant(CoutSel::Couta)
273 }
274}
275#[doc = "Comparator Output Pin Enable\n\nValue on reset: 0"]
276#[cfg_attr(feature = "defmt", derive(defmt::Format))]
277#[derive(Clone, Copy, Debug, PartialEq, Eq)]
278pub enum CoutPen {
279 #[doc = "0: Not available"]
280 Unavailable = 0,
281 #[doc = "1: Available"]
282 Available = 1,
283}
284impl From<CoutPen> for bool {
285 #[inline(always)]
286 fn from(variant: CoutPen) -> Self {
287 variant as u8 != 0
288 }
289}
290#[doc = "Field `COUT_PEN` reader - Comparator Output Pin Enable"]
291pub type CoutPenR = crate::BitReader<CoutPen>;
292impl CoutPenR {
293 #[doc = "Get enumerated values variant"]
294 #[inline(always)]
295 pub const fn variant(&self) -> CoutPen {
296 match self.bits {
297 false => CoutPen::Unavailable,
298 true => CoutPen::Available,
299 }
300 }
301 #[doc = "Not available"]
302 #[inline(always)]
303 pub fn is_unavailable(&self) -> bool {
304 *self == CoutPen::Unavailable
305 }
306 #[doc = "Available"]
307 #[inline(always)]
308 pub fn is_available(&self) -> bool {
309 *self == CoutPen::Available
310 }
311}
312#[doc = "Field `COUT_PEN` writer - Comparator Output Pin Enable"]
313pub type CoutPenW<'a, REG> = crate::BitWriter<'a, REG, CoutPen>;
314impl<'a, REG> CoutPenW<'a, REG>
315where
316 REG: crate::Writable + crate::RegisterSpec,
317{
318 #[doc = "Not available"]
319 #[inline(always)]
320 pub fn unavailable(self) -> &'a mut crate::W<REG> {
321 self.variant(CoutPen::Unavailable)
322 }
323 #[doc = "Available"]
324 #[inline(always)]
325 pub fn available(self) -> &'a mut crate::W<REG> {
326 self.variant(CoutPen::Available)
327 }
328}
329#[doc = "COUTA_OW Enable\n\nValue on reset: 0"]
330#[cfg_attr(feature = "defmt", derive(defmt::Format))]
331#[derive(Clone, Copy, Debug, PartialEq, Eq)]
332pub enum CoutaOwen {
333 #[doc = "0: COUTA holds the last sampled value."]
334 Sampled = 0,
335 #[doc = "1: Enables the COUTA signal value to be defined by COUTA_OW."]
336 CoutaOw = 1,
337}
338impl From<CoutaOwen> for bool {
339 #[inline(always)]
340 fn from(variant: CoutaOwen) -> Self {
341 variant as u8 != 0
342 }
343}
344#[doc = "Field `COUTA_OWEN` reader - COUTA_OW Enable"]
345pub type CoutaOwenR = crate::BitReader<CoutaOwen>;
346impl CoutaOwenR {
347 #[doc = "Get enumerated values variant"]
348 #[inline(always)]
349 pub const fn variant(&self) -> CoutaOwen {
350 match self.bits {
351 false => CoutaOwen::Sampled,
352 true => CoutaOwen::CoutaOw,
353 }
354 }
355 #[doc = "COUTA holds the last sampled value."]
356 #[inline(always)]
357 pub fn is_sampled(&self) -> bool {
358 *self == CoutaOwen::Sampled
359 }
360 #[doc = "Enables the COUTA signal value to be defined by COUTA_OW."]
361 #[inline(always)]
362 pub fn is_couta_ow(&self) -> bool {
363 *self == CoutaOwen::CoutaOw
364 }
365}
366#[doc = "Field `COUTA_OWEN` writer - COUTA_OW Enable"]
367pub type CoutaOwenW<'a, REG> = crate::BitWriter<'a, REG, CoutaOwen>;
368impl<'a, REG> CoutaOwenW<'a, REG>
369where
370 REG: crate::Writable + crate::RegisterSpec,
371{
372 #[doc = "COUTA holds the last sampled value."]
373 #[inline(always)]
374 pub fn sampled(self) -> &'a mut crate::W<REG> {
375 self.variant(CoutaOwen::Sampled)
376 }
377 #[doc = "Enables the COUTA signal value to be defined by COUTA_OW."]
378 #[inline(always)]
379 pub fn couta_ow(self) -> &'a mut crate::W<REG> {
380 self.variant(CoutaOwen::CoutaOw)
381 }
382}
383#[doc = "COUTA Output Level for Closed Window\n\nValue on reset: 0"]
384#[cfg_attr(feature = "defmt", derive(defmt::Format))]
385#[derive(Clone, Copy, Debug, PartialEq, Eq)]
386pub enum CoutaOw {
387 #[doc = "0: COUTA is 0"]
388 Couta0 = 0,
389 #[doc = "1: COUTA is 1"]
390 Couta1 = 1,
391}
392impl From<CoutaOw> for bool {
393 #[inline(always)]
394 fn from(variant: CoutaOw) -> Self {
395 variant as u8 != 0
396 }
397}
398#[doc = "Field `COUTA_OW` reader - COUTA Output Level for Closed Window"]
399pub type CoutaOwR = crate::BitReader<CoutaOw>;
400impl CoutaOwR {
401 #[doc = "Get enumerated values variant"]
402 #[inline(always)]
403 pub const fn variant(&self) -> CoutaOw {
404 match self.bits {
405 false => CoutaOw::Couta0,
406 true => CoutaOw::Couta1,
407 }
408 }
409 #[doc = "COUTA is 0"]
410 #[inline(always)]
411 pub fn is_couta_0(&self) -> bool {
412 *self == CoutaOw::Couta0
413 }
414 #[doc = "COUTA is 1"]
415 #[inline(always)]
416 pub fn is_couta_1(&self) -> bool {
417 *self == CoutaOw::Couta1
418 }
419}
420#[doc = "Field `COUTA_OW` writer - COUTA Output Level for Closed Window"]
421pub type CoutaOwW<'a, REG> = crate::BitWriter<'a, REG, CoutaOw>;
422impl<'a, REG> CoutaOwW<'a, REG>
423where
424 REG: crate::Writable + crate::RegisterSpec,
425{
426 #[doc = "COUTA is 0"]
427 #[inline(always)]
428 pub fn couta_0(self) -> &'a mut crate::W<REG> {
429 self.variant(CoutaOw::Couta0)
430 }
431 #[doc = "COUTA is 1"]
432 #[inline(always)]
433 pub fn couta_1(self) -> &'a mut crate::W<REG> {
434 self.variant(CoutaOw::Couta1)
435 }
436}
437#[doc = "WINDOW/SAMPLE Signal Invert\n\nValue on reset: 0"]
438#[cfg_attr(feature = "defmt", derive(defmt::Format))]
439#[derive(Clone, Copy, Debug, PartialEq, Eq)]
440pub enum WindowInv {
441 #[doc = "0: Do not invert"]
442 NoInvert = 0,
443 #[doc = "1: Invert"]
444 Invert = 1,
445}
446impl From<WindowInv> for bool {
447 #[inline(always)]
448 fn from(variant: WindowInv) -> Self {
449 variant as u8 != 0
450 }
451}
452#[doc = "Field `WINDOW_INV` reader - WINDOW/SAMPLE Signal Invert"]
453pub type WindowInvR = crate::BitReader<WindowInv>;
454impl WindowInvR {
455 #[doc = "Get enumerated values variant"]
456 #[inline(always)]
457 pub const fn variant(&self) -> WindowInv {
458 match self.bits {
459 false => WindowInv::NoInvert,
460 true => WindowInv::Invert,
461 }
462 }
463 #[doc = "Do not invert"]
464 #[inline(always)]
465 pub fn is_no_invert(&self) -> bool {
466 *self == WindowInv::NoInvert
467 }
468 #[doc = "Invert"]
469 #[inline(always)]
470 pub fn is_invert(&self) -> bool {
471 *self == WindowInv::Invert
472 }
473}
474#[doc = "Field `WINDOW_INV` writer - WINDOW/SAMPLE Signal Invert"]
475pub type WindowInvW<'a, REG> = crate::BitWriter<'a, REG, WindowInv>;
476impl<'a, REG> WindowInvW<'a, REG>
477where
478 REG: crate::Writable + crate::RegisterSpec,
479{
480 #[doc = "Do not invert"]
481 #[inline(always)]
482 pub fn no_invert(self) -> &'a mut crate::W<REG> {
483 self.variant(WindowInv::NoInvert)
484 }
485 #[doc = "Invert"]
486 #[inline(always)]
487 pub fn invert(self) -> &'a mut crate::W<REG> {
488 self.variant(WindowInv::Invert)
489 }
490}
491#[doc = "COUT Event Window Close\n\nValue on reset: 0"]
492#[cfg_attr(feature = "defmt", derive(defmt::Format))]
493#[derive(Clone, Copy, Debug, PartialEq, Eq)]
494pub enum WindowCls {
495 #[doc = "0: COUT event cannot close the window"]
496 NoClose = 0,
497 #[doc = "1: COUT event can close the window"]
498 Close = 1,
499}
500impl From<WindowCls> for bool {
501 #[inline(always)]
502 fn from(variant: WindowCls) -> Self {
503 variant as u8 != 0
504 }
505}
506#[doc = "Field `WINDOW_CLS` reader - COUT Event Window Close"]
507pub type WindowClsR = crate::BitReader<WindowCls>;
508impl WindowClsR {
509 #[doc = "Get enumerated values variant"]
510 #[inline(always)]
511 pub const fn variant(&self) -> WindowCls {
512 match self.bits {
513 false => WindowCls::NoClose,
514 true => WindowCls::Close,
515 }
516 }
517 #[doc = "COUT event cannot close the window"]
518 #[inline(always)]
519 pub fn is_no_close(&self) -> bool {
520 *self == WindowCls::NoClose
521 }
522 #[doc = "COUT event can close the window"]
523 #[inline(always)]
524 pub fn is_close(&self) -> bool {
525 *self == WindowCls::Close
526 }
527}
528#[doc = "Field `WINDOW_CLS` writer - COUT Event Window Close"]
529pub type WindowClsW<'a, REG> = crate::BitWriter<'a, REG, WindowCls>;
530impl<'a, REG> WindowClsW<'a, REG>
531where
532 REG: crate::Writable + crate::RegisterSpec,
533{
534 #[doc = "COUT event cannot close the window"]
535 #[inline(always)]
536 pub fn no_close(self) -> &'a mut crate::W<REG> {
537 self.variant(WindowCls::NoClose)
538 }
539 #[doc = "COUT event can close the window"]
540 #[inline(always)]
541 pub fn close(self) -> &'a mut crate::W<REG> {
542 self.variant(WindowCls::Close)
543 }
544}
545#[doc = "COUT Event Select\n\nValue on reset: 0"]
546#[cfg_attr(feature = "defmt", derive(defmt::Format))]
547#[derive(Clone, Copy, Debug, PartialEq, Eq)]
548#[repr(u8)]
549pub enum EvtSel {
550 #[doc = "0: Rising edge"]
551 Rising = 0,
552 #[doc = "1: Falling edge"]
553 Falling = 1,
554 #[doc = "2: Both edges"]
555 Both = 2,
556}
557impl From<EvtSel> for u8 {
558 #[inline(always)]
559 fn from(variant: EvtSel) -> Self {
560 variant as _
561 }
562}
563impl crate::FieldSpec for EvtSel {
564 type Ux = u8;
565}
566impl crate::IsEnum for EvtSel {}
567#[doc = "Field `EVT_SEL` reader - COUT Event Select"]
568pub type EvtSelR = crate::FieldReader<EvtSel>;
569impl EvtSelR {
570 #[doc = "Get enumerated values variant"]
571 #[inline(always)]
572 pub const fn variant(&self) -> Option<EvtSel> {
573 match self.bits {
574 0 => Some(EvtSel::Rising),
575 1 => Some(EvtSel::Falling),
576 2 => Some(EvtSel::Both),
577 _ => None,
578 }
579 }
580 #[doc = "Rising edge"]
581 #[inline(always)]
582 pub fn is_rising(&self) -> bool {
583 *self == EvtSel::Rising
584 }
585 #[doc = "Falling edge"]
586 #[inline(always)]
587 pub fn is_falling(&self) -> bool {
588 *self == EvtSel::Falling
589 }
590 #[doc = "Both edges"]
591 #[inline(always)]
592 pub fn is_both(&self) -> bool {
593 *self == EvtSel::Both
594 }
595}
596#[doc = "Field `EVT_SEL` writer - COUT Event Select"]
597pub type EvtSelW<'a, REG> = crate::FieldWriter<'a, REG, 2, EvtSel>;
598impl<'a, REG> EvtSelW<'a, REG>
599where
600 REG: crate::Writable + crate::RegisterSpec,
601 REG::Ux: From<u8>,
602{
603 #[doc = "Rising edge"]
604 #[inline(always)]
605 pub fn rising(self) -> &'a mut crate::W<REG> {
606 self.variant(EvtSel::Rising)
607 }
608 #[doc = "Falling edge"]
609 #[inline(always)]
610 pub fn falling(self) -> &'a mut crate::W<REG> {
611 self.variant(EvtSel::Falling)
612 }
613 #[doc = "Both edges"]
614 #[inline(always)]
615 pub fn both(self) -> &'a mut crate::W<REG> {
616 self.variant(EvtSel::Both)
617 }
618}
619#[doc = "Functional Clock Source Select\n\nValue on reset: 0"]
620#[cfg_attr(feature = "defmt", derive(defmt::Format))]
621#[derive(Clone, Copy, Debug, PartialEq, Eq)]
622#[repr(u8)]
623pub enum FuncClkSel {
624 #[doc = "0: Select functional clock source 0"]
625 Func0 = 0,
626 #[doc = "1: Select functional clock source 1"]
627 Func1 = 1,
628 #[doc = "2: Select functional clock source 2"]
629 Func2 = 2,
630 #[doc = "3: Select functional clock source 3"]
631 Func3 = 3,
632}
633impl From<FuncClkSel> for u8 {
634 #[inline(always)]
635 fn from(variant: FuncClkSel) -> Self {
636 variant as _
637 }
638}
639impl crate::FieldSpec for FuncClkSel {
640 type Ux = u8;
641}
642impl crate::IsEnum for FuncClkSel {}
643#[doc = "Field `FUNC_CLK_SEL` reader - Functional Clock Source Select"]
644pub type FuncClkSelR = crate::FieldReader<FuncClkSel>;
645impl FuncClkSelR {
646 #[doc = "Get enumerated values variant"]
647 #[inline(always)]
648 pub const fn variant(&self) -> FuncClkSel {
649 match self.bits {
650 0 => FuncClkSel::Func0,
651 1 => FuncClkSel::Func1,
652 2 => FuncClkSel::Func2,
653 3 => FuncClkSel::Func3,
654 _ => unreachable!(),
655 }
656 }
657 #[doc = "Select functional clock source 0"]
658 #[inline(always)]
659 pub fn is_func0(&self) -> bool {
660 *self == FuncClkSel::Func0
661 }
662 #[doc = "Select functional clock source 1"]
663 #[inline(always)]
664 pub fn is_func1(&self) -> bool {
665 *self == FuncClkSel::Func1
666 }
667 #[doc = "Select functional clock source 2"]
668 #[inline(always)]
669 pub fn is_func2(&self) -> bool {
670 *self == FuncClkSel::Func2
671 }
672 #[doc = "Select functional clock source 3"]
673 #[inline(always)]
674 pub fn is_func3(&self) -> bool {
675 *self == FuncClkSel::Func3
676 }
677}
678#[doc = "Field `FUNC_CLK_SEL` writer - Functional Clock Source Select"]
679pub type FuncClkSelW<'a, REG> = crate::FieldWriter<'a, REG, 2, FuncClkSel, crate::Safe>;
680impl<'a, REG> FuncClkSelW<'a, REG>
681where
682 REG: crate::Writable + crate::RegisterSpec,
683 REG::Ux: From<u8>,
684{
685 #[doc = "Select functional clock source 0"]
686 #[inline(always)]
687 pub fn func0(self) -> &'a mut crate::W<REG> {
688 self.variant(FuncClkSel::Func0)
689 }
690 #[doc = "Select functional clock source 1"]
691 #[inline(always)]
692 pub fn func1(self) -> &'a mut crate::W<REG> {
693 self.variant(FuncClkSel::Func1)
694 }
695 #[doc = "Select functional clock source 2"]
696 #[inline(always)]
697 pub fn func2(self) -> &'a mut crate::W<REG> {
698 self.variant(FuncClkSel::Func2)
699 }
700 #[doc = "Select functional clock source 3"]
701 #[inline(always)]
702 pub fn func3(self) -> &'a mut crate::W<REG> {
703 self.variant(FuncClkSel::Func3)
704 }
705}
706#[doc = "Filter Sample Count\n\nValue on reset: 0"]
707#[cfg_attr(feature = "defmt", derive(defmt::Format))]
708#[derive(Clone, Copy, Debug, PartialEq, Eq)]
709#[repr(u8)]
710pub enum FiltCnt {
711 #[doc = "0: Filter is bypassed: COUT = COUTA"]
712 Bypassed = 0,
713 #[doc = "1: 1 consecutive sample (Comparator output is simply sampled.)"]
714 Sample1 = 1,
715 #[doc = "2: 2 consecutive samples"]
716 Sample2 = 2,
717 #[doc = "3: 3 consecutive samples"]
718 Sample3 = 3,
719 #[doc = "4: 4 consecutive samples"]
720 Sample4 = 4,
721 #[doc = "5: 5 consecutive samples"]
722 Sample5 = 5,
723 #[doc = "6: 6 consecutive samples"]
724 Sample6 = 6,
725 #[doc = "7: 7 consecutive samples"]
726 Sample7 = 7,
727}
728impl From<FiltCnt> for u8 {
729 #[inline(always)]
730 fn from(variant: FiltCnt) -> Self {
731 variant as _
732 }
733}
734impl crate::FieldSpec for FiltCnt {
735 type Ux = u8;
736}
737impl crate::IsEnum for FiltCnt {}
738#[doc = "Field `FILT_CNT` reader - Filter Sample Count"]
739pub type FiltCntR = crate::FieldReader<FiltCnt>;
740impl FiltCntR {
741 #[doc = "Get enumerated values variant"]
742 #[inline(always)]
743 pub const fn variant(&self) -> FiltCnt {
744 match self.bits {
745 0 => FiltCnt::Bypassed,
746 1 => FiltCnt::Sample1,
747 2 => FiltCnt::Sample2,
748 3 => FiltCnt::Sample3,
749 4 => FiltCnt::Sample4,
750 5 => FiltCnt::Sample5,
751 6 => FiltCnt::Sample6,
752 7 => FiltCnt::Sample7,
753 _ => unreachable!(),
754 }
755 }
756 #[doc = "Filter is bypassed: COUT = COUTA"]
757 #[inline(always)]
758 pub fn is_bypassed(&self) -> bool {
759 *self == FiltCnt::Bypassed
760 }
761 #[doc = "1 consecutive sample (Comparator output is simply sampled.)"]
762 #[inline(always)]
763 pub fn is_sample_1(&self) -> bool {
764 *self == FiltCnt::Sample1
765 }
766 #[doc = "2 consecutive samples"]
767 #[inline(always)]
768 pub fn is_sample_2(&self) -> bool {
769 *self == FiltCnt::Sample2
770 }
771 #[doc = "3 consecutive samples"]
772 #[inline(always)]
773 pub fn is_sample_3(&self) -> bool {
774 *self == FiltCnt::Sample3
775 }
776 #[doc = "4 consecutive samples"]
777 #[inline(always)]
778 pub fn is_sample_4(&self) -> bool {
779 *self == FiltCnt::Sample4
780 }
781 #[doc = "5 consecutive samples"]
782 #[inline(always)]
783 pub fn is_sample_5(&self) -> bool {
784 *self == FiltCnt::Sample5
785 }
786 #[doc = "6 consecutive samples"]
787 #[inline(always)]
788 pub fn is_sample_6(&self) -> bool {
789 *self == FiltCnt::Sample6
790 }
791 #[doc = "7 consecutive samples"]
792 #[inline(always)]
793 pub fn is_sample_7(&self) -> bool {
794 *self == FiltCnt::Sample7
795 }
796}
797#[doc = "Field `FILT_CNT` writer - Filter Sample Count"]
798pub type FiltCntW<'a, REG> = crate::FieldWriter<'a, REG, 3, FiltCnt, crate::Safe>;
799impl<'a, REG> FiltCntW<'a, REG>
800where
801 REG: crate::Writable + crate::RegisterSpec,
802 REG::Ux: From<u8>,
803{
804 #[doc = "Filter is bypassed: COUT = COUTA"]
805 #[inline(always)]
806 pub fn bypassed(self) -> &'a mut crate::W<REG> {
807 self.variant(FiltCnt::Bypassed)
808 }
809 #[doc = "1 consecutive sample (Comparator output is simply sampled.)"]
810 #[inline(always)]
811 pub fn sample_1(self) -> &'a mut crate::W<REG> {
812 self.variant(FiltCnt::Sample1)
813 }
814 #[doc = "2 consecutive samples"]
815 #[inline(always)]
816 pub fn sample_2(self) -> &'a mut crate::W<REG> {
817 self.variant(FiltCnt::Sample2)
818 }
819 #[doc = "3 consecutive samples"]
820 #[inline(always)]
821 pub fn sample_3(self) -> &'a mut crate::W<REG> {
822 self.variant(FiltCnt::Sample3)
823 }
824 #[doc = "4 consecutive samples"]
825 #[inline(always)]
826 pub fn sample_4(self) -> &'a mut crate::W<REG> {
827 self.variant(FiltCnt::Sample4)
828 }
829 #[doc = "5 consecutive samples"]
830 #[inline(always)]
831 pub fn sample_5(self) -> &'a mut crate::W<REG> {
832 self.variant(FiltCnt::Sample5)
833 }
834 #[doc = "6 consecutive samples"]
835 #[inline(always)]
836 pub fn sample_6(self) -> &'a mut crate::W<REG> {
837 self.variant(FiltCnt::Sample6)
838 }
839 #[doc = "7 consecutive samples"]
840 #[inline(always)]
841 pub fn sample_7(self) -> &'a mut crate::W<REG> {
842 self.variant(FiltCnt::Sample7)
843 }
844}
845#[doc = "Field `FILT_PER` reader - Filter Sample Period"]
846pub type FiltPerR = crate::FieldReader;
847#[doc = "Field `FILT_PER` writer - Filter Sample Period"]
848pub type FiltPerW<'a, REG> = crate::FieldWriter<'a, REG, 8>;
849impl R {
850 #[doc = "Bit 0 - Windowing Enable"]
851 #[inline(always)]
852 pub fn window_en(&self) -> WindowEnR {
853 WindowEnR::new((self.bits & 1) != 0)
854 }
855 #[doc = "Bit 1 - Sampling Enable"]
856 #[inline(always)]
857 pub fn sample_en(&self) -> SampleEnR {
858 SampleEnR::new(((self.bits >> 1) & 1) != 0)
859 }
860 #[doc = "Bit 2 - DMA Enable"]
861 #[inline(always)]
862 pub fn dma_en(&self) -> DmaEnR {
863 DmaEnR::new(((self.bits >> 2) & 1) != 0)
864 }
865 #[doc = "Bit 3 - Comparator Invert"]
866 #[inline(always)]
867 pub fn cout_inv(&self) -> CoutInvR {
868 CoutInvR::new(((self.bits >> 3) & 1) != 0)
869 }
870 #[doc = "Bit 4 - Comparator Output Select"]
871 #[inline(always)]
872 pub fn cout_sel(&self) -> CoutSelR {
873 CoutSelR::new(((self.bits >> 4) & 1) != 0)
874 }
875 #[doc = "Bit 5 - Comparator Output Pin Enable"]
876 #[inline(always)]
877 pub fn cout_pen(&self) -> CoutPenR {
878 CoutPenR::new(((self.bits >> 5) & 1) != 0)
879 }
880 #[doc = "Bit 6 - COUTA_OW Enable"]
881 #[inline(always)]
882 pub fn couta_owen(&self) -> CoutaOwenR {
883 CoutaOwenR::new(((self.bits >> 6) & 1) != 0)
884 }
885 #[doc = "Bit 7 - COUTA Output Level for Closed Window"]
886 #[inline(always)]
887 pub fn couta_ow(&self) -> CoutaOwR {
888 CoutaOwR::new(((self.bits >> 7) & 1) != 0)
889 }
890 #[doc = "Bit 8 - WINDOW/SAMPLE Signal Invert"]
891 #[inline(always)]
892 pub fn window_inv(&self) -> WindowInvR {
893 WindowInvR::new(((self.bits >> 8) & 1) != 0)
894 }
895 #[doc = "Bit 9 - COUT Event Window Close"]
896 #[inline(always)]
897 pub fn window_cls(&self) -> WindowClsR {
898 WindowClsR::new(((self.bits >> 9) & 1) != 0)
899 }
900 #[doc = "Bits 10:11 - COUT Event Select"]
901 #[inline(always)]
902 pub fn evt_sel(&self) -> EvtSelR {
903 EvtSelR::new(((self.bits >> 10) & 3) as u8)
904 }
905 #[doc = "Bits 12:13 - Functional Clock Source Select"]
906 #[inline(always)]
907 pub fn func_clk_sel(&self) -> FuncClkSelR {
908 FuncClkSelR::new(((self.bits >> 12) & 3) as u8)
909 }
910 #[doc = "Bits 16:18 - Filter Sample Count"]
911 #[inline(always)]
912 pub fn filt_cnt(&self) -> FiltCntR {
913 FiltCntR::new(((self.bits >> 16) & 7) as u8)
914 }
915 #[doc = "Bits 24:31 - Filter Sample Period"]
916 #[inline(always)]
917 pub fn filt_per(&self) -> FiltPerR {
918 FiltPerR::new(((self.bits >> 24) & 0xff) as u8)
919 }
920}
921#[cfg(feature = "debug")]
922impl core::fmt::Debug for R {
923 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
924 f.debug_struct("CCR1")
925 .field("window_en", &self.window_en())
926 .field("sample_en", &self.sample_en())
927 .field("dma_en", &self.dma_en())
928 .field("cout_inv", &self.cout_inv())
929 .field("cout_sel", &self.cout_sel())
930 .field("cout_pen", &self.cout_pen())
931 .field("couta_owen", &self.couta_owen())
932 .field("couta_ow", &self.couta_ow())
933 .field("window_inv", &self.window_inv())
934 .field("window_cls", &self.window_cls())
935 .field("evt_sel", &self.evt_sel())
936 .field("func_clk_sel", &self.func_clk_sel())
937 .field("filt_cnt", &self.filt_cnt())
938 .field("filt_per", &self.filt_per())
939 .finish()
940 }
941}
942impl W {
943 #[doc = "Bit 0 - Windowing Enable"]
944 #[inline(always)]
945 pub fn window_en(&mut self) -> WindowEnW<'_, Ccr1Spec> {
946 WindowEnW::new(self, 0)
947 }
948 #[doc = "Bit 1 - Sampling Enable"]
949 #[inline(always)]
950 pub fn sample_en(&mut self) -> SampleEnW<'_, Ccr1Spec> {
951 SampleEnW::new(self, 1)
952 }
953 #[doc = "Bit 2 - DMA Enable"]
954 #[inline(always)]
955 pub fn dma_en(&mut self) -> DmaEnW<'_, Ccr1Spec> {
956 DmaEnW::new(self, 2)
957 }
958 #[doc = "Bit 3 - Comparator Invert"]
959 #[inline(always)]
960 pub fn cout_inv(&mut self) -> CoutInvW<'_, Ccr1Spec> {
961 CoutInvW::new(self, 3)
962 }
963 #[doc = "Bit 4 - Comparator Output Select"]
964 #[inline(always)]
965 pub fn cout_sel(&mut self) -> CoutSelW<'_, Ccr1Spec> {
966 CoutSelW::new(self, 4)
967 }
968 #[doc = "Bit 5 - Comparator Output Pin Enable"]
969 #[inline(always)]
970 pub fn cout_pen(&mut self) -> CoutPenW<'_, Ccr1Spec> {
971 CoutPenW::new(self, 5)
972 }
973 #[doc = "Bit 6 - COUTA_OW Enable"]
974 #[inline(always)]
975 pub fn couta_owen(&mut self) -> CoutaOwenW<'_, Ccr1Spec> {
976 CoutaOwenW::new(self, 6)
977 }
978 #[doc = "Bit 7 - COUTA Output Level for Closed Window"]
979 #[inline(always)]
980 pub fn couta_ow(&mut self) -> CoutaOwW<'_, Ccr1Spec> {
981 CoutaOwW::new(self, 7)
982 }
983 #[doc = "Bit 8 - WINDOW/SAMPLE Signal Invert"]
984 #[inline(always)]
985 pub fn window_inv(&mut self) -> WindowInvW<'_, Ccr1Spec> {
986 WindowInvW::new(self, 8)
987 }
988 #[doc = "Bit 9 - COUT Event Window Close"]
989 #[inline(always)]
990 pub fn window_cls(&mut self) -> WindowClsW<'_, Ccr1Spec> {
991 WindowClsW::new(self, 9)
992 }
993 #[doc = "Bits 10:11 - COUT Event Select"]
994 #[inline(always)]
995 pub fn evt_sel(&mut self) -> EvtSelW<'_, Ccr1Spec> {
996 EvtSelW::new(self, 10)
997 }
998 #[doc = "Bits 12:13 - Functional Clock Source Select"]
999 #[inline(always)]
1000 pub fn func_clk_sel(&mut self) -> FuncClkSelW<'_, Ccr1Spec> {
1001 FuncClkSelW::new(self, 12)
1002 }
1003 #[doc = "Bits 16:18 - Filter Sample Count"]
1004 #[inline(always)]
1005 pub fn filt_cnt(&mut self) -> FiltCntW<'_, Ccr1Spec> {
1006 FiltCntW::new(self, 16)
1007 }
1008 #[doc = "Bits 24:31 - Filter Sample Period"]
1009 #[inline(always)]
1010 pub fn filt_per(&mut self) -> FiltPerW<'_, Ccr1Spec> {
1011 FiltPerW::new(self, 24)
1012 }
1013}
1014#[doc = "Comparator Control Register 1\n\nYou can [`read`](crate::Reg::read) this register and get [`ccr1::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ccr1::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
1015pub struct Ccr1Spec;
1016impl crate::RegisterSpec for Ccr1Spec {
1017 type Ux = u32;
1018}
1019#[doc = "`read()` method returns [`ccr1::R`](R) reader structure"]
1020impl crate::Readable for Ccr1Spec {}
1021#[doc = "`write(|w| ..)` method takes [`ccr1::W`](W) writer structure"]
1022impl crate::Writable for Ccr1Spec {
1023 type Safety = crate::Unsafe;
1024}
1025#[doc = "`reset()` method sets CCR1 to value 0"]
1026impl crate::Resettable for Ccr1Spec {}