msp430f5529/timer_0_b7/
tb0cctl4.rs

1#[doc = "Register `TB0CCTL4` reader"]
2pub struct R(crate::R<TB0CCTL4_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<TB0CCTL4_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<TB0CCTL4_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<TB0CCTL4_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `TB0CCTL4` writer"]
17pub struct W(crate::W<TB0CCTL4_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<TB0CCTL4_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<TB0CCTL4_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<TB0CCTL4_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CCIFG` reader - Capture/compare interrupt flag"]
38pub struct CCIFG_R(crate::FieldReader<bool, bool>);
39impl CCIFG_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: bool) -> Self {
42        CCIFG_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for CCIFG_R {
46    type Target = crate::FieldReader<bool, bool>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `CCIFG` writer - Capture/compare interrupt flag"]
53pub struct CCIFG_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> CCIFG_W<'a> {
57    #[doc = r"Sets the field bit"]
58    #[inline(always)]
59    pub fn set_bit(self) -> &'a mut W {
60        self.bit(true)
61    }
62    #[doc = r"Clears the field bit"]
63    #[inline(always)]
64    pub fn clear_bit(self) -> &'a mut W {
65        self.bit(false)
66    }
67    #[doc = r"Writes raw bits to the field"]
68    #[inline(always)]
69    pub fn bit(self, value: bool) -> &'a mut W {
70        self.w.bits = (self.w.bits & !0x01) | (value as u16 & 0x01);
71        self.w
72    }
73}
74#[doc = "Field `COV` reader - Capture/compare overflow flag"]
75pub struct COV_R(crate::FieldReader<bool, bool>);
76impl COV_R {
77    #[inline(always)]
78    pub(crate) fn new(bits: bool) -> Self {
79        COV_R(crate::FieldReader::new(bits))
80    }
81}
82impl core::ops::Deref for COV_R {
83    type Target = crate::FieldReader<bool, bool>;
84    #[inline(always)]
85    fn deref(&self) -> &Self::Target {
86        &self.0
87    }
88}
89#[doc = "Field `COV` writer - Capture/compare overflow flag"]
90pub struct COV_W<'a> {
91    w: &'a mut W,
92}
93impl<'a> COV_W<'a> {
94    #[doc = r"Sets the field bit"]
95    #[inline(always)]
96    pub fn set_bit(self) -> &'a mut W {
97        self.bit(true)
98    }
99    #[doc = r"Clears the field bit"]
100    #[inline(always)]
101    pub fn clear_bit(self) -> &'a mut W {
102        self.bit(false)
103    }
104    #[doc = r"Writes raw bits to the field"]
105    #[inline(always)]
106    pub fn bit(self, value: bool) -> &'a mut W {
107        self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u16 & 0x01) << 1);
108        self.w
109    }
110}
111#[doc = "Field `OUT` reader - PWM Output signal if output mode 0"]
112pub struct OUT_R(crate::FieldReader<bool, bool>);
113impl OUT_R {
114    #[inline(always)]
115    pub(crate) fn new(bits: bool) -> Self {
116        OUT_R(crate::FieldReader::new(bits))
117    }
118}
119impl core::ops::Deref for OUT_R {
120    type Target = crate::FieldReader<bool, bool>;
121    #[inline(always)]
122    fn deref(&self) -> &Self::Target {
123        &self.0
124    }
125}
126#[doc = "Field `OUT` writer - PWM Output signal if output mode 0"]
127pub struct OUT_W<'a> {
128    w: &'a mut W,
129}
130impl<'a> OUT_W<'a> {
131    #[doc = r"Sets the field bit"]
132    #[inline(always)]
133    pub fn set_bit(self) -> &'a mut W {
134        self.bit(true)
135    }
136    #[doc = r"Clears the field bit"]
137    #[inline(always)]
138    pub fn clear_bit(self) -> &'a mut W {
139        self.bit(false)
140    }
141    #[doc = r"Writes raw bits to the field"]
142    #[inline(always)]
143    pub fn bit(self, value: bool) -> &'a mut W {
144        self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u16 & 0x01) << 2);
145        self.w
146    }
147}
148#[doc = "Field `CCI` reader - Capture input signal (read)"]
149pub struct CCI_R(crate::FieldReader<bool, bool>);
150impl CCI_R {
151    #[inline(always)]
152    pub(crate) fn new(bits: bool) -> Self {
153        CCI_R(crate::FieldReader::new(bits))
154    }
155}
156impl core::ops::Deref for CCI_R {
157    type Target = crate::FieldReader<bool, bool>;
158    #[inline(always)]
159    fn deref(&self) -> &Self::Target {
160        &self.0
161    }
162}
163#[doc = "Field `CCI` writer - Capture input signal (read)"]
164pub struct CCI_W<'a> {
165    w: &'a mut W,
166}
167impl<'a> CCI_W<'a> {
168    #[doc = r"Sets the field bit"]
169    #[inline(always)]
170    pub fn set_bit(self) -> &'a mut W {
171        self.bit(true)
172    }
173    #[doc = r"Clears the field bit"]
174    #[inline(always)]
175    pub fn clear_bit(self) -> &'a mut W {
176        self.bit(false)
177    }
178    #[doc = r"Writes raw bits to the field"]
179    #[inline(always)]
180    pub fn bit(self, value: bool) -> &'a mut W {
181        self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u16 & 0x01) << 3);
182        self.w
183    }
184}
185#[doc = "Field `CCIE` reader - Capture/compare interrupt enable"]
186pub struct CCIE_R(crate::FieldReader<bool, bool>);
187impl CCIE_R {
188    #[inline(always)]
189    pub(crate) fn new(bits: bool) -> Self {
190        CCIE_R(crate::FieldReader::new(bits))
191    }
192}
193impl core::ops::Deref for CCIE_R {
194    type Target = crate::FieldReader<bool, bool>;
195    #[inline(always)]
196    fn deref(&self) -> &Self::Target {
197        &self.0
198    }
199}
200#[doc = "Field `CCIE` writer - Capture/compare interrupt enable"]
201pub struct CCIE_W<'a> {
202    w: &'a mut W,
203}
204impl<'a> CCIE_W<'a> {
205    #[doc = r"Sets the field bit"]
206    #[inline(always)]
207    pub fn set_bit(self) -> &'a mut W {
208        self.bit(true)
209    }
210    #[doc = r"Clears the field bit"]
211    #[inline(always)]
212    pub fn clear_bit(self) -> &'a mut W {
213        self.bit(false)
214    }
215    #[doc = r"Writes raw bits to the field"]
216    #[inline(always)]
217    pub fn bit(self, value: bool) -> &'a mut W {
218        self.w.bits = (self.w.bits & !(0x01 << 4)) | ((value as u16 & 0x01) << 4);
219        self.w
220    }
221}
222#[doc = "Output mode 2\n\nValue on reset: 0"]
223#[derive(Clone, Copy, Debug, PartialEq)]
224#[repr(u8)]
225pub enum OUTMOD_A {
226    #[doc = "0: PWM output mode: 0 - output only"]
227    OUTMOD_0 = 0,
228    #[doc = "1: PWM output mode: 1 - set"]
229    OUTMOD_1 = 1,
230    #[doc = "2: PWM output mode: 2 - PWM toggle/reset"]
231    OUTMOD_2 = 2,
232    #[doc = "3: PWM output mode: 3 - PWM set/reset"]
233    OUTMOD_3 = 3,
234    #[doc = "4: PWM output mode: 4 - toggle"]
235    OUTMOD_4 = 4,
236    #[doc = "5: PWM output mode: 5 - Reset"]
237    OUTMOD_5 = 5,
238    #[doc = "6: PWM output mode: 6 - PWM toggle/set"]
239    OUTMOD_6 = 6,
240    #[doc = "7: PWM output mode: 7 - PWM reset/set"]
241    OUTMOD_7 = 7,
242}
243impl From<OUTMOD_A> for u8 {
244    #[inline(always)]
245    fn from(variant: OUTMOD_A) -> Self {
246        variant as _
247    }
248}
249#[doc = "Field `OUTMOD` reader - Output mode 2"]
250pub struct OUTMOD_R(crate::FieldReader<u8, OUTMOD_A>);
251impl OUTMOD_R {
252    #[inline(always)]
253    pub(crate) fn new(bits: u8) -> Self {
254        OUTMOD_R(crate::FieldReader::new(bits))
255    }
256    #[doc = r"Get enumerated values variant"]
257    #[inline(always)]
258    pub fn variant(&self) -> OUTMOD_A {
259        match self.bits {
260            0 => OUTMOD_A::OUTMOD_0,
261            1 => OUTMOD_A::OUTMOD_1,
262            2 => OUTMOD_A::OUTMOD_2,
263            3 => OUTMOD_A::OUTMOD_3,
264            4 => OUTMOD_A::OUTMOD_4,
265            5 => OUTMOD_A::OUTMOD_5,
266            6 => OUTMOD_A::OUTMOD_6,
267            7 => OUTMOD_A::OUTMOD_7,
268            _ => unreachable!(),
269        }
270    }
271    #[doc = "Checks if the value of the field is `OUTMOD_0`"]
272    #[inline(always)]
273    pub fn is_outmod_0(&self) -> bool {
274        **self == OUTMOD_A::OUTMOD_0
275    }
276    #[doc = "Checks if the value of the field is `OUTMOD_1`"]
277    #[inline(always)]
278    pub fn is_outmod_1(&self) -> bool {
279        **self == OUTMOD_A::OUTMOD_1
280    }
281    #[doc = "Checks if the value of the field is `OUTMOD_2`"]
282    #[inline(always)]
283    pub fn is_outmod_2(&self) -> bool {
284        **self == OUTMOD_A::OUTMOD_2
285    }
286    #[doc = "Checks if the value of the field is `OUTMOD_3`"]
287    #[inline(always)]
288    pub fn is_outmod_3(&self) -> bool {
289        **self == OUTMOD_A::OUTMOD_3
290    }
291    #[doc = "Checks if the value of the field is `OUTMOD_4`"]
292    #[inline(always)]
293    pub fn is_outmod_4(&self) -> bool {
294        **self == OUTMOD_A::OUTMOD_4
295    }
296    #[doc = "Checks if the value of the field is `OUTMOD_5`"]
297    #[inline(always)]
298    pub fn is_outmod_5(&self) -> bool {
299        **self == OUTMOD_A::OUTMOD_5
300    }
301    #[doc = "Checks if the value of the field is `OUTMOD_6`"]
302    #[inline(always)]
303    pub fn is_outmod_6(&self) -> bool {
304        **self == OUTMOD_A::OUTMOD_6
305    }
306    #[doc = "Checks if the value of the field is `OUTMOD_7`"]
307    #[inline(always)]
308    pub fn is_outmod_7(&self) -> bool {
309        **self == OUTMOD_A::OUTMOD_7
310    }
311}
312impl core::ops::Deref for OUTMOD_R {
313    type Target = crate::FieldReader<u8, OUTMOD_A>;
314    #[inline(always)]
315    fn deref(&self) -> &Self::Target {
316        &self.0
317    }
318}
319#[doc = "Field `OUTMOD` writer - Output mode 2"]
320pub struct OUTMOD_W<'a> {
321    w: &'a mut W,
322}
323impl<'a> OUTMOD_W<'a> {
324    #[doc = r"Writes `variant` to the field"]
325    #[inline(always)]
326    pub fn variant(self, variant: OUTMOD_A) -> &'a mut W {
327        self.bits(variant.into())
328    }
329    #[doc = "PWM output mode: 0 - output only"]
330    #[inline(always)]
331    pub fn outmod_0(self) -> &'a mut W {
332        self.variant(OUTMOD_A::OUTMOD_0)
333    }
334    #[doc = "PWM output mode: 1 - set"]
335    #[inline(always)]
336    pub fn outmod_1(self) -> &'a mut W {
337        self.variant(OUTMOD_A::OUTMOD_1)
338    }
339    #[doc = "PWM output mode: 2 - PWM toggle/reset"]
340    #[inline(always)]
341    pub fn outmod_2(self) -> &'a mut W {
342        self.variant(OUTMOD_A::OUTMOD_2)
343    }
344    #[doc = "PWM output mode: 3 - PWM set/reset"]
345    #[inline(always)]
346    pub fn outmod_3(self) -> &'a mut W {
347        self.variant(OUTMOD_A::OUTMOD_3)
348    }
349    #[doc = "PWM output mode: 4 - toggle"]
350    #[inline(always)]
351    pub fn outmod_4(self) -> &'a mut W {
352        self.variant(OUTMOD_A::OUTMOD_4)
353    }
354    #[doc = "PWM output mode: 5 - Reset"]
355    #[inline(always)]
356    pub fn outmod_5(self) -> &'a mut W {
357        self.variant(OUTMOD_A::OUTMOD_5)
358    }
359    #[doc = "PWM output mode: 6 - PWM toggle/set"]
360    #[inline(always)]
361    pub fn outmod_6(self) -> &'a mut W {
362        self.variant(OUTMOD_A::OUTMOD_6)
363    }
364    #[doc = "PWM output mode: 7 - PWM reset/set"]
365    #[inline(always)]
366    pub fn outmod_7(self) -> &'a mut W {
367        self.variant(OUTMOD_A::OUTMOD_7)
368    }
369    #[doc = r"Writes raw bits to the field"]
370    #[inline(always)]
371    pub fn bits(self, value: u8) -> &'a mut W {
372        self.w.bits = (self.w.bits & !(0x07 << 5)) | ((value as u16 & 0x07) << 5);
373        self.w
374    }
375}
376#[doc = "Field `CAP` reader - Capture mode: 1 /Compare mode : 0"]
377pub struct CAP_R(crate::FieldReader<bool, bool>);
378impl CAP_R {
379    #[inline(always)]
380    pub(crate) fn new(bits: bool) -> Self {
381        CAP_R(crate::FieldReader::new(bits))
382    }
383}
384impl core::ops::Deref for CAP_R {
385    type Target = crate::FieldReader<bool, bool>;
386    #[inline(always)]
387    fn deref(&self) -> &Self::Target {
388        &self.0
389    }
390}
391#[doc = "Field `CAP` writer - Capture mode: 1 /Compare mode : 0"]
392pub struct CAP_W<'a> {
393    w: &'a mut W,
394}
395impl<'a> CAP_W<'a> {
396    #[doc = r"Sets the field bit"]
397    #[inline(always)]
398    pub fn set_bit(self) -> &'a mut W {
399        self.bit(true)
400    }
401    #[doc = r"Clears the field bit"]
402    #[inline(always)]
403    pub fn clear_bit(self) -> &'a mut W {
404        self.bit(false)
405    }
406    #[doc = r"Writes raw bits to the field"]
407    #[inline(always)]
408    pub fn bit(self, value: bool) -> &'a mut W {
409        self.w.bits = (self.w.bits & !(0x01 << 8)) | ((value as u16 & 0x01) << 8);
410        self.w
411    }
412}
413#[doc = "Compare latch load source 1\n\nValue on reset: 0"]
414#[derive(Clone, Copy, Debug, PartialEq)]
415#[repr(u8)]
416pub enum CLLD_A {
417    #[doc = "0: Compare latch load sourec : 0 - immediate"]
418    CLLD_0 = 0,
419    #[doc = "1: Compare latch load sourec : 1 - TBR counts to 0"]
420    CLLD_1 = 1,
421    #[doc = "2: Compare latch load sourec : 2 - up/down"]
422    CLLD_2 = 2,
423    #[doc = "3: Compare latch load sourec : 3 - TBR counts to TBCTL0"]
424    CLLD_3 = 3,
425}
426impl From<CLLD_A> for u8 {
427    #[inline(always)]
428    fn from(variant: CLLD_A) -> Self {
429        variant as _
430    }
431}
432#[doc = "Field `CLLD` reader - Compare latch load source 1"]
433pub struct CLLD_R(crate::FieldReader<u8, CLLD_A>);
434impl CLLD_R {
435    #[inline(always)]
436    pub(crate) fn new(bits: u8) -> Self {
437        CLLD_R(crate::FieldReader::new(bits))
438    }
439    #[doc = r"Get enumerated values variant"]
440    #[inline(always)]
441    pub fn variant(&self) -> CLLD_A {
442        match self.bits {
443            0 => CLLD_A::CLLD_0,
444            1 => CLLD_A::CLLD_1,
445            2 => CLLD_A::CLLD_2,
446            3 => CLLD_A::CLLD_3,
447            _ => unreachable!(),
448        }
449    }
450    #[doc = "Checks if the value of the field is `CLLD_0`"]
451    #[inline(always)]
452    pub fn is_clld_0(&self) -> bool {
453        **self == CLLD_A::CLLD_0
454    }
455    #[doc = "Checks if the value of the field is `CLLD_1`"]
456    #[inline(always)]
457    pub fn is_clld_1(&self) -> bool {
458        **self == CLLD_A::CLLD_1
459    }
460    #[doc = "Checks if the value of the field is `CLLD_2`"]
461    #[inline(always)]
462    pub fn is_clld_2(&self) -> bool {
463        **self == CLLD_A::CLLD_2
464    }
465    #[doc = "Checks if the value of the field is `CLLD_3`"]
466    #[inline(always)]
467    pub fn is_clld_3(&self) -> bool {
468        **self == CLLD_A::CLLD_3
469    }
470}
471impl core::ops::Deref for CLLD_R {
472    type Target = crate::FieldReader<u8, CLLD_A>;
473    #[inline(always)]
474    fn deref(&self) -> &Self::Target {
475        &self.0
476    }
477}
478#[doc = "Field `CLLD` writer - Compare latch load source 1"]
479pub struct CLLD_W<'a> {
480    w: &'a mut W,
481}
482impl<'a> CLLD_W<'a> {
483    #[doc = r"Writes `variant` to the field"]
484    #[inline(always)]
485    pub fn variant(self, variant: CLLD_A) -> &'a mut W {
486        self.bits(variant.into())
487    }
488    #[doc = "Compare latch load sourec : 0 - immediate"]
489    #[inline(always)]
490    pub fn clld_0(self) -> &'a mut W {
491        self.variant(CLLD_A::CLLD_0)
492    }
493    #[doc = "Compare latch load sourec : 1 - TBR counts to 0"]
494    #[inline(always)]
495    pub fn clld_1(self) -> &'a mut W {
496        self.variant(CLLD_A::CLLD_1)
497    }
498    #[doc = "Compare latch load sourec : 2 - up/down"]
499    #[inline(always)]
500    pub fn clld_2(self) -> &'a mut W {
501        self.variant(CLLD_A::CLLD_2)
502    }
503    #[doc = "Compare latch load sourec : 3 - TBR counts to TBCTL0"]
504    #[inline(always)]
505    pub fn clld_3(self) -> &'a mut W {
506        self.variant(CLLD_A::CLLD_3)
507    }
508    #[doc = r"Writes raw bits to the field"]
509    #[inline(always)]
510    pub fn bits(self, value: u8) -> &'a mut W {
511        self.w.bits = (self.w.bits & !(0x03 << 9)) | ((value as u16 & 0x03) << 9);
512        self.w
513    }
514}
515#[doc = "Field `SCS` reader - Capture sychronize"]
516pub struct SCS_R(crate::FieldReader<bool, bool>);
517impl SCS_R {
518    #[inline(always)]
519    pub(crate) fn new(bits: bool) -> Self {
520        SCS_R(crate::FieldReader::new(bits))
521    }
522}
523impl core::ops::Deref for SCS_R {
524    type Target = crate::FieldReader<bool, bool>;
525    #[inline(always)]
526    fn deref(&self) -> &Self::Target {
527        &self.0
528    }
529}
530#[doc = "Field `SCS` writer - Capture sychronize"]
531pub struct SCS_W<'a> {
532    w: &'a mut W,
533}
534impl<'a> SCS_W<'a> {
535    #[doc = r"Sets the field bit"]
536    #[inline(always)]
537    pub fn set_bit(self) -> &'a mut W {
538        self.bit(true)
539    }
540    #[doc = r"Clears the field bit"]
541    #[inline(always)]
542    pub fn clear_bit(self) -> &'a mut W {
543        self.bit(false)
544    }
545    #[doc = r"Writes raw bits to the field"]
546    #[inline(always)]
547    pub fn bit(self, value: bool) -> &'a mut W {
548        self.w.bits = (self.w.bits & !(0x01 << 11)) | ((value as u16 & 0x01) << 11);
549        self.w
550    }
551}
552#[doc = "Capture input select 1\n\nValue on reset: 0"]
553#[derive(Clone, Copy, Debug, PartialEq)]
554#[repr(u8)]
555pub enum CCIS_A {
556    #[doc = "0: Capture input select: 0 - CCIxA"]
557    CCIS_0 = 0,
558    #[doc = "1: Capture input select: 1 - CCIxB"]
559    CCIS_1 = 1,
560    #[doc = "2: Capture input select: 2 - GND"]
561    CCIS_2 = 2,
562    #[doc = "3: Capture input select: 3 - Vcc"]
563    CCIS_3 = 3,
564}
565impl From<CCIS_A> for u8 {
566    #[inline(always)]
567    fn from(variant: CCIS_A) -> Self {
568        variant as _
569    }
570}
571#[doc = "Field `CCIS` reader - Capture input select 1"]
572pub struct CCIS_R(crate::FieldReader<u8, CCIS_A>);
573impl CCIS_R {
574    #[inline(always)]
575    pub(crate) fn new(bits: u8) -> Self {
576        CCIS_R(crate::FieldReader::new(bits))
577    }
578    #[doc = r"Get enumerated values variant"]
579    #[inline(always)]
580    pub fn variant(&self) -> CCIS_A {
581        match self.bits {
582            0 => CCIS_A::CCIS_0,
583            1 => CCIS_A::CCIS_1,
584            2 => CCIS_A::CCIS_2,
585            3 => CCIS_A::CCIS_3,
586            _ => unreachable!(),
587        }
588    }
589    #[doc = "Checks if the value of the field is `CCIS_0`"]
590    #[inline(always)]
591    pub fn is_ccis_0(&self) -> bool {
592        **self == CCIS_A::CCIS_0
593    }
594    #[doc = "Checks if the value of the field is `CCIS_1`"]
595    #[inline(always)]
596    pub fn is_ccis_1(&self) -> bool {
597        **self == CCIS_A::CCIS_1
598    }
599    #[doc = "Checks if the value of the field is `CCIS_2`"]
600    #[inline(always)]
601    pub fn is_ccis_2(&self) -> bool {
602        **self == CCIS_A::CCIS_2
603    }
604    #[doc = "Checks if the value of the field is `CCIS_3`"]
605    #[inline(always)]
606    pub fn is_ccis_3(&self) -> bool {
607        **self == CCIS_A::CCIS_3
608    }
609}
610impl core::ops::Deref for CCIS_R {
611    type Target = crate::FieldReader<u8, CCIS_A>;
612    #[inline(always)]
613    fn deref(&self) -> &Self::Target {
614        &self.0
615    }
616}
617#[doc = "Field `CCIS` writer - Capture input select 1"]
618pub struct CCIS_W<'a> {
619    w: &'a mut W,
620}
621impl<'a> CCIS_W<'a> {
622    #[doc = r"Writes `variant` to the field"]
623    #[inline(always)]
624    pub fn variant(self, variant: CCIS_A) -> &'a mut W {
625        self.bits(variant.into())
626    }
627    #[doc = "Capture input select: 0 - CCIxA"]
628    #[inline(always)]
629    pub fn ccis_0(self) -> &'a mut W {
630        self.variant(CCIS_A::CCIS_0)
631    }
632    #[doc = "Capture input select: 1 - CCIxB"]
633    #[inline(always)]
634    pub fn ccis_1(self) -> &'a mut W {
635        self.variant(CCIS_A::CCIS_1)
636    }
637    #[doc = "Capture input select: 2 - GND"]
638    #[inline(always)]
639    pub fn ccis_2(self) -> &'a mut W {
640        self.variant(CCIS_A::CCIS_2)
641    }
642    #[doc = "Capture input select: 3 - Vcc"]
643    #[inline(always)]
644    pub fn ccis_3(self) -> &'a mut W {
645        self.variant(CCIS_A::CCIS_3)
646    }
647    #[doc = r"Writes raw bits to the field"]
648    #[inline(always)]
649    pub fn bits(self, value: u8) -> &'a mut W {
650        self.w.bits = (self.w.bits & !(0x03 << 12)) | ((value as u16 & 0x03) << 12);
651        self.w
652    }
653}
654#[doc = "Capture mode 1\n\nValue on reset: 0"]
655#[derive(Clone, Copy, Debug, PartialEq)]
656#[repr(u8)]
657pub enum CM_A {
658    #[doc = "0: Capture mode: 0 - disabled"]
659    CM_0 = 0,
660    #[doc = "1: Capture mode: 1 - pos. edge"]
661    CM_1 = 1,
662    #[doc = "2: Capture mode: 1 - neg. edge"]
663    CM_2 = 2,
664    #[doc = "3: Capture mode: 1 - both edges"]
665    CM_3 = 3,
666}
667impl From<CM_A> for u8 {
668    #[inline(always)]
669    fn from(variant: CM_A) -> Self {
670        variant as _
671    }
672}
673#[doc = "Field `CM` reader - Capture mode 1"]
674pub struct CM_R(crate::FieldReader<u8, CM_A>);
675impl CM_R {
676    #[inline(always)]
677    pub(crate) fn new(bits: u8) -> Self {
678        CM_R(crate::FieldReader::new(bits))
679    }
680    #[doc = r"Get enumerated values variant"]
681    #[inline(always)]
682    pub fn variant(&self) -> CM_A {
683        match self.bits {
684            0 => CM_A::CM_0,
685            1 => CM_A::CM_1,
686            2 => CM_A::CM_2,
687            3 => CM_A::CM_3,
688            _ => unreachable!(),
689        }
690    }
691    #[doc = "Checks if the value of the field is `CM_0`"]
692    #[inline(always)]
693    pub fn is_cm_0(&self) -> bool {
694        **self == CM_A::CM_0
695    }
696    #[doc = "Checks if the value of the field is `CM_1`"]
697    #[inline(always)]
698    pub fn is_cm_1(&self) -> bool {
699        **self == CM_A::CM_1
700    }
701    #[doc = "Checks if the value of the field is `CM_2`"]
702    #[inline(always)]
703    pub fn is_cm_2(&self) -> bool {
704        **self == CM_A::CM_2
705    }
706    #[doc = "Checks if the value of the field is `CM_3`"]
707    #[inline(always)]
708    pub fn is_cm_3(&self) -> bool {
709        **self == CM_A::CM_3
710    }
711}
712impl core::ops::Deref for CM_R {
713    type Target = crate::FieldReader<u8, CM_A>;
714    #[inline(always)]
715    fn deref(&self) -> &Self::Target {
716        &self.0
717    }
718}
719#[doc = "Field `CM` writer - Capture mode 1"]
720pub struct CM_W<'a> {
721    w: &'a mut W,
722}
723impl<'a> CM_W<'a> {
724    #[doc = r"Writes `variant` to the field"]
725    #[inline(always)]
726    pub fn variant(self, variant: CM_A) -> &'a mut W {
727        self.bits(variant.into())
728    }
729    #[doc = "Capture mode: 0 - disabled"]
730    #[inline(always)]
731    pub fn cm_0(self) -> &'a mut W {
732        self.variant(CM_A::CM_0)
733    }
734    #[doc = "Capture mode: 1 - pos. edge"]
735    #[inline(always)]
736    pub fn cm_1(self) -> &'a mut W {
737        self.variant(CM_A::CM_1)
738    }
739    #[doc = "Capture mode: 1 - neg. edge"]
740    #[inline(always)]
741    pub fn cm_2(self) -> &'a mut W {
742        self.variant(CM_A::CM_2)
743    }
744    #[doc = "Capture mode: 1 - both edges"]
745    #[inline(always)]
746    pub fn cm_3(self) -> &'a mut W {
747        self.variant(CM_A::CM_3)
748    }
749    #[doc = r"Writes raw bits to the field"]
750    #[inline(always)]
751    pub fn bits(self, value: u8) -> &'a mut W {
752        self.w.bits = (self.w.bits & !(0x03 << 14)) | ((value as u16 & 0x03) << 14);
753        self.w
754    }
755}
756impl R {
757    #[doc = "Bit 0 - Capture/compare interrupt flag"]
758    #[inline(always)]
759    pub fn ccifg(&self) -> CCIFG_R {
760        CCIFG_R::new((self.bits & 0x01) != 0)
761    }
762    #[doc = "Bit 1 - Capture/compare overflow flag"]
763    #[inline(always)]
764    pub fn cov(&self) -> COV_R {
765        COV_R::new(((self.bits >> 1) & 0x01) != 0)
766    }
767    #[doc = "Bit 2 - PWM Output signal if output mode 0"]
768    #[inline(always)]
769    pub fn out(&self) -> OUT_R {
770        OUT_R::new(((self.bits >> 2) & 0x01) != 0)
771    }
772    #[doc = "Bit 3 - Capture input signal (read)"]
773    #[inline(always)]
774    pub fn cci(&self) -> CCI_R {
775        CCI_R::new(((self.bits >> 3) & 0x01) != 0)
776    }
777    #[doc = "Bit 4 - Capture/compare interrupt enable"]
778    #[inline(always)]
779    pub fn ccie(&self) -> CCIE_R {
780        CCIE_R::new(((self.bits >> 4) & 0x01) != 0)
781    }
782    #[doc = "Bits 5:7 - Output mode 2"]
783    #[inline(always)]
784    pub fn outmod(&self) -> OUTMOD_R {
785        OUTMOD_R::new(((self.bits >> 5) & 0x07) as u8)
786    }
787    #[doc = "Bit 8 - Capture mode: 1 /Compare mode : 0"]
788    #[inline(always)]
789    pub fn cap(&self) -> CAP_R {
790        CAP_R::new(((self.bits >> 8) & 0x01) != 0)
791    }
792    #[doc = "Bits 9:10 - Compare latch load source 1"]
793    #[inline(always)]
794    pub fn clld(&self) -> CLLD_R {
795        CLLD_R::new(((self.bits >> 9) & 0x03) as u8)
796    }
797    #[doc = "Bit 11 - Capture sychronize"]
798    #[inline(always)]
799    pub fn scs(&self) -> SCS_R {
800        SCS_R::new(((self.bits >> 11) & 0x01) != 0)
801    }
802    #[doc = "Bits 12:13 - Capture input select 1"]
803    #[inline(always)]
804    pub fn ccis(&self) -> CCIS_R {
805        CCIS_R::new(((self.bits >> 12) & 0x03) as u8)
806    }
807    #[doc = "Bits 14:15 - Capture mode 1"]
808    #[inline(always)]
809    pub fn cm(&self) -> CM_R {
810        CM_R::new(((self.bits >> 14) & 0x03) as u8)
811    }
812}
813impl W {
814    #[doc = "Bit 0 - Capture/compare interrupt flag"]
815    #[inline(always)]
816    pub fn ccifg(&mut self) -> CCIFG_W {
817        CCIFG_W { w: self }
818    }
819    #[doc = "Bit 1 - Capture/compare overflow flag"]
820    #[inline(always)]
821    pub fn cov(&mut self) -> COV_W {
822        COV_W { w: self }
823    }
824    #[doc = "Bit 2 - PWM Output signal if output mode 0"]
825    #[inline(always)]
826    pub fn out(&mut self) -> OUT_W {
827        OUT_W { w: self }
828    }
829    #[doc = "Bit 3 - Capture input signal (read)"]
830    #[inline(always)]
831    pub fn cci(&mut self) -> CCI_W {
832        CCI_W { w: self }
833    }
834    #[doc = "Bit 4 - Capture/compare interrupt enable"]
835    #[inline(always)]
836    pub fn ccie(&mut self) -> CCIE_W {
837        CCIE_W { w: self }
838    }
839    #[doc = "Bits 5:7 - Output mode 2"]
840    #[inline(always)]
841    pub fn outmod(&mut self) -> OUTMOD_W {
842        OUTMOD_W { w: self }
843    }
844    #[doc = "Bit 8 - Capture mode: 1 /Compare mode : 0"]
845    #[inline(always)]
846    pub fn cap(&mut self) -> CAP_W {
847        CAP_W { w: self }
848    }
849    #[doc = "Bits 9:10 - Compare latch load source 1"]
850    #[inline(always)]
851    pub fn clld(&mut self) -> CLLD_W {
852        CLLD_W { w: self }
853    }
854    #[doc = "Bit 11 - Capture sychronize"]
855    #[inline(always)]
856    pub fn scs(&mut self) -> SCS_W {
857        SCS_W { w: self }
858    }
859    #[doc = "Bits 12:13 - Capture input select 1"]
860    #[inline(always)]
861    pub fn ccis(&mut self) -> CCIS_W {
862        CCIS_W { w: self }
863    }
864    #[doc = "Bits 14:15 - Capture mode 1"]
865    #[inline(always)]
866    pub fn cm(&mut self) -> CM_W {
867        CM_W { w: self }
868    }
869    #[doc = "Writes raw bits to the register."]
870    #[inline(always)]
871    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
872        self.0.bits(bits);
873        self
874    }
875}
876#[doc = "Timer0_B7 Capture/Compare Control 4\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 [tb0cctl4](index.html) module"]
877pub struct TB0CCTL4_SPEC;
878impl crate::RegisterSpec for TB0CCTL4_SPEC {
879    type Ux = u16;
880}
881#[doc = "`read()` method returns [tb0cctl4::R](R) reader structure"]
882impl crate::Readable for TB0CCTL4_SPEC {
883    type Reader = R;
884}
885#[doc = "`write(|w| ..)` method takes [tb0cctl4::W](W) writer structure"]
886impl crate::Writable for TB0CCTL4_SPEC {
887    type Writer = W;
888}
889#[doc = "`reset()` method sets TB0CCTL4 to value 0"]
890impl crate::Resettable for TB0CCTL4_SPEC {
891    #[inline(always)]
892    fn reset_value() -> Self::Ux {
893        0
894    }
895}