xmc4200/hrpwm0_csg0/
sc.rs

1#[doc = "Register `SC` reader"]
2pub type R = crate::R<SC_SPEC>;
3#[doc = "Register `SC` writer"]
4pub type W = crate::W<SC_SPEC>;
5#[doc = "Prescaler external start configuration\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum PSRM_A {
9    #[doc = "0: External start trigger is ignored"]
10    VALUE1 = 0,
11    #[doc = "1: Start prescaler"]
12    VALUE2 = 1,
13    #[doc = "2: Clear prescaler"]
14    VALUE3 = 2,
15    #[doc = "3: Clear & Start prescaler"]
16    VALUE4 = 3,
17}
18impl From<PSRM_A> for u8 {
19    #[inline(always)]
20    fn from(variant: PSRM_A) -> Self {
21        variant as _
22    }
23}
24impl crate::FieldSpec for PSRM_A {
25    type Ux = u8;
26}
27impl crate::IsEnum for PSRM_A {}
28#[doc = "Field `PSRM` reader - Prescaler external start configuration"]
29pub type PSRM_R = crate::FieldReader<PSRM_A>;
30impl PSRM_R {
31    #[doc = "Get enumerated values variant"]
32    #[inline(always)]
33    pub const fn variant(&self) -> PSRM_A {
34        match self.bits {
35            0 => PSRM_A::VALUE1,
36            1 => PSRM_A::VALUE2,
37            2 => PSRM_A::VALUE3,
38            3 => PSRM_A::VALUE4,
39            _ => unreachable!(),
40        }
41    }
42    #[doc = "External start trigger is ignored"]
43    #[inline(always)]
44    pub fn is_value1(&self) -> bool {
45        *self == PSRM_A::VALUE1
46    }
47    #[doc = "Start prescaler"]
48    #[inline(always)]
49    pub fn is_value2(&self) -> bool {
50        *self == PSRM_A::VALUE2
51    }
52    #[doc = "Clear prescaler"]
53    #[inline(always)]
54    pub fn is_value3(&self) -> bool {
55        *self == PSRM_A::VALUE3
56    }
57    #[doc = "Clear & Start prescaler"]
58    #[inline(always)]
59    pub fn is_value4(&self) -> bool {
60        *self == PSRM_A::VALUE4
61    }
62}
63#[doc = "Field `PSRM` writer - Prescaler external start configuration"]
64pub type PSRM_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PSRM_A, crate::Safe>;
65impl<'a, REG> PSRM_W<'a, REG>
66where
67    REG: crate::Writable + crate::RegisterSpec,
68    REG::Ux: From<u8>,
69{
70    #[doc = "External start trigger is ignored"]
71    #[inline(always)]
72    pub fn value1(self) -> &'a mut crate::W<REG> {
73        self.variant(PSRM_A::VALUE1)
74    }
75    #[doc = "Start prescaler"]
76    #[inline(always)]
77    pub fn value2(self) -> &'a mut crate::W<REG> {
78        self.variant(PSRM_A::VALUE2)
79    }
80    #[doc = "Clear prescaler"]
81    #[inline(always)]
82    pub fn value3(self) -> &'a mut crate::W<REG> {
83        self.variant(PSRM_A::VALUE3)
84    }
85    #[doc = "Clear & Start prescaler"]
86    #[inline(always)]
87    pub fn value4(self) -> &'a mut crate::W<REG> {
88        self.variant(PSRM_A::VALUE4)
89    }
90}
91#[doc = "Prescaler external stop configuration\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq, Eq)]
93#[repr(u8)]
94pub enum PSTM_A {
95    #[doc = "0: External stop trigger is ignored"]
96    VALUE1 = 0,
97    #[doc = "1: Stop prescaler"]
98    VALUE2 = 1,
99    #[doc = "2: Clear prescaler"]
100    VALUE3 = 2,
101    #[doc = "3: Clear & Stop prescaler"]
102    VALUE4 = 3,
103}
104impl From<PSTM_A> for u8 {
105    #[inline(always)]
106    fn from(variant: PSTM_A) -> Self {
107        variant as _
108    }
109}
110impl crate::FieldSpec for PSTM_A {
111    type Ux = u8;
112}
113impl crate::IsEnum for PSTM_A {}
114#[doc = "Field `PSTM` reader - Prescaler external stop configuration"]
115pub type PSTM_R = crate::FieldReader<PSTM_A>;
116impl PSTM_R {
117    #[doc = "Get enumerated values variant"]
118    #[inline(always)]
119    pub const fn variant(&self) -> PSTM_A {
120        match self.bits {
121            0 => PSTM_A::VALUE1,
122            1 => PSTM_A::VALUE2,
123            2 => PSTM_A::VALUE3,
124            3 => PSTM_A::VALUE4,
125            _ => unreachable!(),
126        }
127    }
128    #[doc = "External stop trigger is ignored"]
129    #[inline(always)]
130    pub fn is_value1(&self) -> bool {
131        *self == PSTM_A::VALUE1
132    }
133    #[doc = "Stop prescaler"]
134    #[inline(always)]
135    pub fn is_value2(&self) -> bool {
136        *self == PSTM_A::VALUE2
137    }
138    #[doc = "Clear prescaler"]
139    #[inline(always)]
140    pub fn is_value3(&self) -> bool {
141        *self == PSTM_A::VALUE3
142    }
143    #[doc = "Clear & Stop prescaler"]
144    #[inline(always)]
145    pub fn is_value4(&self) -> bool {
146        *self == PSTM_A::VALUE4
147    }
148}
149#[doc = "Field `PSTM` writer - Prescaler external stop configuration"]
150pub type PSTM_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PSTM_A, crate::Safe>;
151impl<'a, REG> PSTM_W<'a, REG>
152where
153    REG: crate::Writable + crate::RegisterSpec,
154    REG::Ux: From<u8>,
155{
156    #[doc = "External stop trigger is ignored"]
157    #[inline(always)]
158    pub fn value1(self) -> &'a mut crate::W<REG> {
159        self.variant(PSTM_A::VALUE1)
160    }
161    #[doc = "Stop prescaler"]
162    #[inline(always)]
163    pub fn value2(self) -> &'a mut crate::W<REG> {
164        self.variant(PSTM_A::VALUE2)
165    }
166    #[doc = "Clear prescaler"]
167    #[inline(always)]
168    pub fn value3(self) -> &'a mut crate::W<REG> {
169        self.variant(PSTM_A::VALUE3)
170    }
171    #[doc = "Clear & Stop prescaler"]
172    #[inline(always)]
173    pub fn value4(self) -> &'a mut crate::W<REG> {
174        self.variant(PSTM_A::VALUE4)
175    }
176}
177#[doc = "Fixed division disable\n\nValue on reset: 0"]
178#[derive(Clone, Copy, Debug, PartialEq, Eq)]
179pub enum FPD_A {
180    #[doc = "0: Division by 4 enabled"]
181    VALUE1 = 0,
182    #[doc = "1: Division by 4 disabled"]
183    VALUE2 = 1,
184}
185impl From<FPD_A> for bool {
186    #[inline(always)]
187    fn from(variant: FPD_A) -> Self {
188        variant as u8 != 0
189    }
190}
191#[doc = "Field `FPD` reader - Fixed division disable"]
192pub type FPD_R = crate::BitReader<FPD_A>;
193impl FPD_R {
194    #[doc = "Get enumerated values variant"]
195    #[inline(always)]
196    pub const fn variant(&self) -> FPD_A {
197        match self.bits {
198            false => FPD_A::VALUE1,
199            true => FPD_A::VALUE2,
200        }
201    }
202    #[doc = "Division by 4 enabled"]
203    #[inline(always)]
204    pub fn is_value1(&self) -> bool {
205        *self == FPD_A::VALUE1
206    }
207    #[doc = "Division by 4 disabled"]
208    #[inline(always)]
209    pub fn is_value2(&self) -> bool {
210        *self == FPD_A::VALUE2
211    }
212}
213#[doc = "Field `FPD` writer - Fixed division disable"]
214pub type FPD_W<'a, REG> = crate::BitWriter<'a, REG, FPD_A>;
215impl<'a, REG> FPD_W<'a, REG>
216where
217    REG: crate::Writable + crate::RegisterSpec,
218{
219    #[doc = "Division by 4 enabled"]
220    #[inline(always)]
221    pub fn value1(self) -> &'a mut crate::W<REG> {
222        self.variant(FPD_A::VALUE1)
223    }
224    #[doc = "Division by 4 disabled"]
225    #[inline(always)]
226    pub fn value2(self) -> &'a mut crate::W<REG> {
227        self.variant(FPD_A::VALUE2)
228    }
229}
230#[doc = "Prescaler division factor\n\nValue on reset: 0"]
231#[derive(Clone, Copy, Debug, PartialEq, Eq)]
232#[repr(u8)]
233pub enum PSV_A {
234    #[doc = "0: division by 1"]
235    VALUE1 = 0,
236    #[doc = "1: division by 2"]
237    VALUE2 = 1,
238    #[doc = "2: division by 4"]
239    VALUE3 = 2,
240    #[doc = "3: division by 8"]
241    VALUE4 = 3,
242}
243impl From<PSV_A> for u8 {
244    #[inline(always)]
245    fn from(variant: PSV_A) -> Self {
246        variant as _
247    }
248}
249impl crate::FieldSpec for PSV_A {
250    type Ux = u8;
251}
252impl crate::IsEnum for PSV_A {}
253#[doc = "Field `PSV` reader - Prescaler division factor"]
254pub type PSV_R = crate::FieldReader<PSV_A>;
255impl PSV_R {
256    #[doc = "Get enumerated values variant"]
257    #[inline(always)]
258    pub const fn variant(&self) -> PSV_A {
259        match self.bits {
260            0 => PSV_A::VALUE1,
261            1 => PSV_A::VALUE2,
262            2 => PSV_A::VALUE3,
263            3 => PSV_A::VALUE4,
264            _ => unreachable!(),
265        }
266    }
267    #[doc = "division by 1"]
268    #[inline(always)]
269    pub fn is_value1(&self) -> bool {
270        *self == PSV_A::VALUE1
271    }
272    #[doc = "division by 2"]
273    #[inline(always)]
274    pub fn is_value2(&self) -> bool {
275        *self == PSV_A::VALUE2
276    }
277    #[doc = "division by 4"]
278    #[inline(always)]
279    pub fn is_value3(&self) -> bool {
280        *self == PSV_A::VALUE3
281    }
282    #[doc = "division by 8"]
283    #[inline(always)]
284    pub fn is_value4(&self) -> bool {
285        *self == PSV_A::VALUE4
286    }
287}
288#[doc = "Field `PSV` writer - Prescaler division factor"]
289pub type PSV_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PSV_A, crate::Safe>;
290impl<'a, REG> PSV_W<'a, REG>
291where
292    REG: crate::Writable + crate::RegisterSpec,
293    REG::Ux: From<u8>,
294{
295    #[doc = "division by 1"]
296    #[inline(always)]
297    pub fn value1(self) -> &'a mut crate::W<REG> {
298        self.variant(PSV_A::VALUE1)
299    }
300    #[doc = "division by 2"]
301    #[inline(always)]
302    pub fn value2(self) -> &'a mut crate::W<REG> {
303        self.variant(PSV_A::VALUE2)
304    }
305    #[doc = "division by 4"]
306    #[inline(always)]
307    pub fn value3(self) -> &'a mut crate::W<REG> {
308        self.variant(PSV_A::VALUE3)
309    }
310    #[doc = "division by 8"]
311    #[inline(always)]
312    pub fn value4(self) -> &'a mut crate::W<REG> {
313        self.variant(PSV_A::VALUE4)
314    }
315}
316#[doc = "Slope control mode\n\nValue on reset: 0"]
317#[derive(Clone, Copy, Debug, PartialEq, Eq)]
318#[repr(u8)]
319pub enum SCM_A {
320    #[doc = "0: Slope generation disabled. Used when the switch between the two reference values, CSGyDSV1This register contains the actual value used for the DSV1 reference. and CSGyDSV2This register contains the actual value used for the DSV2 reference. is done via external signal."]
321    VALUE1 = 0,
322    #[doc = "1: Decrementing slope generation."]
323    VALUE2 = 1,
324    #[doc = "2: Incrementing slope generation."]
325    VALUE3 = 2,
326    #[doc = "3: Triangular slope generation."]
327    VALUE4 = 3,
328}
329impl From<SCM_A> for u8 {
330    #[inline(always)]
331    fn from(variant: SCM_A) -> Self {
332        variant as _
333    }
334}
335impl crate::FieldSpec for SCM_A {
336    type Ux = u8;
337}
338impl crate::IsEnum for SCM_A {}
339#[doc = "Field `SCM` reader - Slope control mode"]
340pub type SCM_R = crate::FieldReader<SCM_A>;
341impl SCM_R {
342    #[doc = "Get enumerated values variant"]
343    #[inline(always)]
344    pub const fn variant(&self) -> SCM_A {
345        match self.bits {
346            0 => SCM_A::VALUE1,
347            1 => SCM_A::VALUE2,
348            2 => SCM_A::VALUE3,
349            3 => SCM_A::VALUE4,
350            _ => unreachable!(),
351        }
352    }
353    #[doc = "Slope generation disabled. Used when the switch between the two reference values, CSGyDSV1This register contains the actual value used for the DSV1 reference. and CSGyDSV2This register contains the actual value used for the DSV2 reference. is done via external signal."]
354    #[inline(always)]
355    pub fn is_value1(&self) -> bool {
356        *self == SCM_A::VALUE1
357    }
358    #[doc = "Decrementing slope generation."]
359    #[inline(always)]
360    pub fn is_value2(&self) -> bool {
361        *self == SCM_A::VALUE2
362    }
363    #[doc = "Incrementing slope generation."]
364    #[inline(always)]
365    pub fn is_value3(&self) -> bool {
366        *self == SCM_A::VALUE3
367    }
368    #[doc = "Triangular slope generation."]
369    #[inline(always)]
370    pub fn is_value4(&self) -> bool {
371        *self == SCM_A::VALUE4
372    }
373}
374#[doc = "Field `SCM` writer - Slope control mode"]
375pub type SCM_W<'a, REG> = crate::FieldWriter<'a, REG, 2, SCM_A, crate::Safe>;
376impl<'a, REG> SCM_W<'a, REG>
377where
378    REG: crate::Writable + crate::RegisterSpec,
379    REG::Ux: From<u8>,
380{
381    #[doc = "Slope generation disabled. Used when the switch between the two reference values, CSGyDSV1This register contains the actual value used for the DSV1 reference. and CSGyDSV2This register contains the actual value used for the DSV2 reference. is done via external signal."]
382    #[inline(always)]
383    pub fn value1(self) -> &'a mut crate::W<REG> {
384        self.variant(SCM_A::VALUE1)
385    }
386    #[doc = "Decrementing slope generation."]
387    #[inline(always)]
388    pub fn value2(self) -> &'a mut crate::W<REG> {
389        self.variant(SCM_A::VALUE2)
390    }
391    #[doc = "Incrementing slope generation."]
392    #[inline(always)]
393    pub fn value3(self) -> &'a mut crate::W<REG> {
394        self.variant(SCM_A::VALUE3)
395    }
396    #[doc = "Triangular slope generation."]
397    #[inline(always)]
398    pub fn value4(self) -> &'a mut crate::W<REG> {
399        self.variant(SCM_A::VALUE4)
400    }
401}
402#[doc = "Slope external start configuration\n\nValue on reset: 0"]
403#[derive(Clone, Copy, Debug, PartialEq, Eq)]
404#[repr(u8)]
405pub enum SSRM_A {
406    #[doc = "0: External start trigger is ignored"]
407    VALUE1 = 0,
408    #[doc = "1: Start/restart slope generation"]
409    VALUE2 = 1,
410    #[doc = "2: Resumes slope"]
411    VALUE3 = 2,
412}
413impl From<SSRM_A> for u8 {
414    #[inline(always)]
415    fn from(variant: SSRM_A) -> Self {
416        variant as _
417    }
418}
419impl crate::FieldSpec for SSRM_A {
420    type Ux = u8;
421}
422impl crate::IsEnum for SSRM_A {}
423#[doc = "Field `SSRM` reader - Slope external start configuration"]
424pub type SSRM_R = crate::FieldReader<SSRM_A>;
425impl SSRM_R {
426    #[doc = "Get enumerated values variant"]
427    #[inline(always)]
428    pub const fn variant(&self) -> Option<SSRM_A> {
429        match self.bits {
430            0 => Some(SSRM_A::VALUE1),
431            1 => Some(SSRM_A::VALUE2),
432            2 => Some(SSRM_A::VALUE3),
433            _ => None,
434        }
435    }
436    #[doc = "External start trigger is ignored"]
437    #[inline(always)]
438    pub fn is_value1(&self) -> bool {
439        *self == SSRM_A::VALUE1
440    }
441    #[doc = "Start/restart slope generation"]
442    #[inline(always)]
443    pub fn is_value2(&self) -> bool {
444        *self == SSRM_A::VALUE2
445    }
446    #[doc = "Resumes slope"]
447    #[inline(always)]
448    pub fn is_value3(&self) -> bool {
449        *self == SSRM_A::VALUE3
450    }
451}
452#[doc = "Field `SSRM` writer - Slope external start configuration"]
453pub type SSRM_W<'a, REG> = crate::FieldWriter<'a, REG, 2, SSRM_A>;
454impl<'a, REG> SSRM_W<'a, REG>
455where
456    REG: crate::Writable + crate::RegisterSpec,
457    REG::Ux: From<u8>,
458{
459    #[doc = "External start trigger is ignored"]
460    #[inline(always)]
461    pub fn value1(self) -> &'a mut crate::W<REG> {
462        self.variant(SSRM_A::VALUE1)
463    }
464    #[doc = "Start/restart slope generation"]
465    #[inline(always)]
466    pub fn value2(self) -> &'a mut crate::W<REG> {
467        self.variant(SSRM_A::VALUE2)
468    }
469    #[doc = "Resumes slope"]
470    #[inline(always)]
471    pub fn value3(self) -> &'a mut crate::W<REG> {
472        self.variant(SSRM_A::VALUE3)
473    }
474}
475#[doc = "Slope external stop configuration\n\nValue on reset: 0"]
476#[derive(Clone, Copy, Debug, PartialEq, Eq)]
477#[repr(u8)]
478pub enum SSTM_A {
479    #[doc = "0: External stop trigger is ignored"]
480    VALUE1 = 0,
481    #[doc = "1: Stops/Halts the slope generation"]
482    VALUE2 = 1,
483    #[doc = "2: Used in hybrid mode. It freezes the slope generation and feeds constantly the value programmed in CSGyDSV2This register contains the actual value used for the DSV2 reference. to the DAC."]
484    VALUE3 = 2,
485}
486impl From<SSTM_A> for u8 {
487    #[inline(always)]
488    fn from(variant: SSTM_A) -> Self {
489        variant as _
490    }
491}
492impl crate::FieldSpec for SSTM_A {
493    type Ux = u8;
494}
495impl crate::IsEnum for SSTM_A {}
496#[doc = "Field `SSTM` reader - Slope external stop configuration"]
497pub type SSTM_R = crate::FieldReader<SSTM_A>;
498impl SSTM_R {
499    #[doc = "Get enumerated values variant"]
500    #[inline(always)]
501    pub const fn variant(&self) -> Option<SSTM_A> {
502        match self.bits {
503            0 => Some(SSTM_A::VALUE1),
504            1 => Some(SSTM_A::VALUE2),
505            2 => Some(SSTM_A::VALUE3),
506            _ => None,
507        }
508    }
509    #[doc = "External stop trigger is ignored"]
510    #[inline(always)]
511    pub fn is_value1(&self) -> bool {
512        *self == SSTM_A::VALUE1
513    }
514    #[doc = "Stops/Halts the slope generation"]
515    #[inline(always)]
516    pub fn is_value2(&self) -> bool {
517        *self == SSTM_A::VALUE2
518    }
519    #[doc = "Used in hybrid mode. It freezes the slope generation and feeds constantly the value programmed in CSGyDSV2This register contains the actual value used for the DSV2 reference. to the DAC."]
520    #[inline(always)]
521    pub fn is_value3(&self) -> bool {
522        *self == SSTM_A::VALUE3
523    }
524}
525#[doc = "Field `SSTM` writer - Slope external stop configuration"]
526pub type SSTM_W<'a, REG> = crate::FieldWriter<'a, REG, 2, SSTM_A>;
527impl<'a, REG> SSTM_W<'a, REG>
528where
529    REG: crate::Writable + crate::RegisterSpec,
530    REG::Ux: From<u8>,
531{
532    #[doc = "External stop trigger is ignored"]
533    #[inline(always)]
534    pub fn value1(self) -> &'a mut crate::W<REG> {
535        self.variant(SSTM_A::VALUE1)
536    }
537    #[doc = "Stops/Halts the slope generation"]
538    #[inline(always)]
539    pub fn value2(self) -> &'a mut crate::W<REG> {
540        self.variant(SSTM_A::VALUE2)
541    }
542    #[doc = "Used in hybrid mode. It freezes the slope generation and feeds constantly the value programmed in CSGyDSV2This register contains the actual value used for the DSV2 reference. to the DAC."]
543    #[inline(always)]
544    pub fn value3(self) -> &'a mut crate::W<REG> {
545        self.variant(SSTM_A::VALUE3)
546    }
547}
548#[doc = "Slope reference value mode\n\nValue on reset: 0"]
549#[derive(Clone, Copy, Debug, PartialEq, Eq)]
550#[repr(u8)]
551pub enum SVSC_A {
552    #[doc = "0: Only CSGyDSV1This register contains the actual value used for the DSV1 reference. value is used for the slope generation: if slope is incrementing, CSGyDSV1This register contains the actual value used for the DSV1 reference. is the bottom reference value from where the ramp starts; if decrementing, then CSGyDSV1This register contains the actual value used for the DSV1 reference. is the upper reference value from where the ramp starts."]
553    VALUE1 = 0,
554    #[doc = "1: The two reference values are being used: CSGyDSV1This register contains the actual value used for the DSV1 reference. is the low or high reference value from where the ramp starts (incrementing or decrementing respectively); CSGyDSV2This register contains the actual value used for the DSV2 reference. is used as a static value (this value is constantly fed to the DAC after a stop trigger as been detected)."]
555    VALUE2 = 1,
556    #[doc = "2: The two reference values are used: CSGyDSV1This register contains the actual value used for the DSV1 reference. is the low or high reference value from where the slope starts (incrementing or decrementing respectively); CSGyDSV2This register contains the actual value used for the DSV2 reference. is used as an internal re start condition for the slope."]
557    VALUE3 = 2,
558}
559impl From<SVSC_A> for u8 {
560    #[inline(always)]
561    fn from(variant: SVSC_A) -> Self {
562        variant as _
563    }
564}
565impl crate::FieldSpec for SVSC_A {
566    type Ux = u8;
567}
568impl crate::IsEnum for SVSC_A {}
569#[doc = "Field `SVSC` reader - Slope reference value mode"]
570pub type SVSC_R = crate::FieldReader<SVSC_A>;
571impl SVSC_R {
572    #[doc = "Get enumerated values variant"]
573    #[inline(always)]
574    pub const fn variant(&self) -> Option<SVSC_A> {
575        match self.bits {
576            0 => Some(SVSC_A::VALUE1),
577            1 => Some(SVSC_A::VALUE2),
578            2 => Some(SVSC_A::VALUE3),
579            _ => None,
580        }
581    }
582    #[doc = "Only CSGyDSV1This register contains the actual value used for the DSV1 reference. value is used for the slope generation: if slope is incrementing, CSGyDSV1This register contains the actual value used for the DSV1 reference. is the bottom reference value from where the ramp starts; if decrementing, then CSGyDSV1This register contains the actual value used for the DSV1 reference. is the upper reference value from where the ramp starts."]
583    #[inline(always)]
584    pub fn is_value1(&self) -> bool {
585        *self == SVSC_A::VALUE1
586    }
587    #[doc = "The two reference values are being used: CSGyDSV1This register contains the actual value used for the DSV1 reference. is the low or high reference value from where the ramp starts (incrementing or decrementing respectively); CSGyDSV2This register contains the actual value used for the DSV2 reference. is used as a static value (this value is constantly fed to the DAC after a stop trigger as been detected)."]
588    #[inline(always)]
589    pub fn is_value2(&self) -> bool {
590        *self == SVSC_A::VALUE2
591    }
592    #[doc = "The two reference values are used: CSGyDSV1This register contains the actual value used for the DSV1 reference. is the low or high reference value from where the slope starts (incrementing or decrementing respectively); CSGyDSV2This register contains the actual value used for the DSV2 reference. is used as an internal re start condition for the slope."]
593    #[inline(always)]
594    pub fn is_value3(&self) -> bool {
595        *self == SVSC_A::VALUE3
596    }
597}
598#[doc = "Field `SVSC` writer - Slope reference value mode"]
599pub type SVSC_W<'a, REG> = crate::FieldWriter<'a, REG, 2, SVSC_A>;
600impl<'a, REG> SVSC_W<'a, REG>
601where
602    REG: crate::Writable + crate::RegisterSpec,
603    REG::Ux: From<u8>,
604{
605    #[doc = "Only CSGyDSV1This register contains the actual value used for the DSV1 reference. value is used for the slope generation: if slope is incrementing, CSGyDSV1This register contains the actual value used for the DSV1 reference. is the bottom reference value from where the ramp starts; if decrementing, then CSGyDSV1This register contains the actual value used for the DSV1 reference. is the upper reference value from where the ramp starts."]
606    #[inline(always)]
607    pub fn value1(self) -> &'a mut crate::W<REG> {
608        self.variant(SVSC_A::VALUE1)
609    }
610    #[doc = "The two reference values are being used: CSGyDSV1This register contains the actual value used for the DSV1 reference. is the low or high reference value from where the ramp starts (incrementing or decrementing respectively); CSGyDSV2This register contains the actual value used for the DSV2 reference. is used as a static value (this value is constantly fed to the DAC after a stop trigger as been detected)."]
611    #[inline(always)]
612    pub fn value2(self) -> &'a mut crate::W<REG> {
613        self.variant(SVSC_A::VALUE2)
614    }
615    #[doc = "The two reference values are used: CSGyDSV1This register contains the actual value used for the DSV1 reference. is the low or high reference value from where the slope starts (incrementing or decrementing respectively); CSGyDSV2This register contains the actual value used for the DSV2 reference. is used as an internal re start condition for the slope."]
616    #[inline(always)]
617    pub fn value3(self) -> &'a mut crate::W<REG> {
618        self.variant(SVSC_A::VALUE3)
619    }
620}
621#[doc = "Initial DAC start mode\n\nValue on reset: 0"]
622#[derive(Clone, Copy, Debug, PartialEq, Eq)]
623#[repr(u8)]
624pub enum SWSM_A {
625    #[doc = "0: CSGyDSV2This register contains the actual value used for the DSV2 reference. is fed to the DAC and initial conversion trigger is generated."]
626    VALUE1 = 0,
627    #[doc = "1: CSGyDSV1This register contains the actual value used for the DSV1 reference. is fed to the DAC and initial conversion trigger is generated."]
628    VALUE2 = 1,
629    #[doc = "2: CSGyDSV2This register contains the actual value used for the DSV2 reference. is fed to the DAC but initial conversion trigger is not generated."]
630    VALUE3 = 2,
631    #[doc = "3: CSGyDSV1This register contains the actual value used for the DSV1 reference. is fed to the DAC but initial conversion trigger is not generated."]
632    VALUE4 = 3,
633}
634impl From<SWSM_A> for u8 {
635    #[inline(always)]
636    fn from(variant: SWSM_A) -> Self {
637        variant as _
638    }
639}
640impl crate::FieldSpec for SWSM_A {
641    type Ux = u8;
642}
643impl crate::IsEnum for SWSM_A {}
644#[doc = "Field `SWSM` reader - Initial DAC start mode"]
645pub type SWSM_R = crate::FieldReader<SWSM_A>;
646impl SWSM_R {
647    #[doc = "Get enumerated values variant"]
648    #[inline(always)]
649    pub const fn variant(&self) -> SWSM_A {
650        match self.bits {
651            0 => SWSM_A::VALUE1,
652            1 => SWSM_A::VALUE2,
653            2 => SWSM_A::VALUE3,
654            3 => SWSM_A::VALUE4,
655            _ => unreachable!(),
656        }
657    }
658    #[doc = "CSGyDSV2This register contains the actual value used for the DSV2 reference. is fed to the DAC and initial conversion trigger is generated."]
659    #[inline(always)]
660    pub fn is_value1(&self) -> bool {
661        *self == SWSM_A::VALUE1
662    }
663    #[doc = "CSGyDSV1This register contains the actual value used for the DSV1 reference. is fed to the DAC and initial conversion trigger is generated."]
664    #[inline(always)]
665    pub fn is_value2(&self) -> bool {
666        *self == SWSM_A::VALUE2
667    }
668    #[doc = "CSGyDSV2This register contains the actual value used for the DSV2 reference. is fed to the DAC but initial conversion trigger is not generated."]
669    #[inline(always)]
670    pub fn is_value3(&self) -> bool {
671        *self == SWSM_A::VALUE3
672    }
673    #[doc = "CSGyDSV1This register contains the actual value used for the DSV1 reference. is fed to the DAC but initial conversion trigger is not generated."]
674    #[inline(always)]
675    pub fn is_value4(&self) -> bool {
676        *self == SWSM_A::VALUE4
677    }
678}
679#[doc = "Field `SWSM` writer - Initial DAC start mode"]
680pub type SWSM_W<'a, REG> = crate::FieldWriter<'a, REG, 2, SWSM_A, crate::Safe>;
681impl<'a, REG> SWSM_W<'a, REG>
682where
683    REG: crate::Writable + crate::RegisterSpec,
684    REG::Ux: From<u8>,
685{
686    #[doc = "CSGyDSV2This register contains the actual value used for the DSV2 reference. is fed to the DAC and initial conversion trigger is generated."]
687    #[inline(always)]
688    pub fn value1(self) -> &'a mut crate::W<REG> {
689        self.variant(SWSM_A::VALUE1)
690    }
691    #[doc = "CSGyDSV1This register contains the actual value used for the DSV1 reference. is fed to the DAC and initial conversion trigger is generated."]
692    #[inline(always)]
693    pub fn value2(self) -> &'a mut crate::W<REG> {
694        self.variant(SWSM_A::VALUE2)
695    }
696    #[doc = "CSGyDSV2This register contains the actual value used for the DSV2 reference. is fed to the DAC but initial conversion trigger is not generated."]
697    #[inline(always)]
698    pub fn value3(self) -> &'a mut crate::W<REG> {
699        self.variant(SWSM_A::VALUE3)
700    }
701    #[doc = "CSGyDSV1This register contains the actual value used for the DSV1 reference. is fed to the DAC but initial conversion trigger is not generated."]
702    #[inline(always)]
703    pub fn value4(self) -> &'a mut crate::W<REG> {
704        self.variant(SWSM_A::VALUE4)
705    }
706}
707#[doc = "Slope step gain configuration\n\nValue on reset: 0"]
708#[derive(Clone, Copy, Debug, PartialEq, Eq)]
709#[repr(u8)]
710pub enum GCFG_A {
711    #[doc = "0: Each slope step has an increment/decrement of 1"]
712    VALUE1 = 0,
713    #[doc = "1: Each slope step has an increment/decrement of 2"]
714    VALUE2 = 1,
715    #[doc = "2: Each slope step has an increment/decrement of 4"]
716    VALUE3 = 2,
717    #[doc = "3: Each slope step has an increment/decrement of 8"]
718    VALUE4 = 3,
719}
720impl From<GCFG_A> for u8 {
721    #[inline(always)]
722    fn from(variant: GCFG_A) -> Self {
723        variant as _
724    }
725}
726impl crate::FieldSpec for GCFG_A {
727    type Ux = u8;
728}
729impl crate::IsEnum for GCFG_A {}
730#[doc = "Field `GCFG` reader - Slope step gain configuration"]
731pub type GCFG_R = crate::FieldReader<GCFG_A>;
732impl GCFG_R {
733    #[doc = "Get enumerated values variant"]
734    #[inline(always)]
735    pub const fn variant(&self) -> GCFG_A {
736        match self.bits {
737            0 => GCFG_A::VALUE1,
738            1 => GCFG_A::VALUE2,
739            2 => GCFG_A::VALUE3,
740            3 => GCFG_A::VALUE4,
741            _ => unreachable!(),
742        }
743    }
744    #[doc = "Each slope step has an increment/decrement of 1"]
745    #[inline(always)]
746    pub fn is_value1(&self) -> bool {
747        *self == GCFG_A::VALUE1
748    }
749    #[doc = "Each slope step has an increment/decrement of 2"]
750    #[inline(always)]
751    pub fn is_value2(&self) -> bool {
752        *self == GCFG_A::VALUE2
753    }
754    #[doc = "Each slope step has an increment/decrement of 4"]
755    #[inline(always)]
756    pub fn is_value3(&self) -> bool {
757        *self == GCFG_A::VALUE3
758    }
759    #[doc = "Each slope step has an increment/decrement of 8"]
760    #[inline(always)]
761    pub fn is_value4(&self) -> bool {
762        *self == GCFG_A::VALUE4
763    }
764}
765#[doc = "Field `GCFG` writer - Slope step gain configuration"]
766pub type GCFG_W<'a, REG> = crate::FieldWriter<'a, REG, 2, GCFG_A, crate::Safe>;
767impl<'a, REG> GCFG_W<'a, REG>
768where
769    REG: crate::Writable + crate::RegisterSpec,
770    REG::Ux: From<u8>,
771{
772    #[doc = "Each slope step has an increment/decrement of 1"]
773    #[inline(always)]
774    pub fn value1(self) -> &'a mut crate::W<REG> {
775        self.variant(GCFG_A::VALUE1)
776    }
777    #[doc = "Each slope step has an increment/decrement of 2"]
778    #[inline(always)]
779    pub fn value2(self) -> &'a mut crate::W<REG> {
780        self.variant(GCFG_A::VALUE2)
781    }
782    #[doc = "Each slope step has an increment/decrement of 4"]
783    #[inline(always)]
784    pub fn value3(self) -> &'a mut crate::W<REG> {
785        self.variant(GCFG_A::VALUE3)
786    }
787    #[doc = "Each slope step has an increment/decrement of 8"]
788    #[inline(always)]
789    pub fn value4(self) -> &'a mut crate::W<REG> {
790        self.variant(GCFG_A::VALUE4)
791    }
792}
793#[doc = "Field `IST` reader - Immediate shadow transfer"]
794pub type IST_R = crate::BitReader;
795#[doc = "Field `IST` writer - Immediate shadow transfer"]
796pub type IST_W<'a, REG> = crate::BitWriter<'a, REG>;
797#[doc = "Pulse swallow enable\n\nValue on reset: 0"]
798#[derive(Clone, Copy, Debug, PartialEq, Eq)]
799pub enum PSE_A {
800    #[doc = "0: Pulse swallow disabled"]
801    VALUE1 = 0,
802    #[doc = "1: Pulse swallow enabled"]
803    VALUE2 = 1,
804}
805impl From<PSE_A> for bool {
806    #[inline(always)]
807    fn from(variant: PSE_A) -> Self {
808        variant as u8 != 0
809    }
810}
811#[doc = "Field `PSE` reader - Pulse swallow enable"]
812pub type PSE_R = crate::BitReader<PSE_A>;
813impl PSE_R {
814    #[doc = "Get enumerated values variant"]
815    #[inline(always)]
816    pub const fn variant(&self) -> PSE_A {
817        match self.bits {
818            false => PSE_A::VALUE1,
819            true => PSE_A::VALUE2,
820        }
821    }
822    #[doc = "Pulse swallow disabled"]
823    #[inline(always)]
824    pub fn is_value1(&self) -> bool {
825        *self == PSE_A::VALUE1
826    }
827    #[doc = "Pulse swallow enabled"]
828    #[inline(always)]
829    pub fn is_value2(&self) -> bool {
830        *self == PSE_A::VALUE2
831    }
832}
833#[doc = "Field `PSE` writer - Pulse swallow enable"]
834pub type PSE_W<'a, REG> = crate::BitWriter<'a, REG, PSE_A>;
835impl<'a, REG> PSE_W<'a, REG>
836where
837    REG: crate::Writable + crate::RegisterSpec,
838{
839    #[doc = "Pulse swallow disabled"]
840    #[inline(always)]
841    pub fn value1(self) -> &'a mut crate::W<REG> {
842        self.variant(PSE_A::VALUE1)
843    }
844    #[doc = "Pulse swallow enabled"]
845    #[inline(always)]
846    pub fn value2(self) -> &'a mut crate::W<REG> {
847        self.variant(PSE_A::VALUE2)
848    }
849}
850#[doc = "Pulse swallow window mode\n\nValue on reset: 0"]
851#[derive(Clone, Copy, Debug, PartialEq, Eq)]
852#[repr(u8)]
853pub enum PSWM_A {
854    #[doc = "0: 16 clock cycle window"]
855    VALUE1 = 0,
856    #[doc = "1: 32 clock cycle window"]
857    VALUE2 = 1,
858    #[doc = "2: 64 clock cycle window"]
859    VALUE3 = 2,
860}
861impl From<PSWM_A> for u8 {
862    #[inline(always)]
863    fn from(variant: PSWM_A) -> Self {
864        variant as _
865    }
866}
867impl crate::FieldSpec for PSWM_A {
868    type Ux = u8;
869}
870impl crate::IsEnum for PSWM_A {}
871#[doc = "Field `PSWM` reader - Pulse swallow window mode"]
872pub type PSWM_R = crate::FieldReader<PSWM_A>;
873impl PSWM_R {
874    #[doc = "Get enumerated values variant"]
875    #[inline(always)]
876    pub const fn variant(&self) -> Option<PSWM_A> {
877        match self.bits {
878            0 => Some(PSWM_A::VALUE1),
879            1 => Some(PSWM_A::VALUE2),
880            2 => Some(PSWM_A::VALUE3),
881            _ => None,
882        }
883    }
884    #[doc = "16 clock cycle window"]
885    #[inline(always)]
886    pub fn is_value1(&self) -> bool {
887        *self == PSWM_A::VALUE1
888    }
889    #[doc = "32 clock cycle window"]
890    #[inline(always)]
891    pub fn is_value2(&self) -> bool {
892        *self == PSWM_A::VALUE2
893    }
894    #[doc = "64 clock cycle window"]
895    #[inline(always)]
896    pub fn is_value3(&self) -> bool {
897        *self == PSWM_A::VALUE3
898    }
899}
900#[doc = "Field `PSWM` writer - Pulse swallow window mode"]
901pub type PSWM_W<'a, REG> = crate::FieldWriter<'a, REG, 2, PSWM_A>;
902impl<'a, REG> PSWM_W<'a, REG>
903where
904    REG: crate::Writable + crate::RegisterSpec,
905    REG::Ux: From<u8>,
906{
907    #[doc = "16 clock cycle window"]
908    #[inline(always)]
909    pub fn value1(self) -> &'a mut crate::W<REG> {
910        self.variant(PSWM_A::VALUE1)
911    }
912    #[doc = "32 clock cycle window"]
913    #[inline(always)]
914    pub fn value2(self) -> &'a mut crate::W<REG> {
915        self.variant(PSWM_A::VALUE2)
916    }
917    #[doc = "64 clock cycle window"]
918    #[inline(always)]
919    pub fn value3(self) -> &'a mut crate::W<REG> {
920        self.variant(PSWM_A::VALUE3)
921    }
922}
923impl R {
924    #[doc = "Bits 0:1 - Prescaler external start configuration"]
925    #[inline(always)]
926    pub fn psrm(&self) -> PSRM_R {
927        PSRM_R::new((self.bits & 3) as u8)
928    }
929    #[doc = "Bits 2:3 - Prescaler external stop configuration"]
930    #[inline(always)]
931    pub fn pstm(&self) -> PSTM_R {
932        PSTM_R::new(((self.bits >> 2) & 3) as u8)
933    }
934    #[doc = "Bit 4 - Fixed division disable"]
935    #[inline(always)]
936    pub fn fpd(&self) -> FPD_R {
937        FPD_R::new(((self.bits >> 4) & 1) != 0)
938    }
939    #[doc = "Bits 5:6 - Prescaler division factor"]
940    #[inline(always)]
941    pub fn psv(&self) -> PSV_R {
942        PSV_R::new(((self.bits >> 5) & 3) as u8)
943    }
944    #[doc = "Bits 8:9 - Slope control mode"]
945    #[inline(always)]
946    pub fn scm(&self) -> SCM_R {
947        SCM_R::new(((self.bits >> 8) & 3) as u8)
948    }
949    #[doc = "Bits 10:11 - Slope external start configuration"]
950    #[inline(always)]
951    pub fn ssrm(&self) -> SSRM_R {
952        SSRM_R::new(((self.bits >> 10) & 3) as u8)
953    }
954    #[doc = "Bits 12:13 - Slope external stop configuration"]
955    #[inline(always)]
956    pub fn sstm(&self) -> SSTM_R {
957        SSTM_R::new(((self.bits >> 12) & 3) as u8)
958    }
959    #[doc = "Bits 14:15 - Slope reference value mode"]
960    #[inline(always)]
961    pub fn svsc(&self) -> SVSC_R {
962        SVSC_R::new(((self.bits >> 14) & 3) as u8)
963    }
964    #[doc = "Bits 16:17 - Initial DAC start mode"]
965    #[inline(always)]
966    pub fn swsm(&self) -> SWSM_R {
967        SWSM_R::new(((self.bits >> 16) & 3) as u8)
968    }
969    #[doc = "Bits 18:19 - Slope step gain configuration"]
970    #[inline(always)]
971    pub fn gcfg(&self) -> GCFG_R {
972        GCFG_R::new(((self.bits >> 18) & 3) as u8)
973    }
974    #[doc = "Bit 20 - Immediate shadow transfer"]
975    #[inline(always)]
976    pub fn ist(&self) -> IST_R {
977        IST_R::new(((self.bits >> 20) & 1) != 0)
978    }
979    #[doc = "Bit 21 - Pulse swallow enable"]
980    #[inline(always)]
981    pub fn pse(&self) -> PSE_R {
982        PSE_R::new(((self.bits >> 21) & 1) != 0)
983    }
984    #[doc = "Bits 24:25 - Pulse swallow window mode"]
985    #[inline(always)]
986    pub fn pswm(&self) -> PSWM_R {
987        PSWM_R::new(((self.bits >> 24) & 3) as u8)
988    }
989}
990impl W {
991    #[doc = "Bits 0:1 - Prescaler external start configuration"]
992    #[inline(always)]
993    pub fn psrm(&mut self) -> PSRM_W<SC_SPEC> {
994        PSRM_W::new(self, 0)
995    }
996    #[doc = "Bits 2:3 - Prescaler external stop configuration"]
997    #[inline(always)]
998    pub fn pstm(&mut self) -> PSTM_W<SC_SPEC> {
999        PSTM_W::new(self, 2)
1000    }
1001    #[doc = "Bit 4 - Fixed division disable"]
1002    #[inline(always)]
1003    pub fn fpd(&mut self) -> FPD_W<SC_SPEC> {
1004        FPD_W::new(self, 4)
1005    }
1006    #[doc = "Bits 5:6 - Prescaler division factor"]
1007    #[inline(always)]
1008    pub fn psv(&mut self) -> PSV_W<SC_SPEC> {
1009        PSV_W::new(self, 5)
1010    }
1011    #[doc = "Bits 8:9 - Slope control mode"]
1012    #[inline(always)]
1013    pub fn scm(&mut self) -> SCM_W<SC_SPEC> {
1014        SCM_W::new(self, 8)
1015    }
1016    #[doc = "Bits 10:11 - Slope external start configuration"]
1017    #[inline(always)]
1018    pub fn ssrm(&mut self) -> SSRM_W<SC_SPEC> {
1019        SSRM_W::new(self, 10)
1020    }
1021    #[doc = "Bits 12:13 - Slope external stop configuration"]
1022    #[inline(always)]
1023    pub fn sstm(&mut self) -> SSTM_W<SC_SPEC> {
1024        SSTM_W::new(self, 12)
1025    }
1026    #[doc = "Bits 14:15 - Slope reference value mode"]
1027    #[inline(always)]
1028    pub fn svsc(&mut self) -> SVSC_W<SC_SPEC> {
1029        SVSC_W::new(self, 14)
1030    }
1031    #[doc = "Bits 16:17 - Initial DAC start mode"]
1032    #[inline(always)]
1033    pub fn swsm(&mut self) -> SWSM_W<SC_SPEC> {
1034        SWSM_W::new(self, 16)
1035    }
1036    #[doc = "Bits 18:19 - Slope step gain configuration"]
1037    #[inline(always)]
1038    pub fn gcfg(&mut self) -> GCFG_W<SC_SPEC> {
1039        GCFG_W::new(self, 18)
1040    }
1041    #[doc = "Bit 20 - Immediate shadow transfer"]
1042    #[inline(always)]
1043    pub fn ist(&mut self) -> IST_W<SC_SPEC> {
1044        IST_W::new(self, 20)
1045    }
1046    #[doc = "Bit 21 - Pulse swallow enable"]
1047    #[inline(always)]
1048    pub fn pse(&mut self) -> PSE_W<SC_SPEC> {
1049        PSE_W::new(self, 21)
1050    }
1051    #[doc = "Bits 24:25 - Pulse swallow window mode"]
1052    #[inline(always)]
1053    pub fn pswm(&mut self) -> PSWM_W<SC_SPEC> {
1054        PSWM_W::new(self, 24)
1055    }
1056}
1057#[doc = "Slope generation control\n\nYou can [`read`](crate::Reg::read) this register and get [`sc::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sc::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
1058pub struct SC_SPEC;
1059impl crate::RegisterSpec for SC_SPEC {
1060    type Ux = u32;
1061}
1062#[doc = "`read()` method returns [`sc::R`](R) reader structure"]
1063impl crate::Readable for SC_SPEC {}
1064#[doc = "`write(|w| ..)` method takes [`sc::W`](W) writer structure"]
1065impl crate::Writable for SC_SPEC {
1066    type Safety = crate::Unsafe;
1067    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
1068    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
1069}
1070#[doc = "`reset()` method sets SC to value 0"]
1071impl crate::Resettable for SC_SPEC {
1072    const RESET_VALUE: u32 = 0;
1073}