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