Skip to main content

mcxa_pac/ctimer0/
emr.rs

1#[doc = "Register `EMR` reader"]
2pub type R = crate::R<EmrSpec>;
3#[doc = "Register `EMR` writer"]
4pub type W = crate::W<EmrSpec>;
5#[doc = "External Match 0\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Em0 {
9    #[doc = "0: Low"]
10    Clear = 0,
11    #[doc = "1: High"]
12    Set = 1,
13}
14impl From<Em0> for bool {
15    #[inline(always)]
16    fn from(variant: Em0) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `EM0` reader - External Match 0"]
21pub type Em0R = crate::BitReader<Em0>;
22impl Em0R {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Em0 {
26        match self.bits {
27            false => Em0::Clear,
28            true => Em0::Set,
29        }
30    }
31    #[doc = "Low"]
32    #[inline(always)]
33    pub fn is_clear(&self) -> bool {
34        *self == Em0::Clear
35    }
36    #[doc = "High"]
37    #[inline(always)]
38    pub fn is_set(&self) -> bool {
39        *self == Em0::Set
40    }
41}
42#[doc = "Field `EM0` writer - External Match 0"]
43pub type Em0W<'a, REG> = crate::BitWriter<'a, REG, Em0>;
44impl<'a, REG> Em0W<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "Low"]
49    #[inline(always)]
50    pub fn clear(self) -> &'a mut crate::W<REG> {
51        self.variant(Em0::Clear)
52    }
53    #[doc = "High"]
54    #[inline(always)]
55    pub fn set_(self) -> &'a mut crate::W<REG> {
56        self.variant(Em0::Set)
57    }
58}
59#[doc = "External Match 1\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Em1 {
63    #[doc = "0: Low"]
64    Clear = 0,
65    #[doc = "1: High"]
66    Set = 1,
67}
68impl From<Em1> for bool {
69    #[inline(always)]
70    fn from(variant: Em1) -> Self {
71        variant as u8 != 0
72    }
73}
74#[doc = "Field `EM1` reader - External Match 1"]
75pub type Em1R = crate::BitReader<Em1>;
76impl Em1R {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub const fn variant(&self) -> Em1 {
80        match self.bits {
81            false => Em1::Clear,
82            true => Em1::Set,
83        }
84    }
85    #[doc = "Low"]
86    #[inline(always)]
87    pub fn is_clear(&self) -> bool {
88        *self == Em1::Clear
89    }
90    #[doc = "High"]
91    #[inline(always)]
92    pub fn is_set(&self) -> bool {
93        *self == Em1::Set
94    }
95}
96#[doc = "Field `EM1` writer - External Match 1"]
97pub type Em1W<'a, REG> = crate::BitWriter<'a, REG, Em1>;
98impl<'a, REG> Em1W<'a, REG>
99where
100    REG: crate::Writable + crate::RegisterSpec,
101{
102    #[doc = "Low"]
103    #[inline(always)]
104    pub fn clear(self) -> &'a mut crate::W<REG> {
105        self.variant(Em1::Clear)
106    }
107    #[doc = "High"]
108    #[inline(always)]
109    pub fn set_(self) -> &'a mut crate::W<REG> {
110        self.variant(Em1::Set)
111    }
112}
113#[doc = "External Match 2\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum Em2 {
117    #[doc = "0: Low"]
118    Clear = 0,
119    #[doc = "1: High"]
120    Set = 1,
121}
122impl From<Em2> for bool {
123    #[inline(always)]
124    fn from(variant: Em2) -> Self {
125        variant as u8 != 0
126    }
127}
128#[doc = "Field `EM2` reader - External Match 2"]
129pub type Em2R = crate::BitReader<Em2>;
130impl Em2R {
131    #[doc = "Get enumerated values variant"]
132    #[inline(always)]
133    pub const fn variant(&self) -> Em2 {
134        match self.bits {
135            false => Em2::Clear,
136            true => Em2::Set,
137        }
138    }
139    #[doc = "Low"]
140    #[inline(always)]
141    pub fn is_clear(&self) -> bool {
142        *self == Em2::Clear
143    }
144    #[doc = "High"]
145    #[inline(always)]
146    pub fn is_set(&self) -> bool {
147        *self == Em2::Set
148    }
149}
150#[doc = "Field `EM2` writer - External Match 2"]
151pub type Em2W<'a, REG> = crate::BitWriter<'a, REG, Em2>;
152impl<'a, REG> Em2W<'a, REG>
153where
154    REG: crate::Writable + crate::RegisterSpec,
155{
156    #[doc = "Low"]
157    #[inline(always)]
158    pub fn clear(self) -> &'a mut crate::W<REG> {
159        self.variant(Em2::Clear)
160    }
161    #[doc = "High"]
162    #[inline(always)]
163    pub fn set_(self) -> &'a mut crate::W<REG> {
164        self.variant(Em2::Set)
165    }
166}
167#[doc = "External Match 3\n\nValue on reset: 0"]
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum Em3 {
171    #[doc = "0: Low"]
172    Clear = 0,
173    #[doc = "1: High"]
174    Set = 1,
175}
176impl From<Em3> for bool {
177    #[inline(always)]
178    fn from(variant: Em3) -> Self {
179        variant as u8 != 0
180    }
181}
182#[doc = "Field `EM3` reader - External Match 3"]
183pub type Em3R = crate::BitReader<Em3>;
184impl Em3R {
185    #[doc = "Get enumerated values variant"]
186    #[inline(always)]
187    pub const fn variant(&self) -> Em3 {
188        match self.bits {
189            false => Em3::Clear,
190            true => Em3::Set,
191        }
192    }
193    #[doc = "Low"]
194    #[inline(always)]
195    pub fn is_clear(&self) -> bool {
196        *self == Em3::Clear
197    }
198    #[doc = "High"]
199    #[inline(always)]
200    pub fn is_set(&self) -> bool {
201        *self == Em3::Set
202    }
203}
204#[doc = "Field `EM3` writer - External Match 3"]
205pub type Em3W<'a, REG> = crate::BitWriter<'a, REG, Em3>;
206impl<'a, REG> Em3W<'a, REG>
207where
208    REG: crate::Writable + crate::RegisterSpec,
209{
210    #[doc = "Low"]
211    #[inline(always)]
212    pub fn clear(self) -> &'a mut crate::W<REG> {
213        self.variant(Em3::Clear)
214    }
215    #[doc = "High"]
216    #[inline(always)]
217    pub fn set_(self) -> &'a mut crate::W<REG> {
218        self.variant(Em3::Set)
219    }
220}
221#[doc = "External Match Control 0\n\nValue on reset: 0"]
222#[cfg_attr(feature = "defmt", derive(defmt::Format))]
223#[derive(Clone, Copy, Debug, PartialEq, Eq)]
224#[repr(u8)]
225pub enum Emc0 {
226    #[doc = "0: Does nothing"]
227    DoNothing = 0,
228    #[doc = "1: Goes low"]
229    Clear = 1,
230    #[doc = "2: Goes high"]
231    Set = 2,
232    #[doc = "3: Toggles"]
233    Toggle = 3,
234}
235impl From<Emc0> for u8 {
236    #[inline(always)]
237    fn from(variant: Emc0) -> Self {
238        variant as _
239    }
240}
241impl crate::FieldSpec for Emc0 {
242    type Ux = u8;
243}
244impl crate::IsEnum for Emc0 {}
245#[doc = "Field `EMC0` reader - External Match Control 0"]
246pub type Emc0R = crate::FieldReader<Emc0>;
247impl Emc0R {
248    #[doc = "Get enumerated values variant"]
249    #[inline(always)]
250    pub const fn variant(&self) -> Emc0 {
251        match self.bits {
252            0 => Emc0::DoNothing,
253            1 => Emc0::Clear,
254            2 => Emc0::Set,
255            3 => Emc0::Toggle,
256            _ => unreachable!(),
257        }
258    }
259    #[doc = "Does nothing"]
260    #[inline(always)]
261    pub fn is_do_nothing(&self) -> bool {
262        *self == Emc0::DoNothing
263    }
264    #[doc = "Goes low"]
265    #[inline(always)]
266    pub fn is_clear(&self) -> bool {
267        *self == Emc0::Clear
268    }
269    #[doc = "Goes high"]
270    #[inline(always)]
271    pub fn is_set(&self) -> bool {
272        *self == Emc0::Set
273    }
274    #[doc = "Toggles"]
275    #[inline(always)]
276    pub fn is_toggle(&self) -> bool {
277        *self == Emc0::Toggle
278    }
279}
280#[doc = "Field `EMC0` writer - External Match Control 0"]
281pub type Emc0W<'a, REG> = crate::FieldWriter<'a, REG, 2, Emc0, crate::Safe>;
282impl<'a, REG> Emc0W<'a, REG>
283where
284    REG: crate::Writable + crate::RegisterSpec,
285    REG::Ux: From<u8>,
286{
287    #[doc = "Does nothing"]
288    #[inline(always)]
289    pub fn do_nothing(self) -> &'a mut crate::W<REG> {
290        self.variant(Emc0::DoNothing)
291    }
292    #[doc = "Goes low"]
293    #[inline(always)]
294    pub fn clear(self) -> &'a mut crate::W<REG> {
295        self.variant(Emc0::Clear)
296    }
297    #[doc = "Goes high"]
298    #[inline(always)]
299    pub fn set_(self) -> &'a mut crate::W<REG> {
300        self.variant(Emc0::Set)
301    }
302    #[doc = "Toggles"]
303    #[inline(always)]
304    pub fn toggle(self) -> &'a mut crate::W<REG> {
305        self.variant(Emc0::Toggle)
306    }
307}
308#[doc = "External Match Control 1\n\nValue on reset: 0"]
309#[cfg_attr(feature = "defmt", derive(defmt::Format))]
310#[derive(Clone, Copy, Debug, PartialEq, Eq)]
311#[repr(u8)]
312pub enum Emc1 {
313    #[doc = "0: Does nothing"]
314    DoNothing = 0,
315    #[doc = "1: Goes low"]
316    Clear = 1,
317    #[doc = "2: Goes high"]
318    Set = 2,
319    #[doc = "3: Toggles"]
320    Toggle = 3,
321}
322impl From<Emc1> for u8 {
323    #[inline(always)]
324    fn from(variant: Emc1) -> Self {
325        variant as _
326    }
327}
328impl crate::FieldSpec for Emc1 {
329    type Ux = u8;
330}
331impl crate::IsEnum for Emc1 {}
332#[doc = "Field `EMC1` reader - External Match Control 1"]
333pub type Emc1R = crate::FieldReader<Emc1>;
334impl Emc1R {
335    #[doc = "Get enumerated values variant"]
336    #[inline(always)]
337    pub const fn variant(&self) -> Emc1 {
338        match self.bits {
339            0 => Emc1::DoNothing,
340            1 => Emc1::Clear,
341            2 => Emc1::Set,
342            3 => Emc1::Toggle,
343            _ => unreachable!(),
344        }
345    }
346    #[doc = "Does nothing"]
347    #[inline(always)]
348    pub fn is_do_nothing(&self) -> bool {
349        *self == Emc1::DoNothing
350    }
351    #[doc = "Goes low"]
352    #[inline(always)]
353    pub fn is_clear(&self) -> bool {
354        *self == Emc1::Clear
355    }
356    #[doc = "Goes high"]
357    #[inline(always)]
358    pub fn is_set(&self) -> bool {
359        *self == Emc1::Set
360    }
361    #[doc = "Toggles"]
362    #[inline(always)]
363    pub fn is_toggle(&self) -> bool {
364        *self == Emc1::Toggle
365    }
366}
367#[doc = "Field `EMC1` writer - External Match Control 1"]
368pub type Emc1W<'a, REG> = crate::FieldWriter<'a, REG, 2, Emc1, crate::Safe>;
369impl<'a, REG> Emc1W<'a, REG>
370where
371    REG: crate::Writable + crate::RegisterSpec,
372    REG::Ux: From<u8>,
373{
374    #[doc = "Does nothing"]
375    #[inline(always)]
376    pub fn do_nothing(self) -> &'a mut crate::W<REG> {
377        self.variant(Emc1::DoNothing)
378    }
379    #[doc = "Goes low"]
380    #[inline(always)]
381    pub fn clear(self) -> &'a mut crate::W<REG> {
382        self.variant(Emc1::Clear)
383    }
384    #[doc = "Goes high"]
385    #[inline(always)]
386    pub fn set_(self) -> &'a mut crate::W<REG> {
387        self.variant(Emc1::Set)
388    }
389    #[doc = "Toggles"]
390    #[inline(always)]
391    pub fn toggle(self) -> &'a mut crate::W<REG> {
392        self.variant(Emc1::Toggle)
393    }
394}
395#[doc = "External Match Control 2\n\nValue on reset: 0"]
396#[cfg_attr(feature = "defmt", derive(defmt::Format))]
397#[derive(Clone, Copy, Debug, PartialEq, Eq)]
398#[repr(u8)]
399pub enum Emc2 {
400    #[doc = "0: Does nothing"]
401    DoNothing = 0,
402    #[doc = "1: Goes low"]
403    Clear = 1,
404    #[doc = "2: Goes high"]
405    Set = 2,
406    #[doc = "3: Toggles"]
407    Toggle = 3,
408}
409impl From<Emc2> for u8 {
410    #[inline(always)]
411    fn from(variant: Emc2) -> Self {
412        variant as _
413    }
414}
415impl crate::FieldSpec for Emc2 {
416    type Ux = u8;
417}
418impl crate::IsEnum for Emc2 {}
419#[doc = "Field `EMC2` reader - External Match Control 2"]
420pub type Emc2R = crate::FieldReader<Emc2>;
421impl Emc2R {
422    #[doc = "Get enumerated values variant"]
423    #[inline(always)]
424    pub const fn variant(&self) -> Emc2 {
425        match self.bits {
426            0 => Emc2::DoNothing,
427            1 => Emc2::Clear,
428            2 => Emc2::Set,
429            3 => Emc2::Toggle,
430            _ => unreachable!(),
431        }
432    }
433    #[doc = "Does nothing"]
434    #[inline(always)]
435    pub fn is_do_nothing(&self) -> bool {
436        *self == Emc2::DoNothing
437    }
438    #[doc = "Goes low"]
439    #[inline(always)]
440    pub fn is_clear(&self) -> bool {
441        *self == Emc2::Clear
442    }
443    #[doc = "Goes high"]
444    #[inline(always)]
445    pub fn is_set(&self) -> bool {
446        *self == Emc2::Set
447    }
448    #[doc = "Toggles"]
449    #[inline(always)]
450    pub fn is_toggle(&self) -> bool {
451        *self == Emc2::Toggle
452    }
453}
454#[doc = "Field `EMC2` writer - External Match Control 2"]
455pub type Emc2W<'a, REG> = crate::FieldWriter<'a, REG, 2, Emc2, crate::Safe>;
456impl<'a, REG> Emc2W<'a, REG>
457where
458    REG: crate::Writable + crate::RegisterSpec,
459    REG::Ux: From<u8>,
460{
461    #[doc = "Does nothing"]
462    #[inline(always)]
463    pub fn do_nothing(self) -> &'a mut crate::W<REG> {
464        self.variant(Emc2::DoNothing)
465    }
466    #[doc = "Goes low"]
467    #[inline(always)]
468    pub fn clear(self) -> &'a mut crate::W<REG> {
469        self.variant(Emc2::Clear)
470    }
471    #[doc = "Goes high"]
472    #[inline(always)]
473    pub fn set_(self) -> &'a mut crate::W<REG> {
474        self.variant(Emc2::Set)
475    }
476    #[doc = "Toggles"]
477    #[inline(always)]
478    pub fn toggle(self) -> &'a mut crate::W<REG> {
479        self.variant(Emc2::Toggle)
480    }
481}
482#[doc = "External Match Control 3\n\nValue on reset: 0"]
483#[cfg_attr(feature = "defmt", derive(defmt::Format))]
484#[derive(Clone, Copy, Debug, PartialEq, Eq)]
485#[repr(u8)]
486pub enum Emc3 {
487    #[doc = "0: Does nothing"]
488    DoNothing = 0,
489    #[doc = "1: Goes low"]
490    Clear = 1,
491    #[doc = "2: Goes high"]
492    Set = 2,
493    #[doc = "3: Toggles"]
494    Toggle = 3,
495}
496impl From<Emc3> for u8 {
497    #[inline(always)]
498    fn from(variant: Emc3) -> Self {
499        variant as _
500    }
501}
502impl crate::FieldSpec for Emc3 {
503    type Ux = u8;
504}
505impl crate::IsEnum for Emc3 {}
506#[doc = "Field `EMC3` reader - External Match Control 3"]
507pub type Emc3R = crate::FieldReader<Emc3>;
508impl Emc3R {
509    #[doc = "Get enumerated values variant"]
510    #[inline(always)]
511    pub const fn variant(&self) -> Emc3 {
512        match self.bits {
513            0 => Emc3::DoNothing,
514            1 => Emc3::Clear,
515            2 => Emc3::Set,
516            3 => Emc3::Toggle,
517            _ => unreachable!(),
518        }
519    }
520    #[doc = "Does nothing"]
521    #[inline(always)]
522    pub fn is_do_nothing(&self) -> bool {
523        *self == Emc3::DoNothing
524    }
525    #[doc = "Goes low"]
526    #[inline(always)]
527    pub fn is_clear(&self) -> bool {
528        *self == Emc3::Clear
529    }
530    #[doc = "Goes high"]
531    #[inline(always)]
532    pub fn is_set(&self) -> bool {
533        *self == Emc3::Set
534    }
535    #[doc = "Toggles"]
536    #[inline(always)]
537    pub fn is_toggle(&self) -> bool {
538        *self == Emc3::Toggle
539    }
540}
541#[doc = "Field `EMC3` writer - External Match Control 3"]
542pub type Emc3W<'a, REG> = crate::FieldWriter<'a, REG, 2, Emc3, crate::Safe>;
543impl<'a, REG> Emc3W<'a, REG>
544where
545    REG: crate::Writable + crate::RegisterSpec,
546    REG::Ux: From<u8>,
547{
548    #[doc = "Does nothing"]
549    #[inline(always)]
550    pub fn do_nothing(self) -> &'a mut crate::W<REG> {
551        self.variant(Emc3::DoNothing)
552    }
553    #[doc = "Goes low"]
554    #[inline(always)]
555    pub fn clear(self) -> &'a mut crate::W<REG> {
556        self.variant(Emc3::Clear)
557    }
558    #[doc = "Goes high"]
559    #[inline(always)]
560    pub fn set_(self) -> &'a mut crate::W<REG> {
561        self.variant(Emc3::Set)
562    }
563    #[doc = "Toggles"]
564    #[inline(always)]
565    pub fn toggle(self) -> &'a mut crate::W<REG> {
566        self.variant(Emc3::Toggle)
567    }
568}
569impl R {
570    #[doc = "Bit 0 - External Match 0"]
571    #[inline(always)]
572    pub fn em0(&self) -> Em0R {
573        Em0R::new((self.bits & 1) != 0)
574    }
575    #[doc = "Bit 1 - External Match 1"]
576    #[inline(always)]
577    pub fn em1(&self) -> Em1R {
578        Em1R::new(((self.bits >> 1) & 1) != 0)
579    }
580    #[doc = "Bit 2 - External Match 2"]
581    #[inline(always)]
582    pub fn em2(&self) -> Em2R {
583        Em2R::new(((self.bits >> 2) & 1) != 0)
584    }
585    #[doc = "Bit 3 - External Match 3"]
586    #[inline(always)]
587    pub fn em3(&self) -> Em3R {
588        Em3R::new(((self.bits >> 3) & 1) != 0)
589    }
590    #[doc = "Bits 4:5 - External Match Control 0"]
591    #[inline(always)]
592    pub fn emc0(&self) -> Emc0R {
593        Emc0R::new(((self.bits >> 4) & 3) as u8)
594    }
595    #[doc = "Bits 6:7 - External Match Control 1"]
596    #[inline(always)]
597    pub fn emc1(&self) -> Emc1R {
598        Emc1R::new(((self.bits >> 6) & 3) as u8)
599    }
600    #[doc = "Bits 8:9 - External Match Control 2"]
601    #[inline(always)]
602    pub fn emc2(&self) -> Emc2R {
603        Emc2R::new(((self.bits >> 8) & 3) as u8)
604    }
605    #[doc = "Bits 10:11 - External Match Control 3"]
606    #[inline(always)]
607    pub fn emc3(&self) -> Emc3R {
608        Emc3R::new(((self.bits >> 10) & 3) as u8)
609    }
610}
611#[cfg(feature = "debug")]
612impl core::fmt::Debug for R {
613    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
614        f.debug_struct("EMR")
615            .field("em0", &self.em0())
616            .field("em1", &self.em1())
617            .field("em2", &self.em2())
618            .field("em3", &self.em3())
619            .field("emc0", &self.emc0())
620            .field("emc1", &self.emc1())
621            .field("emc2", &self.emc2())
622            .field("emc3", &self.emc3())
623            .finish()
624    }
625}
626impl W {
627    #[doc = "Bit 0 - External Match 0"]
628    #[inline(always)]
629    pub fn em0(&mut self) -> Em0W<'_, EmrSpec> {
630        Em0W::new(self, 0)
631    }
632    #[doc = "Bit 1 - External Match 1"]
633    #[inline(always)]
634    pub fn em1(&mut self) -> Em1W<'_, EmrSpec> {
635        Em1W::new(self, 1)
636    }
637    #[doc = "Bit 2 - External Match 2"]
638    #[inline(always)]
639    pub fn em2(&mut self) -> Em2W<'_, EmrSpec> {
640        Em2W::new(self, 2)
641    }
642    #[doc = "Bit 3 - External Match 3"]
643    #[inline(always)]
644    pub fn em3(&mut self) -> Em3W<'_, EmrSpec> {
645        Em3W::new(self, 3)
646    }
647    #[doc = "Bits 4:5 - External Match Control 0"]
648    #[inline(always)]
649    pub fn emc0(&mut self) -> Emc0W<'_, EmrSpec> {
650        Emc0W::new(self, 4)
651    }
652    #[doc = "Bits 6:7 - External Match Control 1"]
653    #[inline(always)]
654    pub fn emc1(&mut self) -> Emc1W<'_, EmrSpec> {
655        Emc1W::new(self, 6)
656    }
657    #[doc = "Bits 8:9 - External Match Control 2"]
658    #[inline(always)]
659    pub fn emc2(&mut self) -> Emc2W<'_, EmrSpec> {
660        Emc2W::new(self, 8)
661    }
662    #[doc = "Bits 10:11 - External Match Control 3"]
663    #[inline(always)]
664    pub fn emc3(&mut self) -> Emc3W<'_, EmrSpec> {
665        Emc3W::new(self, 10)
666    }
667}
668#[doc = "External Match\n\nYou can [`read`](crate::Reg::read) this register and get [`emr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`emr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
669pub struct EmrSpec;
670impl crate::RegisterSpec for EmrSpec {
671    type Ux = u32;
672}
673#[doc = "`read()` method returns [`emr::R`](R) reader structure"]
674impl crate::Readable for EmrSpec {}
675#[doc = "`write(|w| ..)` method takes [`emr::W`](W) writer structure"]
676impl crate::Writable for EmrSpec {
677    type Safety = crate::Unsafe;
678}
679#[doc = "`reset()` method sets EMR to value 0"]
680impl crate::Resettable for EmrSpec {}