efm32pg12_pac/wtimer0/
ctrl.rs

1#[doc = "Reader of register CTRL"]
2pub type R = crate::R<u32, super::CTRL>;
3#[doc = "Writer for register CTRL"]
4pub type W = crate::W<u32, super::CTRL>;
5#[doc = "Register CTRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::CTRL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Timer Mode\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum MODE_A {
17    #[doc = "0: Up-count mode"]
18    UP = 0,
19    #[doc = "1: Down-count mode"]
20    DOWN = 1,
21    #[doc = "2: Up/down-count mode"]
22    UPDOWN = 2,
23    #[doc = "3: Quadrature decoder mode"]
24    QDEC = 3,
25}
26impl From<MODE_A> for u8 {
27    #[inline(always)]
28    fn from(variant: MODE_A) -> Self {
29        variant as _
30    }
31}
32#[doc = "Reader of field `MODE`"]
33pub type MODE_R = crate::R<u8, MODE_A>;
34impl MODE_R {
35    #[doc = r"Get enumerated values variant"]
36    #[inline(always)]
37    pub fn variant(&self) -> MODE_A {
38        match self.bits {
39            0 => MODE_A::UP,
40            1 => MODE_A::DOWN,
41            2 => MODE_A::UPDOWN,
42            3 => MODE_A::QDEC,
43            _ => unreachable!(),
44        }
45    }
46    #[doc = "Checks if the value of the field is `UP`"]
47    #[inline(always)]
48    pub fn is_up(&self) -> bool {
49        *self == MODE_A::UP
50    }
51    #[doc = "Checks if the value of the field is `DOWN`"]
52    #[inline(always)]
53    pub fn is_down(&self) -> bool {
54        *self == MODE_A::DOWN
55    }
56    #[doc = "Checks if the value of the field is `UPDOWN`"]
57    #[inline(always)]
58    pub fn is_updown(&self) -> bool {
59        *self == MODE_A::UPDOWN
60    }
61    #[doc = "Checks if the value of the field is `QDEC`"]
62    #[inline(always)]
63    pub fn is_qdec(&self) -> bool {
64        *self == MODE_A::QDEC
65    }
66}
67#[doc = "Write proxy for field `MODE`"]
68pub struct MODE_W<'a> {
69    w: &'a mut W,
70}
71impl<'a> MODE_W<'a> {
72    #[doc = r"Writes `variant` to the field"]
73    #[inline(always)]
74    pub fn variant(self, variant: MODE_A) -> &'a mut W {
75        {
76            self.bits(variant.into())
77        }
78    }
79    #[doc = "Up-count mode"]
80    #[inline(always)]
81    pub fn up(self) -> &'a mut W {
82        self.variant(MODE_A::UP)
83    }
84    #[doc = "Down-count mode"]
85    #[inline(always)]
86    pub fn down(self) -> &'a mut W {
87        self.variant(MODE_A::DOWN)
88    }
89    #[doc = "Up/down-count mode"]
90    #[inline(always)]
91    pub fn updown(self) -> &'a mut W {
92        self.variant(MODE_A::UPDOWN)
93    }
94    #[doc = "Quadrature decoder mode"]
95    #[inline(always)]
96    pub fn qdec(self) -> &'a mut W {
97        self.variant(MODE_A::QDEC)
98    }
99    #[doc = r"Writes raw bits to the field"]
100    #[inline(always)]
101    pub fn bits(self, value: u8) -> &'a mut W {
102        self.w.bits = (self.w.bits & !0x03) | ((value as u32) & 0x03);
103        self.w
104    }
105}
106#[doc = "Reader of field `SYNC`"]
107pub type SYNC_R = crate::R<bool, bool>;
108#[doc = "Write proxy for field `SYNC`"]
109pub struct SYNC_W<'a> {
110    w: &'a mut W,
111}
112impl<'a> SYNC_W<'a> {
113    #[doc = r"Sets the field bit"]
114    #[inline(always)]
115    pub fn set_bit(self) -> &'a mut W {
116        self.bit(true)
117    }
118    #[doc = r"Clears the field bit"]
119    #[inline(always)]
120    pub fn clear_bit(self) -> &'a mut W {
121        self.bit(false)
122    }
123    #[doc = r"Writes raw bits to the field"]
124    #[inline(always)]
125    pub fn bit(self, value: bool) -> &'a mut W {
126        self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
127        self.w
128    }
129}
130#[doc = "Reader of field `OSMEN`"]
131pub type OSMEN_R = crate::R<bool, bool>;
132#[doc = "Write proxy for field `OSMEN`"]
133pub struct OSMEN_W<'a> {
134    w: &'a mut W,
135}
136impl<'a> OSMEN_W<'a> {
137    #[doc = r"Sets the field bit"]
138    #[inline(always)]
139    pub fn set_bit(self) -> &'a mut W {
140        self.bit(true)
141    }
142    #[doc = r"Clears the field bit"]
143    #[inline(always)]
144    pub fn clear_bit(self) -> &'a mut W {
145        self.bit(false)
146    }
147    #[doc = r"Writes raw bits to the field"]
148    #[inline(always)]
149    pub fn bit(self, value: bool) -> &'a mut W {
150        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
151        self.w
152    }
153}
154#[doc = "Reader of field `QDM`"]
155pub type QDM_R = crate::R<bool, bool>;
156#[doc = "Write proxy for field `QDM`"]
157pub struct QDM_W<'a> {
158    w: &'a mut W,
159}
160impl<'a> QDM_W<'a> {
161    #[doc = r"Sets the field bit"]
162    #[inline(always)]
163    pub fn set_bit(self) -> &'a mut W {
164        self.bit(true)
165    }
166    #[doc = r"Clears the field bit"]
167    #[inline(always)]
168    pub fn clear_bit(self) -> &'a mut W {
169        self.bit(false)
170    }
171    #[doc = r"Writes raw bits to the field"]
172    #[inline(always)]
173    pub fn bit(self, value: bool) -> &'a mut W {
174        self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5);
175        self.w
176    }
177}
178#[doc = "Reader of field `DEBUGRUN`"]
179pub type DEBUGRUN_R = crate::R<bool, bool>;
180#[doc = "Write proxy for field `DEBUGRUN`"]
181pub struct DEBUGRUN_W<'a> {
182    w: &'a mut W,
183}
184impl<'a> DEBUGRUN_W<'a> {
185    #[doc = r"Sets the field bit"]
186    #[inline(always)]
187    pub fn set_bit(self) -> &'a mut W {
188        self.bit(true)
189    }
190    #[doc = r"Clears the field bit"]
191    #[inline(always)]
192    pub fn clear_bit(self) -> &'a mut W {
193        self.bit(false)
194    }
195    #[doc = r"Writes raw bits to the field"]
196    #[inline(always)]
197    pub fn bit(self, value: bool) -> &'a mut W {
198        self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6);
199        self.w
200    }
201}
202#[doc = "Reader of field `DMACLRACT`"]
203pub type DMACLRACT_R = crate::R<bool, bool>;
204#[doc = "Write proxy for field `DMACLRACT`"]
205pub struct DMACLRACT_W<'a> {
206    w: &'a mut W,
207}
208impl<'a> DMACLRACT_W<'a> {
209    #[doc = r"Sets the field bit"]
210    #[inline(always)]
211    pub fn set_bit(self) -> &'a mut W {
212        self.bit(true)
213    }
214    #[doc = r"Clears the field bit"]
215    #[inline(always)]
216    pub fn clear_bit(self) -> &'a mut W {
217        self.bit(false)
218    }
219    #[doc = r"Writes raw bits to the field"]
220    #[inline(always)]
221    pub fn bit(self, value: bool) -> &'a mut W {
222        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
223        self.w
224    }
225}
226#[doc = "Timer Rising Input Edge Action\n\nValue on reset: 0"]
227#[derive(Clone, Copy, Debug, PartialEq)]
228#[repr(u8)]
229pub enum RISEA_A {
230    #[doc = "0: No action"]
231    NONE = 0,
232    #[doc = "1: Start counter without reload"]
233    START = 1,
234    #[doc = "2: Stop counter without reload"]
235    STOP = 2,
236    #[doc = "3: Reload and start counter"]
237    RELOADSTART = 3,
238}
239impl From<RISEA_A> for u8 {
240    #[inline(always)]
241    fn from(variant: RISEA_A) -> Self {
242        variant as _
243    }
244}
245#[doc = "Reader of field `RISEA`"]
246pub type RISEA_R = crate::R<u8, RISEA_A>;
247impl RISEA_R {
248    #[doc = r"Get enumerated values variant"]
249    #[inline(always)]
250    pub fn variant(&self) -> RISEA_A {
251        match self.bits {
252            0 => RISEA_A::NONE,
253            1 => RISEA_A::START,
254            2 => RISEA_A::STOP,
255            3 => RISEA_A::RELOADSTART,
256            _ => unreachable!(),
257        }
258    }
259    #[doc = "Checks if the value of the field is `NONE`"]
260    #[inline(always)]
261    pub fn is_none(&self) -> bool {
262        *self == RISEA_A::NONE
263    }
264    #[doc = "Checks if the value of the field is `START`"]
265    #[inline(always)]
266    pub fn is_start(&self) -> bool {
267        *self == RISEA_A::START
268    }
269    #[doc = "Checks if the value of the field is `STOP`"]
270    #[inline(always)]
271    pub fn is_stop(&self) -> bool {
272        *self == RISEA_A::STOP
273    }
274    #[doc = "Checks if the value of the field is `RELOADSTART`"]
275    #[inline(always)]
276    pub fn is_reloadstart(&self) -> bool {
277        *self == RISEA_A::RELOADSTART
278    }
279}
280#[doc = "Write proxy for field `RISEA`"]
281pub struct RISEA_W<'a> {
282    w: &'a mut W,
283}
284impl<'a> RISEA_W<'a> {
285    #[doc = r"Writes `variant` to the field"]
286    #[inline(always)]
287    pub fn variant(self, variant: RISEA_A) -> &'a mut W {
288        {
289            self.bits(variant.into())
290        }
291    }
292    #[doc = "No action"]
293    #[inline(always)]
294    pub fn none(self) -> &'a mut W {
295        self.variant(RISEA_A::NONE)
296    }
297    #[doc = "Start counter without reload"]
298    #[inline(always)]
299    pub fn start(self) -> &'a mut W {
300        self.variant(RISEA_A::START)
301    }
302    #[doc = "Stop counter without reload"]
303    #[inline(always)]
304    pub fn stop(self) -> &'a mut W {
305        self.variant(RISEA_A::STOP)
306    }
307    #[doc = "Reload and start counter"]
308    #[inline(always)]
309    pub fn reloadstart(self) -> &'a mut W {
310        self.variant(RISEA_A::RELOADSTART)
311    }
312    #[doc = r"Writes raw bits to the field"]
313    #[inline(always)]
314    pub fn bits(self, value: u8) -> &'a mut W {
315        self.w.bits = (self.w.bits & !(0x03 << 8)) | (((value as u32) & 0x03) << 8);
316        self.w
317    }
318}
319#[doc = "Timer Falling Input Edge Action\n\nValue on reset: 0"]
320#[derive(Clone, Copy, Debug, PartialEq)]
321#[repr(u8)]
322pub enum FALLA_A {
323    #[doc = "0: No action"]
324    NONE = 0,
325    #[doc = "1: Start counter without reload"]
326    START = 1,
327    #[doc = "2: Stop counter without reload"]
328    STOP = 2,
329    #[doc = "3: Reload and start counter"]
330    RELOADSTART = 3,
331}
332impl From<FALLA_A> for u8 {
333    #[inline(always)]
334    fn from(variant: FALLA_A) -> Self {
335        variant as _
336    }
337}
338#[doc = "Reader of field `FALLA`"]
339pub type FALLA_R = crate::R<u8, FALLA_A>;
340impl FALLA_R {
341    #[doc = r"Get enumerated values variant"]
342    #[inline(always)]
343    pub fn variant(&self) -> FALLA_A {
344        match self.bits {
345            0 => FALLA_A::NONE,
346            1 => FALLA_A::START,
347            2 => FALLA_A::STOP,
348            3 => FALLA_A::RELOADSTART,
349            _ => unreachable!(),
350        }
351    }
352    #[doc = "Checks if the value of the field is `NONE`"]
353    #[inline(always)]
354    pub fn is_none(&self) -> bool {
355        *self == FALLA_A::NONE
356    }
357    #[doc = "Checks if the value of the field is `START`"]
358    #[inline(always)]
359    pub fn is_start(&self) -> bool {
360        *self == FALLA_A::START
361    }
362    #[doc = "Checks if the value of the field is `STOP`"]
363    #[inline(always)]
364    pub fn is_stop(&self) -> bool {
365        *self == FALLA_A::STOP
366    }
367    #[doc = "Checks if the value of the field is `RELOADSTART`"]
368    #[inline(always)]
369    pub fn is_reloadstart(&self) -> bool {
370        *self == FALLA_A::RELOADSTART
371    }
372}
373#[doc = "Write proxy for field `FALLA`"]
374pub struct FALLA_W<'a> {
375    w: &'a mut W,
376}
377impl<'a> FALLA_W<'a> {
378    #[doc = r"Writes `variant` to the field"]
379    #[inline(always)]
380    pub fn variant(self, variant: FALLA_A) -> &'a mut W {
381        {
382            self.bits(variant.into())
383        }
384    }
385    #[doc = "No action"]
386    #[inline(always)]
387    pub fn none(self) -> &'a mut W {
388        self.variant(FALLA_A::NONE)
389    }
390    #[doc = "Start counter without reload"]
391    #[inline(always)]
392    pub fn start(self) -> &'a mut W {
393        self.variant(FALLA_A::START)
394    }
395    #[doc = "Stop counter without reload"]
396    #[inline(always)]
397    pub fn stop(self) -> &'a mut W {
398        self.variant(FALLA_A::STOP)
399    }
400    #[doc = "Reload and start counter"]
401    #[inline(always)]
402    pub fn reloadstart(self) -> &'a mut W {
403        self.variant(FALLA_A::RELOADSTART)
404    }
405    #[doc = r"Writes raw bits to the field"]
406    #[inline(always)]
407    pub fn bits(self, value: u8) -> &'a mut W {
408        self.w.bits = (self.w.bits & !(0x03 << 10)) | (((value as u32) & 0x03) << 10);
409        self.w
410    }
411}
412#[doc = "Reader of field `X2CNT`"]
413pub type X2CNT_R = crate::R<bool, bool>;
414#[doc = "Write proxy for field `X2CNT`"]
415pub struct X2CNT_W<'a> {
416    w: &'a mut W,
417}
418impl<'a> X2CNT_W<'a> {
419    #[doc = r"Sets the field bit"]
420    #[inline(always)]
421    pub fn set_bit(self) -> &'a mut W {
422        self.bit(true)
423    }
424    #[doc = r"Clears the field bit"]
425    #[inline(always)]
426    pub fn clear_bit(self) -> &'a mut W {
427        self.bit(false)
428    }
429    #[doc = r"Writes raw bits to the field"]
430    #[inline(always)]
431    pub fn bit(self, value: bool) -> &'a mut W {
432        self.w.bits = (self.w.bits & !(0x01 << 13)) | (((value as u32) & 0x01) << 13);
433        self.w
434    }
435}
436#[doc = "Clock Source Select\n\nValue on reset: 0"]
437#[derive(Clone, Copy, Debug, PartialEq)]
438#[repr(u8)]
439pub enum CLKSEL_A {
440    #[doc = "0: Prescaled HFPERCLK"]
441    PRESCHFPERCLK = 0,
442    #[doc = "1: Compare/Capture Channel 1 Input"]
443    CC1 = 1,
444    #[doc = "2: Timer is clocked by underflow(down-count) or overflow(up-count) in the lower numbered neighbor Timer"]
445    TIMEROUF = 2,
446}
447impl From<CLKSEL_A> for u8 {
448    #[inline(always)]
449    fn from(variant: CLKSEL_A) -> Self {
450        variant as _
451    }
452}
453#[doc = "Reader of field `CLKSEL`"]
454pub type CLKSEL_R = crate::R<u8, CLKSEL_A>;
455impl CLKSEL_R {
456    #[doc = r"Get enumerated values variant"]
457    #[inline(always)]
458    pub fn variant(&self) -> crate::Variant<u8, CLKSEL_A> {
459        use crate::Variant::*;
460        match self.bits {
461            0 => Val(CLKSEL_A::PRESCHFPERCLK),
462            1 => Val(CLKSEL_A::CC1),
463            2 => Val(CLKSEL_A::TIMEROUF),
464            i => Res(i),
465        }
466    }
467    #[doc = "Checks if the value of the field is `PRESCHFPERCLK`"]
468    #[inline(always)]
469    pub fn is_preschfperclk(&self) -> bool {
470        *self == CLKSEL_A::PRESCHFPERCLK
471    }
472    #[doc = "Checks if the value of the field is `CC1`"]
473    #[inline(always)]
474    pub fn is_cc1(&self) -> bool {
475        *self == CLKSEL_A::CC1
476    }
477    #[doc = "Checks if the value of the field is `TIMEROUF`"]
478    #[inline(always)]
479    pub fn is_timerouf(&self) -> bool {
480        *self == CLKSEL_A::TIMEROUF
481    }
482}
483#[doc = "Write proxy for field `CLKSEL`"]
484pub struct CLKSEL_W<'a> {
485    w: &'a mut W,
486}
487impl<'a> CLKSEL_W<'a> {
488    #[doc = r"Writes `variant` to the field"]
489    #[inline(always)]
490    pub fn variant(self, variant: CLKSEL_A) -> &'a mut W {
491        unsafe { self.bits(variant.into()) }
492    }
493    #[doc = "Prescaled HFPERCLK"]
494    #[inline(always)]
495    pub fn preschfperclk(self) -> &'a mut W {
496        self.variant(CLKSEL_A::PRESCHFPERCLK)
497    }
498    #[doc = "Compare/Capture Channel 1 Input"]
499    #[inline(always)]
500    pub fn cc1(self) -> &'a mut W {
501        self.variant(CLKSEL_A::CC1)
502    }
503    #[doc = "Timer is clocked by underflow(down-count) or overflow(up-count) in the lower numbered neighbor Timer"]
504    #[inline(always)]
505    pub fn timerouf(self) -> &'a mut W {
506        self.variant(CLKSEL_A::TIMEROUF)
507    }
508    #[doc = r"Writes raw bits to the field"]
509    #[inline(always)]
510    pub unsafe fn bits(self, value: u8) -> &'a mut W {
511        self.w.bits = (self.w.bits & !(0x03 << 16)) | (((value as u32) & 0x03) << 16);
512        self.w
513    }
514}
515#[doc = "Prescaler Setting\n\nValue on reset: 0"]
516#[derive(Clone, Copy, Debug, PartialEq)]
517#[repr(u8)]
518pub enum PRESC_A {
519    #[doc = "0: The HFPERCLK is undivided"]
520    DIV1 = 0,
521    #[doc = "1: The HFPERCLK is divided by 2"]
522    DIV2 = 1,
523    #[doc = "2: The HFPERCLK is divided by 4"]
524    DIV4 = 2,
525    #[doc = "3: The HFPERCLK is divided by 8"]
526    DIV8 = 3,
527    #[doc = "4: The HFPERCLK is divided by 16"]
528    DIV16 = 4,
529    #[doc = "5: The HFPERCLK is divided by 32"]
530    DIV32 = 5,
531    #[doc = "6: The HFPERCLK is divided by 64"]
532    DIV64 = 6,
533    #[doc = "7: The HFPERCLK is divided by 128"]
534    DIV128 = 7,
535    #[doc = "8: The HFPERCLK is divided by 256"]
536    DIV256 = 8,
537    #[doc = "9: The HFPERCLK is divided by 512"]
538    DIV512 = 9,
539    #[doc = "10: The HFPERCLK is divided by 1024"]
540    DIV1024 = 10,
541}
542impl From<PRESC_A> for u8 {
543    #[inline(always)]
544    fn from(variant: PRESC_A) -> Self {
545        variant as _
546    }
547}
548#[doc = "Reader of field `PRESC`"]
549pub type PRESC_R = crate::R<u8, PRESC_A>;
550impl PRESC_R {
551    #[doc = r"Get enumerated values variant"]
552    #[inline(always)]
553    pub fn variant(&self) -> crate::Variant<u8, PRESC_A> {
554        use crate::Variant::*;
555        match self.bits {
556            0 => Val(PRESC_A::DIV1),
557            1 => Val(PRESC_A::DIV2),
558            2 => Val(PRESC_A::DIV4),
559            3 => Val(PRESC_A::DIV8),
560            4 => Val(PRESC_A::DIV16),
561            5 => Val(PRESC_A::DIV32),
562            6 => Val(PRESC_A::DIV64),
563            7 => Val(PRESC_A::DIV128),
564            8 => Val(PRESC_A::DIV256),
565            9 => Val(PRESC_A::DIV512),
566            10 => Val(PRESC_A::DIV1024),
567            i => Res(i),
568        }
569    }
570    #[doc = "Checks if the value of the field is `DIV1`"]
571    #[inline(always)]
572    pub fn is_div1(&self) -> bool {
573        *self == PRESC_A::DIV1
574    }
575    #[doc = "Checks if the value of the field is `DIV2`"]
576    #[inline(always)]
577    pub fn is_div2(&self) -> bool {
578        *self == PRESC_A::DIV2
579    }
580    #[doc = "Checks if the value of the field is `DIV4`"]
581    #[inline(always)]
582    pub fn is_div4(&self) -> bool {
583        *self == PRESC_A::DIV4
584    }
585    #[doc = "Checks if the value of the field is `DIV8`"]
586    #[inline(always)]
587    pub fn is_div8(&self) -> bool {
588        *self == PRESC_A::DIV8
589    }
590    #[doc = "Checks if the value of the field is `DIV16`"]
591    #[inline(always)]
592    pub fn is_div16(&self) -> bool {
593        *self == PRESC_A::DIV16
594    }
595    #[doc = "Checks if the value of the field is `DIV32`"]
596    #[inline(always)]
597    pub fn is_div32(&self) -> bool {
598        *self == PRESC_A::DIV32
599    }
600    #[doc = "Checks if the value of the field is `DIV64`"]
601    #[inline(always)]
602    pub fn is_div64(&self) -> bool {
603        *self == PRESC_A::DIV64
604    }
605    #[doc = "Checks if the value of the field is `DIV128`"]
606    #[inline(always)]
607    pub fn is_div128(&self) -> bool {
608        *self == PRESC_A::DIV128
609    }
610    #[doc = "Checks if the value of the field is `DIV256`"]
611    #[inline(always)]
612    pub fn is_div256(&self) -> bool {
613        *self == PRESC_A::DIV256
614    }
615    #[doc = "Checks if the value of the field is `DIV512`"]
616    #[inline(always)]
617    pub fn is_div512(&self) -> bool {
618        *self == PRESC_A::DIV512
619    }
620    #[doc = "Checks if the value of the field is `DIV1024`"]
621    #[inline(always)]
622    pub fn is_div1024(&self) -> bool {
623        *self == PRESC_A::DIV1024
624    }
625}
626#[doc = "Write proxy for field `PRESC`"]
627pub struct PRESC_W<'a> {
628    w: &'a mut W,
629}
630impl<'a> PRESC_W<'a> {
631    #[doc = r"Writes `variant` to the field"]
632    #[inline(always)]
633    pub fn variant(self, variant: PRESC_A) -> &'a mut W {
634        unsafe { self.bits(variant.into()) }
635    }
636    #[doc = "The HFPERCLK is undivided"]
637    #[inline(always)]
638    pub fn div1(self) -> &'a mut W {
639        self.variant(PRESC_A::DIV1)
640    }
641    #[doc = "The HFPERCLK is divided by 2"]
642    #[inline(always)]
643    pub fn div2(self) -> &'a mut W {
644        self.variant(PRESC_A::DIV2)
645    }
646    #[doc = "The HFPERCLK is divided by 4"]
647    #[inline(always)]
648    pub fn div4(self) -> &'a mut W {
649        self.variant(PRESC_A::DIV4)
650    }
651    #[doc = "The HFPERCLK is divided by 8"]
652    #[inline(always)]
653    pub fn div8(self) -> &'a mut W {
654        self.variant(PRESC_A::DIV8)
655    }
656    #[doc = "The HFPERCLK is divided by 16"]
657    #[inline(always)]
658    pub fn div16(self) -> &'a mut W {
659        self.variant(PRESC_A::DIV16)
660    }
661    #[doc = "The HFPERCLK is divided by 32"]
662    #[inline(always)]
663    pub fn div32(self) -> &'a mut W {
664        self.variant(PRESC_A::DIV32)
665    }
666    #[doc = "The HFPERCLK is divided by 64"]
667    #[inline(always)]
668    pub fn div64(self) -> &'a mut W {
669        self.variant(PRESC_A::DIV64)
670    }
671    #[doc = "The HFPERCLK is divided by 128"]
672    #[inline(always)]
673    pub fn div128(self) -> &'a mut W {
674        self.variant(PRESC_A::DIV128)
675    }
676    #[doc = "The HFPERCLK is divided by 256"]
677    #[inline(always)]
678    pub fn div256(self) -> &'a mut W {
679        self.variant(PRESC_A::DIV256)
680    }
681    #[doc = "The HFPERCLK is divided by 512"]
682    #[inline(always)]
683    pub fn div512(self) -> &'a mut W {
684        self.variant(PRESC_A::DIV512)
685    }
686    #[doc = "The HFPERCLK is divided by 1024"]
687    #[inline(always)]
688    pub fn div1024(self) -> &'a mut W {
689        self.variant(PRESC_A::DIV1024)
690    }
691    #[doc = r"Writes raw bits to the field"]
692    #[inline(always)]
693    pub unsafe fn bits(self, value: u8) -> &'a mut W {
694        self.w.bits = (self.w.bits & !(0x0f << 24)) | (((value as u32) & 0x0f) << 24);
695        self.w
696    }
697}
698#[doc = "Reader of field `ATI`"]
699pub type ATI_R = crate::R<bool, bool>;
700#[doc = "Write proxy for field `ATI`"]
701pub struct ATI_W<'a> {
702    w: &'a mut W,
703}
704impl<'a> ATI_W<'a> {
705    #[doc = r"Sets the field bit"]
706    #[inline(always)]
707    pub fn set_bit(self) -> &'a mut W {
708        self.bit(true)
709    }
710    #[doc = r"Clears the field bit"]
711    #[inline(always)]
712    pub fn clear_bit(self) -> &'a mut W {
713        self.bit(false)
714    }
715    #[doc = r"Writes raw bits to the field"]
716    #[inline(always)]
717    pub fn bit(self, value: bool) -> &'a mut W {
718        self.w.bits = (self.w.bits & !(0x01 << 28)) | (((value as u32) & 0x01) << 28);
719        self.w
720    }
721}
722#[doc = "Reader of field `RSSCOIST`"]
723pub type RSSCOIST_R = crate::R<bool, bool>;
724#[doc = "Write proxy for field `RSSCOIST`"]
725pub struct RSSCOIST_W<'a> {
726    w: &'a mut W,
727}
728impl<'a> RSSCOIST_W<'a> {
729    #[doc = r"Sets the field bit"]
730    #[inline(always)]
731    pub fn set_bit(self) -> &'a mut W {
732        self.bit(true)
733    }
734    #[doc = r"Clears the field bit"]
735    #[inline(always)]
736    pub fn clear_bit(self) -> &'a mut W {
737        self.bit(false)
738    }
739    #[doc = r"Writes raw bits to the field"]
740    #[inline(always)]
741    pub fn bit(self, value: bool) -> &'a mut W {
742        self.w.bits = (self.w.bits & !(0x01 << 29)) | (((value as u32) & 0x01) << 29);
743        self.w
744    }
745}
746impl R {
747    #[doc = "Bits 0:1 - Timer Mode"]
748    #[inline(always)]
749    pub fn mode(&self) -> MODE_R {
750        MODE_R::new((self.bits & 0x03) as u8)
751    }
752    #[doc = "Bit 3 - Timer Start/Stop/Reload Synchronization"]
753    #[inline(always)]
754    pub fn sync(&self) -> SYNC_R {
755        SYNC_R::new(((self.bits >> 3) & 0x01) != 0)
756    }
757    #[doc = "Bit 4 - One-shot Mode Enable"]
758    #[inline(always)]
759    pub fn osmen(&self) -> OSMEN_R {
760        OSMEN_R::new(((self.bits >> 4) & 0x01) != 0)
761    }
762    #[doc = "Bit 5 - Quadrature Decoder Mode Selection"]
763    #[inline(always)]
764    pub fn qdm(&self) -> QDM_R {
765        QDM_R::new(((self.bits >> 5) & 0x01) != 0)
766    }
767    #[doc = "Bit 6 - Debug Mode Run Enable"]
768    #[inline(always)]
769    pub fn debugrun(&self) -> DEBUGRUN_R {
770        DEBUGRUN_R::new(((self.bits >> 6) & 0x01) != 0)
771    }
772    #[doc = "Bit 7 - DMA Request Clear on Active"]
773    #[inline(always)]
774    pub fn dmaclract(&self) -> DMACLRACT_R {
775        DMACLRACT_R::new(((self.bits >> 7) & 0x01) != 0)
776    }
777    #[doc = "Bits 8:9 - Timer Rising Input Edge Action"]
778    #[inline(always)]
779    pub fn risea(&self) -> RISEA_R {
780        RISEA_R::new(((self.bits >> 8) & 0x03) as u8)
781    }
782    #[doc = "Bits 10:11 - Timer Falling Input Edge Action"]
783    #[inline(always)]
784    pub fn falla(&self) -> FALLA_R {
785        FALLA_R::new(((self.bits >> 10) & 0x03) as u8)
786    }
787    #[doc = "Bit 13 - 2x Count Mode"]
788    #[inline(always)]
789    pub fn x2cnt(&self) -> X2CNT_R {
790        X2CNT_R::new(((self.bits >> 13) & 0x01) != 0)
791    }
792    #[doc = "Bits 16:17 - Clock Source Select"]
793    #[inline(always)]
794    pub fn clksel(&self) -> CLKSEL_R {
795        CLKSEL_R::new(((self.bits >> 16) & 0x03) as u8)
796    }
797    #[doc = "Bits 24:27 - Prescaler Setting"]
798    #[inline(always)]
799    pub fn presc(&self) -> PRESC_R {
800        PRESC_R::new(((self.bits >> 24) & 0x0f) as u8)
801    }
802    #[doc = "Bit 28 - Always Track Inputs"]
803    #[inline(always)]
804    pub fn ati(&self) -> ATI_R {
805        ATI_R::new(((self.bits >> 28) & 0x01) != 0)
806    }
807    #[doc = "Bit 29 - Reload-Start Sets Compare Output Initial State"]
808    #[inline(always)]
809    pub fn rsscoist(&self) -> RSSCOIST_R {
810        RSSCOIST_R::new(((self.bits >> 29) & 0x01) != 0)
811    }
812}
813impl W {
814    #[doc = "Bits 0:1 - Timer Mode"]
815    #[inline(always)]
816    pub fn mode(&mut self) -> MODE_W {
817        MODE_W { w: self }
818    }
819    #[doc = "Bit 3 - Timer Start/Stop/Reload Synchronization"]
820    #[inline(always)]
821    pub fn sync(&mut self) -> SYNC_W {
822        SYNC_W { w: self }
823    }
824    #[doc = "Bit 4 - One-shot Mode Enable"]
825    #[inline(always)]
826    pub fn osmen(&mut self) -> OSMEN_W {
827        OSMEN_W { w: self }
828    }
829    #[doc = "Bit 5 - Quadrature Decoder Mode Selection"]
830    #[inline(always)]
831    pub fn qdm(&mut self) -> QDM_W {
832        QDM_W { w: self }
833    }
834    #[doc = "Bit 6 - Debug Mode Run Enable"]
835    #[inline(always)]
836    pub fn debugrun(&mut self) -> DEBUGRUN_W {
837        DEBUGRUN_W { w: self }
838    }
839    #[doc = "Bit 7 - DMA Request Clear on Active"]
840    #[inline(always)]
841    pub fn dmaclract(&mut self) -> DMACLRACT_W {
842        DMACLRACT_W { w: self }
843    }
844    #[doc = "Bits 8:9 - Timer Rising Input Edge Action"]
845    #[inline(always)]
846    pub fn risea(&mut self) -> RISEA_W {
847        RISEA_W { w: self }
848    }
849    #[doc = "Bits 10:11 - Timer Falling Input Edge Action"]
850    #[inline(always)]
851    pub fn falla(&mut self) -> FALLA_W {
852        FALLA_W { w: self }
853    }
854    #[doc = "Bit 13 - 2x Count Mode"]
855    #[inline(always)]
856    pub fn x2cnt(&mut self) -> X2CNT_W {
857        X2CNT_W { w: self }
858    }
859    #[doc = "Bits 16:17 - Clock Source Select"]
860    #[inline(always)]
861    pub fn clksel(&mut self) -> CLKSEL_W {
862        CLKSEL_W { w: self }
863    }
864    #[doc = "Bits 24:27 - Prescaler Setting"]
865    #[inline(always)]
866    pub fn presc(&mut self) -> PRESC_W {
867        PRESC_W { w: self }
868    }
869    #[doc = "Bit 28 - Always Track Inputs"]
870    #[inline(always)]
871    pub fn ati(&mut self) -> ATI_W {
872        ATI_W { w: self }
873    }
874    #[doc = "Bit 29 - Reload-Start Sets Compare Output Initial State"]
875    #[inline(always)]
876    pub fn rsscoist(&mut self) -> RSSCOIST_W {
877        RSSCOIST_W { w: self }
878    }
879}