efm32pg22_pac/efm32pg22c200/timer2_s/
cfg.rs

1#[doc = "Register `CFG` reader"]
2pub struct R(crate::R<CFG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CFG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CFG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CFG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CFG` writer"]
17pub struct W(crate::W<CFG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CFG_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<CFG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CFG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `MODE` reader - Timer Mode"]
38pub type MODE_R = crate::FieldReader<u8, MODE_A>;
39#[doc = "Timer Mode\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum MODE_A {
43    #[doc = "0: Up-count mode"]
44    UP = 0,
45    #[doc = "1: Down-count mode"]
46    DOWN = 1,
47    #[doc = "2: Up/down-count mode"]
48    UPDOWN = 2,
49    #[doc = "3: Quadrature decoder mode"]
50    QDEC = 3,
51}
52impl From<MODE_A> for u8 {
53    #[inline(always)]
54    fn from(variant: MODE_A) -> Self {
55        variant as _
56    }
57}
58impl MODE_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> MODE_A {
62        match self.bits {
63            0 => MODE_A::UP,
64            1 => MODE_A::DOWN,
65            2 => MODE_A::UPDOWN,
66            3 => MODE_A::QDEC,
67            _ => unreachable!(),
68        }
69    }
70    #[doc = "Checks if the value of the field is `UP`"]
71    #[inline(always)]
72    pub fn is_up(&self) -> bool {
73        *self == MODE_A::UP
74    }
75    #[doc = "Checks if the value of the field is `DOWN`"]
76    #[inline(always)]
77    pub fn is_down(&self) -> bool {
78        *self == MODE_A::DOWN
79    }
80    #[doc = "Checks if the value of the field is `UPDOWN`"]
81    #[inline(always)]
82    pub fn is_updown(&self) -> bool {
83        *self == MODE_A::UPDOWN
84    }
85    #[doc = "Checks if the value of the field is `QDEC`"]
86    #[inline(always)]
87    pub fn is_qdec(&self) -> bool {
88        *self == MODE_A::QDEC
89    }
90}
91#[doc = "Field `MODE` writer - Timer Mode"]
92pub type MODE_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, CFG_SPEC, u8, MODE_A, 2, O>;
93impl<'a, const O: u8> MODE_W<'a, O> {
94    #[doc = "Up-count mode"]
95    #[inline(always)]
96    pub fn up(self) -> &'a mut W {
97        self.variant(MODE_A::UP)
98    }
99    #[doc = "Down-count mode"]
100    #[inline(always)]
101    pub fn down(self) -> &'a mut W {
102        self.variant(MODE_A::DOWN)
103    }
104    #[doc = "Up/down-count mode"]
105    #[inline(always)]
106    pub fn updown(self) -> &'a mut W {
107        self.variant(MODE_A::UPDOWN)
108    }
109    #[doc = "Quadrature decoder mode"]
110    #[inline(always)]
111    pub fn qdec(self) -> &'a mut W {
112        self.variant(MODE_A::QDEC)
113    }
114}
115#[doc = "Field `SYNC` reader - Timer Start/Stop/Reload Synchronization"]
116pub type SYNC_R = crate::BitReader<SYNC_A>;
117#[doc = "Timer Start/Stop/Reload Synchronization\n\nValue on reset: 0"]
118#[derive(Clone, Copy, Debug, PartialEq, Eq)]
119pub enum SYNC_A {
120    #[doc = "0: Timer operation is unaffected by other timers."]
121    DISABLE = 0,
122    #[doc = "1: Timer may be started, stopped and re-loaded from other timer instances."]
123    ENABLE = 1,
124}
125impl From<SYNC_A> for bool {
126    #[inline(always)]
127    fn from(variant: SYNC_A) -> Self {
128        variant as u8 != 0
129    }
130}
131impl SYNC_R {
132    #[doc = "Get enumerated values variant"]
133    #[inline(always)]
134    pub fn variant(&self) -> SYNC_A {
135        match self.bits {
136            false => SYNC_A::DISABLE,
137            true => SYNC_A::ENABLE,
138        }
139    }
140    #[doc = "Checks if the value of the field is `DISABLE`"]
141    #[inline(always)]
142    pub fn is_disable(&self) -> bool {
143        *self == SYNC_A::DISABLE
144    }
145    #[doc = "Checks if the value of the field is `ENABLE`"]
146    #[inline(always)]
147    pub fn is_enable(&self) -> bool {
148        *self == SYNC_A::ENABLE
149    }
150}
151#[doc = "Field `SYNC` writer - Timer Start/Stop/Reload Synchronization"]
152pub type SYNC_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG_SPEC, SYNC_A, O>;
153impl<'a, const O: u8> SYNC_W<'a, O> {
154    #[doc = "Timer operation is unaffected by other timers."]
155    #[inline(always)]
156    pub fn disable(self) -> &'a mut W {
157        self.variant(SYNC_A::DISABLE)
158    }
159    #[doc = "Timer may be started, stopped and re-loaded from other timer instances."]
160    #[inline(always)]
161    pub fn enable(self) -> &'a mut W {
162        self.variant(SYNC_A::ENABLE)
163    }
164}
165#[doc = "Field `OSMEN` reader - One-shot Mode Enable"]
166pub type OSMEN_R = crate::BitReader<bool>;
167#[doc = "Field `OSMEN` writer - One-shot Mode Enable"]
168pub type OSMEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG_SPEC, bool, O>;
169#[doc = "Field `QDM` reader - Quadrature Decoder Mode Selection"]
170pub type QDM_R = crate::BitReader<QDM_A>;
171#[doc = "Quadrature Decoder Mode Selection\n\nValue on reset: 0"]
172#[derive(Clone, Copy, Debug, PartialEq, Eq)]
173pub enum QDM_A {
174    #[doc = "0: X2 mode selected"]
175    X2 = 0,
176    #[doc = "1: X4 mode selected"]
177    X4 = 1,
178}
179impl From<QDM_A> for bool {
180    #[inline(always)]
181    fn from(variant: QDM_A) -> Self {
182        variant as u8 != 0
183    }
184}
185impl QDM_R {
186    #[doc = "Get enumerated values variant"]
187    #[inline(always)]
188    pub fn variant(&self) -> QDM_A {
189        match self.bits {
190            false => QDM_A::X2,
191            true => QDM_A::X4,
192        }
193    }
194    #[doc = "Checks if the value of the field is `X2`"]
195    #[inline(always)]
196    pub fn is_x2(&self) -> bool {
197        *self == QDM_A::X2
198    }
199    #[doc = "Checks if the value of the field is `X4`"]
200    #[inline(always)]
201    pub fn is_x4(&self) -> bool {
202        *self == QDM_A::X4
203    }
204}
205#[doc = "Field `QDM` writer - Quadrature Decoder Mode Selection"]
206pub type QDM_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG_SPEC, QDM_A, O>;
207impl<'a, const O: u8> QDM_W<'a, O> {
208    #[doc = "X2 mode selected"]
209    #[inline(always)]
210    pub fn x2(self) -> &'a mut W {
211        self.variant(QDM_A::X2)
212    }
213    #[doc = "X4 mode selected"]
214    #[inline(always)]
215    pub fn x4(self) -> &'a mut W {
216        self.variant(QDM_A::X4)
217    }
218}
219#[doc = "Field `DEBUGRUN` reader - Debug Mode Run Enable"]
220pub type DEBUGRUN_R = crate::BitReader<DEBUGRUN_A>;
221#[doc = "Debug Mode Run Enable\n\nValue on reset: 0"]
222#[derive(Clone, Copy, Debug, PartialEq, Eq)]
223pub enum DEBUGRUN_A {
224    #[doc = "0: Timer is halted in debug mode"]
225    HALT = 0,
226    #[doc = "1: Timer is running in debug mode"]
227    RUN = 1,
228}
229impl From<DEBUGRUN_A> for bool {
230    #[inline(always)]
231    fn from(variant: DEBUGRUN_A) -> Self {
232        variant as u8 != 0
233    }
234}
235impl DEBUGRUN_R {
236    #[doc = "Get enumerated values variant"]
237    #[inline(always)]
238    pub fn variant(&self) -> DEBUGRUN_A {
239        match self.bits {
240            false => DEBUGRUN_A::HALT,
241            true => DEBUGRUN_A::RUN,
242        }
243    }
244    #[doc = "Checks if the value of the field is `HALT`"]
245    #[inline(always)]
246    pub fn is_halt(&self) -> bool {
247        *self == DEBUGRUN_A::HALT
248    }
249    #[doc = "Checks if the value of the field is `RUN`"]
250    #[inline(always)]
251    pub fn is_run(&self) -> bool {
252        *self == DEBUGRUN_A::RUN
253    }
254}
255#[doc = "Field `DEBUGRUN` writer - Debug Mode Run Enable"]
256pub type DEBUGRUN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG_SPEC, DEBUGRUN_A, O>;
257impl<'a, const O: u8> DEBUGRUN_W<'a, O> {
258    #[doc = "Timer is halted in debug mode"]
259    #[inline(always)]
260    pub fn halt(self) -> &'a mut W {
261        self.variant(DEBUGRUN_A::HALT)
262    }
263    #[doc = "Timer is running in debug mode"]
264    #[inline(always)]
265    pub fn run(self) -> &'a mut W {
266        self.variant(DEBUGRUN_A::RUN)
267    }
268}
269#[doc = "Field `DMACLRACT` reader - DMA Request Clear on Active"]
270pub type DMACLRACT_R = crate::BitReader<bool>;
271#[doc = "Field `DMACLRACT` writer - DMA Request Clear on Active"]
272pub type DMACLRACT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG_SPEC, bool, O>;
273#[doc = "Field `CLKSEL` reader - Clock Source Select"]
274pub type CLKSEL_R = crate::FieldReader<u8, CLKSEL_A>;
275#[doc = "Clock Source Select\n\nValue on reset: 0"]
276#[derive(Clone, Copy, Debug, PartialEq, Eq)]
277#[repr(u8)]
278pub enum CLKSEL_A {
279    #[doc = "0: Prescaled EM01GRPACLK"]
280    PRESCEM01GRPACLK = 0,
281    #[doc = "1: Compare/Capture Channel 1 Input"]
282    CC1 = 1,
283    #[doc = "2: Timer is clocked by underflow(down-count) or overflow(up-count) in the lower numbered neighbor Timer"]
284    TIMEROUF = 2,
285}
286impl From<CLKSEL_A> for u8 {
287    #[inline(always)]
288    fn from(variant: CLKSEL_A) -> Self {
289        variant as _
290    }
291}
292impl CLKSEL_R {
293    #[doc = "Get enumerated values variant"]
294    #[inline(always)]
295    pub fn variant(&self) -> Option<CLKSEL_A> {
296        match self.bits {
297            0 => Some(CLKSEL_A::PRESCEM01GRPACLK),
298            1 => Some(CLKSEL_A::CC1),
299            2 => Some(CLKSEL_A::TIMEROUF),
300            _ => None,
301        }
302    }
303    #[doc = "Checks if the value of the field is `PRESCEM01GRPACLK`"]
304    #[inline(always)]
305    pub fn is_prescem01grpaclk(&self) -> bool {
306        *self == CLKSEL_A::PRESCEM01GRPACLK
307    }
308    #[doc = "Checks if the value of the field is `CC1`"]
309    #[inline(always)]
310    pub fn is_cc1(&self) -> bool {
311        *self == CLKSEL_A::CC1
312    }
313    #[doc = "Checks if the value of the field is `TIMEROUF`"]
314    #[inline(always)]
315    pub fn is_timerouf(&self) -> bool {
316        *self == CLKSEL_A::TIMEROUF
317    }
318}
319#[doc = "Field `CLKSEL` writer - Clock Source Select"]
320pub type CLKSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CFG_SPEC, u8, CLKSEL_A, 2, O>;
321impl<'a, const O: u8> CLKSEL_W<'a, O> {
322    #[doc = "Prescaled EM01GRPACLK"]
323    #[inline(always)]
324    pub fn prescem01grpaclk(self) -> &'a mut W {
325        self.variant(CLKSEL_A::PRESCEM01GRPACLK)
326    }
327    #[doc = "Compare/Capture Channel 1 Input"]
328    #[inline(always)]
329    pub fn cc1(self) -> &'a mut W {
330        self.variant(CLKSEL_A::CC1)
331    }
332    #[doc = "Timer is clocked by underflow(down-count) or overflow(up-count) in the lower numbered neighbor Timer"]
333    #[inline(always)]
334    pub fn timerouf(self) -> &'a mut W {
335        self.variant(CLKSEL_A::TIMEROUF)
336    }
337}
338#[doc = "Field `RETIMEEN` reader - PWM output retimed enable"]
339pub type RETIMEEN_R = crate::BitReader<RETIMEEN_A>;
340#[doc = "PWM output retimed enable\n\nValue on reset: 0"]
341#[derive(Clone, Copy, Debug, PartialEq, Eq)]
342pub enum RETIMEEN_A {
343    #[doc = "0: PWM outputs are not re-timed."]
344    DISABLE = 0,
345    #[doc = "1: PWM outputs are re-timed."]
346    ENABLE = 1,
347}
348impl From<RETIMEEN_A> for bool {
349    #[inline(always)]
350    fn from(variant: RETIMEEN_A) -> Self {
351        variant as u8 != 0
352    }
353}
354impl RETIMEEN_R {
355    #[doc = "Get enumerated values variant"]
356    #[inline(always)]
357    pub fn variant(&self) -> RETIMEEN_A {
358        match self.bits {
359            false => RETIMEEN_A::DISABLE,
360            true => RETIMEEN_A::ENABLE,
361        }
362    }
363    #[doc = "Checks if the value of the field is `DISABLE`"]
364    #[inline(always)]
365    pub fn is_disable(&self) -> bool {
366        *self == RETIMEEN_A::DISABLE
367    }
368    #[doc = "Checks if the value of the field is `ENABLE`"]
369    #[inline(always)]
370    pub fn is_enable(&self) -> bool {
371        *self == RETIMEEN_A::ENABLE
372    }
373}
374#[doc = "Field `RETIMEEN` writer - PWM output retimed enable"]
375pub type RETIMEEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG_SPEC, RETIMEEN_A, O>;
376impl<'a, const O: u8> RETIMEEN_W<'a, O> {
377    #[doc = "PWM outputs are not re-timed."]
378    #[inline(always)]
379    pub fn disable(self) -> &'a mut W {
380        self.variant(RETIMEEN_A::DISABLE)
381    }
382    #[doc = "PWM outputs are re-timed."]
383    #[inline(always)]
384    pub fn enable(self) -> &'a mut W {
385        self.variant(RETIMEEN_A::ENABLE)
386    }
387}
388#[doc = "Field `DISSYNCOUT` reader - Disable Timer Start/Stop/Reload output"]
389pub type DISSYNCOUT_R = crate::BitReader<DISSYNCOUT_A>;
390#[doc = "Disable Timer Start/Stop/Reload output\n\nValue on reset: 0"]
391#[derive(Clone, Copy, Debug, PartialEq, Eq)]
392pub enum DISSYNCOUT_A {
393    #[doc = "0: Timer can start/stop/reload other timers with SYNC bit set"]
394    EN = 0,
395    #[doc = "1: Timer cannot start/stop/reload other timers with SYNC bit set"]
396    DIS = 1,
397}
398impl From<DISSYNCOUT_A> for bool {
399    #[inline(always)]
400    fn from(variant: DISSYNCOUT_A) -> Self {
401        variant as u8 != 0
402    }
403}
404impl DISSYNCOUT_R {
405    #[doc = "Get enumerated values variant"]
406    #[inline(always)]
407    pub fn variant(&self) -> DISSYNCOUT_A {
408        match self.bits {
409            false => DISSYNCOUT_A::EN,
410            true => DISSYNCOUT_A::DIS,
411        }
412    }
413    #[doc = "Checks if the value of the field is `EN`"]
414    #[inline(always)]
415    pub fn is_en(&self) -> bool {
416        *self == DISSYNCOUT_A::EN
417    }
418    #[doc = "Checks if the value of the field is `DIS`"]
419    #[inline(always)]
420    pub fn is_dis(&self) -> bool {
421        *self == DISSYNCOUT_A::DIS
422    }
423}
424#[doc = "Field `DISSYNCOUT` writer - Disable Timer Start/Stop/Reload output"]
425pub type DISSYNCOUT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG_SPEC, DISSYNCOUT_A, O>;
426impl<'a, const O: u8> DISSYNCOUT_W<'a, O> {
427    #[doc = "Timer can start/stop/reload other timers with SYNC bit set"]
428    #[inline(always)]
429    pub fn en(self) -> &'a mut W {
430        self.variant(DISSYNCOUT_A::EN)
431    }
432    #[doc = "Timer cannot start/stop/reload other timers with SYNC bit set"]
433    #[inline(always)]
434    pub fn dis(self) -> &'a mut W {
435        self.variant(DISSYNCOUT_A::DIS)
436    }
437}
438#[doc = "Field `ATI` reader - Always Track Inputs"]
439pub type ATI_R = crate::BitReader<bool>;
440#[doc = "Field `ATI` writer - Always Track Inputs"]
441pub type ATI_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG_SPEC, bool, O>;
442#[doc = "Field `RSSCOIST` reader - Reload-Start Sets COIST"]
443pub type RSSCOIST_R = crate::BitReader<bool>;
444#[doc = "Field `RSSCOIST` writer - Reload-Start Sets COIST"]
445pub type RSSCOIST_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFG_SPEC, bool, O>;
446#[doc = "Field `PRESC` reader - Prescaler Setting"]
447pub type PRESC_R = crate::FieldReader<u16, PRESC_A>;
448#[doc = "Prescaler Setting\n\nValue on reset: 0"]
449#[derive(Clone, Copy, Debug, PartialEq, Eq)]
450#[repr(u16)]
451pub enum PRESC_A {
452    #[doc = "0: No prescaling"]
453    DIV1 = 0,
454    #[doc = "1: Prescale by 2"]
455    DIV2 = 1,
456    #[doc = "3: Prescale by 4"]
457    DIV4 = 3,
458    #[doc = "7: Prescale by 8"]
459    DIV8 = 7,
460    #[doc = "15: Prescale by 16"]
461    DIV16 = 15,
462    #[doc = "31: Prescale by 32"]
463    DIV32 = 31,
464    #[doc = "63: Prescale by 64"]
465    DIV64 = 63,
466    #[doc = "127: Prescale by 128"]
467    DIV128 = 127,
468    #[doc = "255: Prescale by 256"]
469    DIV256 = 255,
470    #[doc = "511: Prescale by 512"]
471    DIV512 = 511,
472    #[doc = "1023: Prescale by 1024"]
473    DIV1024 = 1023,
474}
475impl From<PRESC_A> for u16 {
476    #[inline(always)]
477    fn from(variant: PRESC_A) -> Self {
478        variant as _
479    }
480}
481impl PRESC_R {
482    #[doc = "Get enumerated values variant"]
483    #[inline(always)]
484    pub fn variant(&self) -> Option<PRESC_A> {
485        match self.bits {
486            0 => Some(PRESC_A::DIV1),
487            1 => Some(PRESC_A::DIV2),
488            3 => Some(PRESC_A::DIV4),
489            7 => Some(PRESC_A::DIV8),
490            15 => Some(PRESC_A::DIV16),
491            31 => Some(PRESC_A::DIV32),
492            63 => Some(PRESC_A::DIV64),
493            127 => Some(PRESC_A::DIV128),
494            255 => Some(PRESC_A::DIV256),
495            511 => Some(PRESC_A::DIV512),
496            1023 => Some(PRESC_A::DIV1024),
497            _ => None,
498        }
499    }
500    #[doc = "Checks if the value of the field is `DIV1`"]
501    #[inline(always)]
502    pub fn is_div1(&self) -> bool {
503        *self == PRESC_A::DIV1
504    }
505    #[doc = "Checks if the value of the field is `DIV2`"]
506    #[inline(always)]
507    pub fn is_div2(&self) -> bool {
508        *self == PRESC_A::DIV2
509    }
510    #[doc = "Checks if the value of the field is `DIV4`"]
511    #[inline(always)]
512    pub fn is_div4(&self) -> bool {
513        *self == PRESC_A::DIV4
514    }
515    #[doc = "Checks if the value of the field is `DIV8`"]
516    #[inline(always)]
517    pub fn is_div8(&self) -> bool {
518        *self == PRESC_A::DIV8
519    }
520    #[doc = "Checks if the value of the field is `DIV16`"]
521    #[inline(always)]
522    pub fn is_div16(&self) -> bool {
523        *self == PRESC_A::DIV16
524    }
525    #[doc = "Checks if the value of the field is `DIV32`"]
526    #[inline(always)]
527    pub fn is_div32(&self) -> bool {
528        *self == PRESC_A::DIV32
529    }
530    #[doc = "Checks if the value of the field is `DIV64`"]
531    #[inline(always)]
532    pub fn is_div64(&self) -> bool {
533        *self == PRESC_A::DIV64
534    }
535    #[doc = "Checks if the value of the field is `DIV128`"]
536    #[inline(always)]
537    pub fn is_div128(&self) -> bool {
538        *self == PRESC_A::DIV128
539    }
540    #[doc = "Checks if the value of the field is `DIV256`"]
541    #[inline(always)]
542    pub fn is_div256(&self) -> bool {
543        *self == PRESC_A::DIV256
544    }
545    #[doc = "Checks if the value of the field is `DIV512`"]
546    #[inline(always)]
547    pub fn is_div512(&self) -> bool {
548        *self == PRESC_A::DIV512
549    }
550    #[doc = "Checks if the value of the field is `DIV1024`"]
551    #[inline(always)]
552    pub fn is_div1024(&self) -> bool {
553        *self == PRESC_A::DIV1024
554    }
555}
556#[doc = "Field `PRESC` writer - Prescaler Setting"]
557pub type PRESC_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CFG_SPEC, u16, PRESC_A, 10, O>;
558impl<'a, const O: u8> PRESC_W<'a, O> {
559    #[doc = "No prescaling"]
560    #[inline(always)]
561    pub fn div1(self) -> &'a mut W {
562        self.variant(PRESC_A::DIV1)
563    }
564    #[doc = "Prescale by 2"]
565    #[inline(always)]
566    pub fn div2(self) -> &'a mut W {
567        self.variant(PRESC_A::DIV2)
568    }
569    #[doc = "Prescale by 4"]
570    #[inline(always)]
571    pub fn div4(self) -> &'a mut W {
572        self.variant(PRESC_A::DIV4)
573    }
574    #[doc = "Prescale by 8"]
575    #[inline(always)]
576    pub fn div8(self) -> &'a mut W {
577        self.variant(PRESC_A::DIV8)
578    }
579    #[doc = "Prescale by 16"]
580    #[inline(always)]
581    pub fn div16(self) -> &'a mut W {
582        self.variant(PRESC_A::DIV16)
583    }
584    #[doc = "Prescale by 32"]
585    #[inline(always)]
586    pub fn div32(self) -> &'a mut W {
587        self.variant(PRESC_A::DIV32)
588    }
589    #[doc = "Prescale by 64"]
590    #[inline(always)]
591    pub fn div64(self) -> &'a mut W {
592        self.variant(PRESC_A::DIV64)
593    }
594    #[doc = "Prescale by 128"]
595    #[inline(always)]
596    pub fn div128(self) -> &'a mut W {
597        self.variant(PRESC_A::DIV128)
598    }
599    #[doc = "Prescale by 256"]
600    #[inline(always)]
601    pub fn div256(self) -> &'a mut W {
602        self.variant(PRESC_A::DIV256)
603    }
604    #[doc = "Prescale by 512"]
605    #[inline(always)]
606    pub fn div512(self) -> &'a mut W {
607        self.variant(PRESC_A::DIV512)
608    }
609    #[doc = "Prescale by 1024"]
610    #[inline(always)]
611    pub fn div1024(self) -> &'a mut W {
612        self.variant(PRESC_A::DIV1024)
613    }
614}
615impl R {
616    #[doc = "Bits 0:1 - Timer Mode"]
617    #[inline(always)]
618    pub fn mode(&self) -> MODE_R {
619        MODE_R::new((self.bits & 3) as u8)
620    }
621    #[doc = "Bit 3 - Timer Start/Stop/Reload Synchronization"]
622    #[inline(always)]
623    pub fn sync(&self) -> SYNC_R {
624        SYNC_R::new(((self.bits >> 3) & 1) != 0)
625    }
626    #[doc = "Bit 4 - One-shot Mode Enable"]
627    #[inline(always)]
628    pub fn osmen(&self) -> OSMEN_R {
629        OSMEN_R::new(((self.bits >> 4) & 1) != 0)
630    }
631    #[doc = "Bit 5 - Quadrature Decoder Mode Selection"]
632    #[inline(always)]
633    pub fn qdm(&self) -> QDM_R {
634        QDM_R::new(((self.bits >> 5) & 1) != 0)
635    }
636    #[doc = "Bit 6 - Debug Mode Run Enable"]
637    #[inline(always)]
638    pub fn debugrun(&self) -> DEBUGRUN_R {
639        DEBUGRUN_R::new(((self.bits >> 6) & 1) != 0)
640    }
641    #[doc = "Bit 7 - DMA Request Clear on Active"]
642    #[inline(always)]
643    pub fn dmaclract(&self) -> DMACLRACT_R {
644        DMACLRACT_R::new(((self.bits >> 7) & 1) != 0)
645    }
646    #[doc = "Bits 8:9 - Clock Source Select"]
647    #[inline(always)]
648    pub fn clksel(&self) -> CLKSEL_R {
649        CLKSEL_R::new(((self.bits >> 8) & 3) as u8)
650    }
651    #[doc = "Bit 10 - PWM output retimed enable"]
652    #[inline(always)]
653    pub fn retimeen(&self) -> RETIMEEN_R {
654        RETIMEEN_R::new(((self.bits >> 10) & 1) != 0)
655    }
656    #[doc = "Bit 11 - Disable Timer Start/Stop/Reload output"]
657    #[inline(always)]
658    pub fn dissyncout(&self) -> DISSYNCOUT_R {
659        DISSYNCOUT_R::new(((self.bits >> 11) & 1) != 0)
660    }
661    #[doc = "Bit 16 - Always Track Inputs"]
662    #[inline(always)]
663    pub fn ati(&self) -> ATI_R {
664        ATI_R::new(((self.bits >> 16) & 1) != 0)
665    }
666    #[doc = "Bit 17 - Reload-Start Sets COIST"]
667    #[inline(always)]
668    pub fn rsscoist(&self) -> RSSCOIST_R {
669        RSSCOIST_R::new(((self.bits >> 17) & 1) != 0)
670    }
671    #[doc = "Bits 18:27 - Prescaler Setting"]
672    #[inline(always)]
673    pub fn presc(&self) -> PRESC_R {
674        PRESC_R::new(((self.bits >> 18) & 0x03ff) as u16)
675    }
676}
677impl W {
678    #[doc = "Bits 0:1 - Timer Mode"]
679    #[inline(always)]
680    #[must_use]
681    pub fn mode(&mut self) -> MODE_W<0> {
682        MODE_W::new(self)
683    }
684    #[doc = "Bit 3 - Timer Start/Stop/Reload Synchronization"]
685    #[inline(always)]
686    #[must_use]
687    pub fn sync(&mut self) -> SYNC_W<3> {
688        SYNC_W::new(self)
689    }
690    #[doc = "Bit 4 - One-shot Mode Enable"]
691    #[inline(always)]
692    #[must_use]
693    pub fn osmen(&mut self) -> OSMEN_W<4> {
694        OSMEN_W::new(self)
695    }
696    #[doc = "Bit 5 - Quadrature Decoder Mode Selection"]
697    #[inline(always)]
698    #[must_use]
699    pub fn qdm(&mut self) -> QDM_W<5> {
700        QDM_W::new(self)
701    }
702    #[doc = "Bit 6 - Debug Mode Run Enable"]
703    #[inline(always)]
704    #[must_use]
705    pub fn debugrun(&mut self) -> DEBUGRUN_W<6> {
706        DEBUGRUN_W::new(self)
707    }
708    #[doc = "Bit 7 - DMA Request Clear on Active"]
709    #[inline(always)]
710    #[must_use]
711    pub fn dmaclract(&mut self) -> DMACLRACT_W<7> {
712        DMACLRACT_W::new(self)
713    }
714    #[doc = "Bits 8:9 - Clock Source Select"]
715    #[inline(always)]
716    #[must_use]
717    pub fn clksel(&mut self) -> CLKSEL_W<8> {
718        CLKSEL_W::new(self)
719    }
720    #[doc = "Bit 10 - PWM output retimed enable"]
721    #[inline(always)]
722    #[must_use]
723    pub fn retimeen(&mut self) -> RETIMEEN_W<10> {
724        RETIMEEN_W::new(self)
725    }
726    #[doc = "Bit 11 - Disable Timer Start/Stop/Reload output"]
727    #[inline(always)]
728    #[must_use]
729    pub fn dissyncout(&mut self) -> DISSYNCOUT_W<11> {
730        DISSYNCOUT_W::new(self)
731    }
732    #[doc = "Bit 16 - Always Track Inputs"]
733    #[inline(always)]
734    #[must_use]
735    pub fn ati(&mut self) -> ATI_W<16> {
736        ATI_W::new(self)
737    }
738    #[doc = "Bit 17 - Reload-Start Sets COIST"]
739    #[inline(always)]
740    #[must_use]
741    pub fn rsscoist(&mut self) -> RSSCOIST_W<17> {
742        RSSCOIST_W::new(self)
743    }
744    #[doc = "Bits 18:27 - Prescaler Setting"]
745    #[inline(always)]
746    #[must_use]
747    pub fn presc(&mut self) -> PRESC_W<18> {
748        PRESC_W::new(self)
749    }
750    #[doc = "Writes raw bits to the register."]
751    #[inline(always)]
752    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
753        self.0.bits(bits);
754        self
755    }
756}
757#[doc = "No Description\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
758pub struct CFG_SPEC;
759impl crate::RegisterSpec for CFG_SPEC {
760    type Ux = u32;
761}
762#[doc = "`read()` method returns [cfg::R](R) reader structure"]
763impl crate::Readable for CFG_SPEC {
764    type Reader = R;
765}
766#[doc = "`write(|w| ..)` method takes [cfg::W](W) writer structure"]
767impl crate::Writable for CFG_SPEC {
768    type Writer = W;
769    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
770    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
771}
772#[doc = "`reset()` method sets CFG to value 0"]
773impl crate::Resettable for CFG_SPEC {
774    const RESET_VALUE: Self::Ux = 0;
775}