msp430fr2355/tb0/
tb0cctl1.rs

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