s32k118_pac/lpit0/
tctrl0.rs

1#[doc = "Register `TCTRL0` reader"]
2pub struct R(crate::R<TCTRL0_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<TCTRL0_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<TCTRL0_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<TCTRL0_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `TCTRL0` writer"]
17pub struct W(crate::W<TCTRL0_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<TCTRL0_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<TCTRL0_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<TCTRL0_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Timer Enable\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum T_EN_A {
40    #[doc = "0: Timer Channel is disabled"]
41    _0 = 0,
42    #[doc = "1: Timer Channel is enabled"]
43    _1 = 1,
44}
45impl From<T_EN_A> for bool {
46    #[inline(always)]
47    fn from(variant: T_EN_A) -> Self {
48        variant as u8 != 0
49    }
50}
51#[doc = "Field `T_EN` reader - Timer Enable"]
52pub struct T_EN_R(crate::FieldReader<bool, T_EN_A>);
53impl T_EN_R {
54    #[inline(always)]
55    pub(crate) fn new(bits: bool) -> Self {
56        T_EN_R(crate::FieldReader::new(bits))
57    }
58    #[doc = r"Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> T_EN_A {
61        match self.bits {
62            false => T_EN_A::_0,
63            true => T_EN_A::_1,
64        }
65    }
66    #[doc = "Checks if the value of the field is `_0`"]
67    #[inline(always)]
68    pub fn is_0(&self) -> bool {
69        **self == T_EN_A::_0
70    }
71    #[doc = "Checks if the value of the field is `_1`"]
72    #[inline(always)]
73    pub fn is_1(&self) -> bool {
74        **self == T_EN_A::_1
75    }
76}
77impl core::ops::Deref for T_EN_R {
78    type Target = crate::FieldReader<bool, T_EN_A>;
79    #[inline(always)]
80    fn deref(&self) -> &Self::Target {
81        &self.0
82    }
83}
84#[doc = "Field `T_EN` writer - Timer Enable"]
85pub struct T_EN_W<'a> {
86    w: &'a mut W,
87}
88impl<'a> T_EN_W<'a> {
89    #[doc = r"Writes `variant` to the field"]
90    #[inline(always)]
91    pub fn variant(self, variant: T_EN_A) -> &'a mut W {
92        self.bit(variant.into())
93    }
94    #[doc = "Timer Channel is disabled"]
95    #[inline(always)]
96    pub fn _0(self) -> &'a mut W {
97        self.variant(T_EN_A::_0)
98    }
99    #[doc = "Timer Channel is enabled"]
100    #[inline(always)]
101    pub fn _1(self) -> &'a mut W {
102        self.variant(T_EN_A::_1)
103    }
104    #[doc = r"Sets the field bit"]
105    #[inline(always)]
106    pub fn set_bit(self) -> &'a mut W {
107        self.bit(true)
108    }
109    #[doc = r"Clears the field bit"]
110    #[inline(always)]
111    pub fn clear_bit(self) -> &'a mut W {
112        self.bit(false)
113    }
114    #[doc = r"Writes raw bits to the field"]
115    #[inline(always)]
116    pub fn bit(self, value: bool) -> &'a mut W {
117        self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
118        self.w
119    }
120}
121#[doc = "Chain Channel\n\nValue on reset: 0"]
122#[derive(Clone, Copy, Debug, PartialEq)]
123pub enum CHAIN_A {
124    #[doc = "0: Channel Chaining is disabled. Channel Timer runs independently."]
125    _0 = 0,
126    #[doc = "1: Channel Chaining is enabled. Timer decrements on previous channel's timeout"]
127    _1 = 1,
128}
129impl From<CHAIN_A> for bool {
130    #[inline(always)]
131    fn from(variant: CHAIN_A) -> Self {
132        variant as u8 != 0
133    }
134}
135#[doc = "Field `CHAIN` reader - Chain Channel"]
136pub struct CHAIN_R(crate::FieldReader<bool, CHAIN_A>);
137impl CHAIN_R {
138    #[inline(always)]
139    pub(crate) fn new(bits: bool) -> Self {
140        CHAIN_R(crate::FieldReader::new(bits))
141    }
142    #[doc = r"Get enumerated values variant"]
143    #[inline(always)]
144    pub fn variant(&self) -> CHAIN_A {
145        match self.bits {
146            false => CHAIN_A::_0,
147            true => CHAIN_A::_1,
148        }
149    }
150    #[doc = "Checks if the value of the field is `_0`"]
151    #[inline(always)]
152    pub fn is_0(&self) -> bool {
153        **self == CHAIN_A::_0
154    }
155    #[doc = "Checks if the value of the field is `_1`"]
156    #[inline(always)]
157    pub fn is_1(&self) -> bool {
158        **self == CHAIN_A::_1
159    }
160}
161impl core::ops::Deref for CHAIN_R {
162    type Target = crate::FieldReader<bool, CHAIN_A>;
163    #[inline(always)]
164    fn deref(&self) -> &Self::Target {
165        &self.0
166    }
167}
168#[doc = "Field `CHAIN` writer - Chain Channel"]
169pub struct CHAIN_W<'a> {
170    w: &'a mut W,
171}
172impl<'a> CHAIN_W<'a> {
173    #[doc = r"Writes `variant` to the field"]
174    #[inline(always)]
175    pub fn variant(self, variant: CHAIN_A) -> &'a mut W {
176        self.bit(variant.into())
177    }
178    #[doc = "Channel Chaining is disabled. Channel Timer runs independently."]
179    #[inline(always)]
180    pub fn _0(self) -> &'a mut W {
181        self.variant(CHAIN_A::_0)
182    }
183    #[doc = "Channel Chaining is enabled. Timer decrements on previous channel's timeout"]
184    #[inline(always)]
185    pub fn _1(self) -> &'a mut W {
186        self.variant(CHAIN_A::_1)
187    }
188    #[doc = r"Sets the field bit"]
189    #[inline(always)]
190    pub fn set_bit(self) -> &'a mut W {
191        self.bit(true)
192    }
193    #[doc = r"Clears the field bit"]
194    #[inline(always)]
195    pub fn clear_bit(self) -> &'a mut W {
196        self.bit(false)
197    }
198    #[doc = r"Writes raw bits to the field"]
199    #[inline(always)]
200    pub fn bit(self, value: bool) -> &'a mut W {
201        self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
202        self.w
203    }
204}
205#[doc = "Timer Operation Mode\n\nValue on reset: 0"]
206#[derive(Clone, Copy, Debug, PartialEq)]
207#[repr(u8)]
208pub enum MODE_A {
209    #[doc = "0: 32-bit Periodic Counter"]
210    _0 = 0,
211    #[doc = "1: Dual 16-bit Periodic Counter"]
212    _1 = 1,
213    #[doc = "2: 32-bit Trigger Accumulator"]
214    _10 = 2,
215    #[doc = "3: 32-bit Trigger Input Capture"]
216    _11 = 3,
217}
218impl From<MODE_A> for u8 {
219    #[inline(always)]
220    fn from(variant: MODE_A) -> Self {
221        variant as _
222    }
223}
224#[doc = "Field `MODE` reader - Timer Operation Mode"]
225pub struct MODE_R(crate::FieldReader<u8, MODE_A>);
226impl MODE_R {
227    #[inline(always)]
228    pub(crate) fn new(bits: u8) -> Self {
229        MODE_R(crate::FieldReader::new(bits))
230    }
231    #[doc = r"Get enumerated values variant"]
232    #[inline(always)]
233    pub fn variant(&self) -> MODE_A {
234        match self.bits {
235            0 => MODE_A::_0,
236            1 => MODE_A::_1,
237            2 => MODE_A::_10,
238            3 => MODE_A::_11,
239            _ => unreachable!(),
240        }
241    }
242    #[doc = "Checks if the value of the field is `_0`"]
243    #[inline(always)]
244    pub fn is_0(&self) -> bool {
245        **self == MODE_A::_0
246    }
247    #[doc = "Checks if the value of the field is `_1`"]
248    #[inline(always)]
249    pub fn is_1(&self) -> bool {
250        **self == MODE_A::_1
251    }
252    #[doc = "Checks if the value of the field is `_10`"]
253    #[inline(always)]
254    pub fn is_10(&self) -> bool {
255        **self == MODE_A::_10
256    }
257    #[doc = "Checks if the value of the field is `_11`"]
258    #[inline(always)]
259    pub fn is_11(&self) -> bool {
260        **self == MODE_A::_11
261    }
262}
263impl core::ops::Deref for MODE_R {
264    type Target = crate::FieldReader<u8, MODE_A>;
265    #[inline(always)]
266    fn deref(&self) -> &Self::Target {
267        &self.0
268    }
269}
270#[doc = "Field `MODE` writer - Timer Operation Mode"]
271pub struct MODE_W<'a> {
272    w: &'a mut W,
273}
274impl<'a> MODE_W<'a> {
275    #[doc = r"Writes `variant` to the field"]
276    #[inline(always)]
277    pub fn variant(self, variant: MODE_A) -> &'a mut W {
278        self.bits(variant.into())
279    }
280    #[doc = "32-bit Periodic Counter"]
281    #[inline(always)]
282    pub fn _0(self) -> &'a mut W {
283        self.variant(MODE_A::_0)
284    }
285    #[doc = "Dual 16-bit Periodic Counter"]
286    #[inline(always)]
287    pub fn _1(self) -> &'a mut W {
288        self.variant(MODE_A::_1)
289    }
290    #[doc = "32-bit Trigger Accumulator"]
291    #[inline(always)]
292    pub fn _10(self) -> &'a mut W {
293        self.variant(MODE_A::_10)
294    }
295    #[doc = "32-bit Trigger Input Capture"]
296    #[inline(always)]
297    pub fn _11(self) -> &'a mut W {
298        self.variant(MODE_A::_11)
299    }
300    #[doc = r"Writes raw bits to the field"]
301    #[inline(always)]
302    pub fn bits(self, value: u8) -> &'a mut W {
303        self.w.bits = (self.w.bits & !(0x03 << 2)) | ((value as u32 & 0x03) << 2);
304        self.w
305    }
306}
307#[doc = "Timer Start On Trigger\n\nValue on reset: 0"]
308#[derive(Clone, Copy, Debug, PartialEq)]
309pub enum TSOT_A {
310    #[doc = "0: Timer starts to decrement immediately based on restart condition (controlled by TSOI bit)"]
311    _0 = 0,
312    #[doc = "1: Timer starts to decrement when rising edge on selected trigger is detected"]
313    _1 = 1,
314}
315impl From<TSOT_A> for bool {
316    #[inline(always)]
317    fn from(variant: TSOT_A) -> Self {
318        variant as u8 != 0
319    }
320}
321#[doc = "Field `TSOT` reader - Timer Start On Trigger"]
322pub struct TSOT_R(crate::FieldReader<bool, TSOT_A>);
323impl TSOT_R {
324    #[inline(always)]
325    pub(crate) fn new(bits: bool) -> Self {
326        TSOT_R(crate::FieldReader::new(bits))
327    }
328    #[doc = r"Get enumerated values variant"]
329    #[inline(always)]
330    pub fn variant(&self) -> TSOT_A {
331        match self.bits {
332            false => TSOT_A::_0,
333            true => TSOT_A::_1,
334        }
335    }
336    #[doc = "Checks if the value of the field is `_0`"]
337    #[inline(always)]
338    pub fn is_0(&self) -> bool {
339        **self == TSOT_A::_0
340    }
341    #[doc = "Checks if the value of the field is `_1`"]
342    #[inline(always)]
343    pub fn is_1(&self) -> bool {
344        **self == TSOT_A::_1
345    }
346}
347impl core::ops::Deref for TSOT_R {
348    type Target = crate::FieldReader<bool, TSOT_A>;
349    #[inline(always)]
350    fn deref(&self) -> &Self::Target {
351        &self.0
352    }
353}
354#[doc = "Field `TSOT` writer - Timer Start On Trigger"]
355pub struct TSOT_W<'a> {
356    w: &'a mut W,
357}
358impl<'a> TSOT_W<'a> {
359    #[doc = r"Writes `variant` to the field"]
360    #[inline(always)]
361    pub fn variant(self, variant: TSOT_A) -> &'a mut W {
362        self.bit(variant.into())
363    }
364    #[doc = "Timer starts to decrement immediately based on restart condition (controlled by TSOI bit)"]
365    #[inline(always)]
366    pub fn _0(self) -> &'a mut W {
367        self.variant(TSOT_A::_0)
368    }
369    #[doc = "Timer starts to decrement when rising edge on selected trigger is detected"]
370    #[inline(always)]
371    pub fn _1(self) -> &'a mut W {
372        self.variant(TSOT_A::_1)
373    }
374    #[doc = r"Sets the field bit"]
375    #[inline(always)]
376    pub fn set_bit(self) -> &'a mut W {
377        self.bit(true)
378    }
379    #[doc = r"Clears the field bit"]
380    #[inline(always)]
381    pub fn clear_bit(self) -> &'a mut W {
382        self.bit(false)
383    }
384    #[doc = r"Writes raw bits to the field"]
385    #[inline(always)]
386    pub fn bit(self, value: bool) -> &'a mut W {
387        self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
388        self.w
389    }
390}
391#[doc = "Timer Stop On Interrupt\n\nValue on reset: 0"]
392#[derive(Clone, Copy, Debug, PartialEq)]
393pub enum TSOI_A {
394    #[doc = "0: The channel timer does not stop after timeout."]
395    _0 = 0,
396    #[doc = "1: The channel timer will stop after a timeout, and the channel timer will restart based on TSOT. When TSOT = 0, the channel timer will restart after a rising edge on the T_EN bit is detected (which means that the timer channel is disabled and then enabled); when TSOT = 1, the channel timer will restart after a rising edge on the selected trigger is detected."]
397    _1 = 1,
398}
399impl From<TSOI_A> for bool {
400    #[inline(always)]
401    fn from(variant: TSOI_A) -> Self {
402        variant as u8 != 0
403    }
404}
405#[doc = "Field `TSOI` reader - Timer Stop On Interrupt"]
406pub struct TSOI_R(crate::FieldReader<bool, TSOI_A>);
407impl TSOI_R {
408    #[inline(always)]
409    pub(crate) fn new(bits: bool) -> Self {
410        TSOI_R(crate::FieldReader::new(bits))
411    }
412    #[doc = r"Get enumerated values variant"]
413    #[inline(always)]
414    pub fn variant(&self) -> TSOI_A {
415        match self.bits {
416            false => TSOI_A::_0,
417            true => TSOI_A::_1,
418        }
419    }
420    #[doc = "Checks if the value of the field is `_0`"]
421    #[inline(always)]
422    pub fn is_0(&self) -> bool {
423        **self == TSOI_A::_0
424    }
425    #[doc = "Checks if the value of the field is `_1`"]
426    #[inline(always)]
427    pub fn is_1(&self) -> bool {
428        **self == TSOI_A::_1
429    }
430}
431impl core::ops::Deref for TSOI_R {
432    type Target = crate::FieldReader<bool, TSOI_A>;
433    #[inline(always)]
434    fn deref(&self) -> &Self::Target {
435        &self.0
436    }
437}
438#[doc = "Field `TSOI` writer - Timer Stop On Interrupt"]
439pub struct TSOI_W<'a> {
440    w: &'a mut W,
441}
442impl<'a> TSOI_W<'a> {
443    #[doc = r"Writes `variant` to the field"]
444    #[inline(always)]
445    pub fn variant(self, variant: TSOI_A) -> &'a mut W {
446        self.bit(variant.into())
447    }
448    #[doc = "The channel timer does not stop after timeout."]
449    #[inline(always)]
450    pub fn _0(self) -> &'a mut W {
451        self.variant(TSOI_A::_0)
452    }
453    #[doc = "The channel timer will stop after a timeout, and the channel timer will restart based on TSOT. When TSOT = 0, the channel timer will restart after a rising edge on the T_EN bit is detected (which means that the timer channel is disabled and then enabled); when TSOT = 1, the channel timer will restart after a rising edge on the selected trigger is detected."]
454    #[inline(always)]
455    pub fn _1(self) -> &'a mut W {
456        self.variant(TSOI_A::_1)
457    }
458    #[doc = r"Sets the field bit"]
459    #[inline(always)]
460    pub fn set_bit(self) -> &'a mut W {
461        self.bit(true)
462    }
463    #[doc = r"Clears the field bit"]
464    #[inline(always)]
465    pub fn clear_bit(self) -> &'a mut W {
466        self.bit(false)
467    }
468    #[doc = r"Writes raw bits to the field"]
469    #[inline(always)]
470    pub fn bit(self, value: bool) -> &'a mut W {
471        self.w.bits = (self.w.bits & !(0x01 << 17)) | ((value as u32 & 0x01) << 17);
472        self.w
473    }
474}
475#[doc = "Timer Reload On Trigger\n\nValue on reset: 0"]
476#[derive(Clone, Copy, Debug, PartialEq)]
477pub enum TROT_A {
478    #[doc = "0: Timer will not reload on selected trigger"]
479    _0 = 0,
480    #[doc = "1: Timer will reload on selected trigger"]
481    _1 = 1,
482}
483impl From<TROT_A> for bool {
484    #[inline(always)]
485    fn from(variant: TROT_A) -> Self {
486        variant as u8 != 0
487    }
488}
489#[doc = "Field `TROT` reader - Timer Reload On Trigger"]
490pub struct TROT_R(crate::FieldReader<bool, TROT_A>);
491impl TROT_R {
492    #[inline(always)]
493    pub(crate) fn new(bits: bool) -> Self {
494        TROT_R(crate::FieldReader::new(bits))
495    }
496    #[doc = r"Get enumerated values variant"]
497    #[inline(always)]
498    pub fn variant(&self) -> TROT_A {
499        match self.bits {
500            false => TROT_A::_0,
501            true => TROT_A::_1,
502        }
503    }
504    #[doc = "Checks if the value of the field is `_0`"]
505    #[inline(always)]
506    pub fn is_0(&self) -> bool {
507        **self == TROT_A::_0
508    }
509    #[doc = "Checks if the value of the field is `_1`"]
510    #[inline(always)]
511    pub fn is_1(&self) -> bool {
512        **self == TROT_A::_1
513    }
514}
515impl core::ops::Deref for TROT_R {
516    type Target = crate::FieldReader<bool, TROT_A>;
517    #[inline(always)]
518    fn deref(&self) -> &Self::Target {
519        &self.0
520    }
521}
522#[doc = "Field `TROT` writer - Timer Reload On Trigger"]
523pub struct TROT_W<'a> {
524    w: &'a mut W,
525}
526impl<'a> TROT_W<'a> {
527    #[doc = r"Writes `variant` to the field"]
528    #[inline(always)]
529    pub fn variant(self, variant: TROT_A) -> &'a mut W {
530        self.bit(variant.into())
531    }
532    #[doc = "Timer will not reload on selected trigger"]
533    #[inline(always)]
534    pub fn _0(self) -> &'a mut W {
535        self.variant(TROT_A::_0)
536    }
537    #[doc = "Timer will reload on selected trigger"]
538    #[inline(always)]
539    pub fn _1(self) -> &'a mut W {
540        self.variant(TROT_A::_1)
541    }
542    #[doc = r"Sets the field bit"]
543    #[inline(always)]
544    pub fn set_bit(self) -> &'a mut W {
545        self.bit(true)
546    }
547    #[doc = r"Clears the field bit"]
548    #[inline(always)]
549    pub fn clear_bit(self) -> &'a mut W {
550        self.bit(false)
551    }
552    #[doc = r"Writes raw bits to the field"]
553    #[inline(always)]
554    pub fn bit(self, value: bool) -> &'a mut W {
555        self.w.bits = (self.w.bits & !(0x01 << 18)) | ((value as u32 & 0x01) << 18);
556        self.w
557    }
558}
559#[doc = "Trigger Source\n\nValue on reset: 0"]
560#[derive(Clone, Copy, Debug, PartialEq)]
561pub enum TRG_SRC_A {
562    #[doc = "0: Trigger source selected in external"]
563    _0 = 0,
564    #[doc = "1: Trigger source selected is the internal trigger"]
565    _1 = 1,
566}
567impl From<TRG_SRC_A> for bool {
568    #[inline(always)]
569    fn from(variant: TRG_SRC_A) -> Self {
570        variant as u8 != 0
571    }
572}
573#[doc = "Field `TRG_SRC` reader - Trigger Source"]
574pub struct TRG_SRC_R(crate::FieldReader<bool, TRG_SRC_A>);
575impl TRG_SRC_R {
576    #[inline(always)]
577    pub(crate) fn new(bits: bool) -> Self {
578        TRG_SRC_R(crate::FieldReader::new(bits))
579    }
580    #[doc = r"Get enumerated values variant"]
581    #[inline(always)]
582    pub fn variant(&self) -> TRG_SRC_A {
583        match self.bits {
584            false => TRG_SRC_A::_0,
585            true => TRG_SRC_A::_1,
586        }
587    }
588    #[doc = "Checks if the value of the field is `_0`"]
589    #[inline(always)]
590    pub fn is_0(&self) -> bool {
591        **self == TRG_SRC_A::_0
592    }
593    #[doc = "Checks if the value of the field is `_1`"]
594    #[inline(always)]
595    pub fn is_1(&self) -> bool {
596        **self == TRG_SRC_A::_1
597    }
598}
599impl core::ops::Deref for TRG_SRC_R {
600    type Target = crate::FieldReader<bool, TRG_SRC_A>;
601    #[inline(always)]
602    fn deref(&self) -> &Self::Target {
603        &self.0
604    }
605}
606#[doc = "Field `TRG_SRC` writer - Trigger Source"]
607pub struct TRG_SRC_W<'a> {
608    w: &'a mut W,
609}
610impl<'a> TRG_SRC_W<'a> {
611    #[doc = r"Writes `variant` to the field"]
612    #[inline(always)]
613    pub fn variant(self, variant: TRG_SRC_A) -> &'a mut W {
614        self.bit(variant.into())
615    }
616    #[doc = "Trigger source selected in external"]
617    #[inline(always)]
618    pub fn _0(self) -> &'a mut W {
619        self.variant(TRG_SRC_A::_0)
620    }
621    #[doc = "Trigger source selected is the internal trigger"]
622    #[inline(always)]
623    pub fn _1(self) -> &'a mut W {
624        self.variant(TRG_SRC_A::_1)
625    }
626    #[doc = r"Sets the field bit"]
627    #[inline(always)]
628    pub fn set_bit(self) -> &'a mut W {
629        self.bit(true)
630    }
631    #[doc = r"Clears the field bit"]
632    #[inline(always)]
633    pub fn clear_bit(self) -> &'a mut W {
634        self.bit(false)
635    }
636    #[doc = r"Writes raw bits to the field"]
637    #[inline(always)]
638    pub fn bit(self, value: bool) -> &'a mut W {
639        self.w.bits = (self.w.bits & !(0x01 << 23)) | ((value as u32 & 0x01) << 23);
640        self.w
641    }
642}
643#[doc = "Field `TRG_SEL` reader - Trigger Select"]
644pub struct TRG_SEL_R(crate::FieldReader<u8, u8>);
645impl TRG_SEL_R {
646    #[inline(always)]
647    pub(crate) fn new(bits: u8) -> Self {
648        TRG_SEL_R(crate::FieldReader::new(bits))
649    }
650}
651impl core::ops::Deref for TRG_SEL_R {
652    type Target = crate::FieldReader<u8, u8>;
653    #[inline(always)]
654    fn deref(&self) -> &Self::Target {
655        &self.0
656    }
657}
658#[doc = "Field `TRG_SEL` writer - Trigger Select"]
659pub struct TRG_SEL_W<'a> {
660    w: &'a mut W,
661}
662impl<'a> TRG_SEL_W<'a> {
663    #[doc = r"Writes raw bits to the field"]
664    #[inline(always)]
665    pub unsafe fn bits(self, value: u8) -> &'a mut W {
666        self.w.bits = (self.w.bits & !(0x0f << 24)) | ((value as u32 & 0x0f) << 24);
667        self.w
668    }
669}
670impl R {
671    #[doc = "Bit 0 - Timer Enable"]
672    #[inline(always)]
673    pub fn t_en(&self) -> T_EN_R {
674        T_EN_R::new((self.bits & 0x01) != 0)
675    }
676    #[doc = "Bit 1 - Chain Channel"]
677    #[inline(always)]
678    pub fn chain(&self) -> CHAIN_R {
679        CHAIN_R::new(((self.bits >> 1) & 0x01) != 0)
680    }
681    #[doc = "Bits 2:3 - Timer Operation Mode"]
682    #[inline(always)]
683    pub fn mode(&self) -> MODE_R {
684        MODE_R::new(((self.bits >> 2) & 0x03) as u8)
685    }
686    #[doc = "Bit 16 - Timer Start On Trigger"]
687    #[inline(always)]
688    pub fn tsot(&self) -> TSOT_R {
689        TSOT_R::new(((self.bits >> 16) & 0x01) != 0)
690    }
691    #[doc = "Bit 17 - Timer Stop On Interrupt"]
692    #[inline(always)]
693    pub fn tsoi(&self) -> TSOI_R {
694        TSOI_R::new(((self.bits >> 17) & 0x01) != 0)
695    }
696    #[doc = "Bit 18 - Timer Reload On Trigger"]
697    #[inline(always)]
698    pub fn trot(&self) -> TROT_R {
699        TROT_R::new(((self.bits >> 18) & 0x01) != 0)
700    }
701    #[doc = "Bit 23 - Trigger Source"]
702    #[inline(always)]
703    pub fn trg_src(&self) -> TRG_SRC_R {
704        TRG_SRC_R::new(((self.bits >> 23) & 0x01) != 0)
705    }
706    #[doc = "Bits 24:27 - Trigger Select"]
707    #[inline(always)]
708    pub fn trg_sel(&self) -> TRG_SEL_R {
709        TRG_SEL_R::new(((self.bits >> 24) & 0x0f) as u8)
710    }
711}
712impl W {
713    #[doc = "Bit 0 - Timer Enable"]
714    #[inline(always)]
715    pub fn t_en(&mut self) -> T_EN_W {
716        T_EN_W { w: self }
717    }
718    #[doc = "Bit 1 - Chain Channel"]
719    #[inline(always)]
720    pub fn chain(&mut self) -> CHAIN_W {
721        CHAIN_W { w: self }
722    }
723    #[doc = "Bits 2:3 - Timer Operation Mode"]
724    #[inline(always)]
725    pub fn mode(&mut self) -> MODE_W {
726        MODE_W { w: self }
727    }
728    #[doc = "Bit 16 - Timer Start On Trigger"]
729    #[inline(always)]
730    pub fn tsot(&mut self) -> TSOT_W {
731        TSOT_W { w: self }
732    }
733    #[doc = "Bit 17 - Timer Stop On Interrupt"]
734    #[inline(always)]
735    pub fn tsoi(&mut self) -> TSOI_W {
736        TSOI_W { w: self }
737    }
738    #[doc = "Bit 18 - Timer Reload On Trigger"]
739    #[inline(always)]
740    pub fn trot(&mut self) -> TROT_W {
741        TROT_W { w: self }
742    }
743    #[doc = "Bit 23 - Trigger Source"]
744    #[inline(always)]
745    pub fn trg_src(&mut self) -> TRG_SRC_W {
746        TRG_SRC_W { w: self }
747    }
748    #[doc = "Bits 24:27 - Trigger Select"]
749    #[inline(always)]
750    pub fn trg_sel(&mut self) -> TRG_SEL_W {
751        TRG_SEL_W { w: self }
752    }
753    #[doc = "Writes raw bits to the register."]
754    #[inline(always)]
755    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
756        self.0.bits(bits);
757        self
758    }
759}
760#[doc = "Timer Control Register\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).\n\nFor information about available fields see [tctrl0](index.html) module"]
761pub struct TCTRL0_SPEC;
762impl crate::RegisterSpec for TCTRL0_SPEC {
763    type Ux = u32;
764}
765#[doc = "`read()` method returns [tctrl0::R](R) reader structure"]
766impl crate::Readable for TCTRL0_SPEC {
767    type Reader = R;
768}
769#[doc = "`write(|w| ..)` method takes [tctrl0::W](W) writer structure"]
770impl crate::Writable for TCTRL0_SPEC {
771    type Writer = W;
772}
773#[doc = "`reset()` method sets TCTRL0 to value 0"]
774impl crate::Resettable for TCTRL0_SPEC {
775    #[inline(always)]
776    fn reset_value() -> Self::Ux {
777        0
778    }
779}