lpc845_pac/ctimer0/
emr.rs

1#[doc = "Register `EMR` reader"]
2pub struct R(crate::R<EMR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<EMR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<EMR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<EMR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `EMR` writer"]
17pub struct W(crate::W<EMR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<EMR_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<EMR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<EMR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `EM0` reader - External Match 0. This bit reflects the state of output MAT0, whether or not this output is connected to a pin. When a match occurs between the TC and MR0, this bit can either toggle, go LOW, go HIGH, or do nothing, as selected by EMR\\[5:4\\]. This bit is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH."]
38pub struct EM0_R(crate::FieldReader<bool, bool>);
39impl EM0_R {
40    pub(crate) fn new(bits: bool) -> Self {
41        EM0_R(crate::FieldReader::new(bits))
42    }
43}
44impl core::ops::Deref for EM0_R {
45    type Target = crate::FieldReader<bool, bool>;
46    #[inline(always)]
47    fn deref(&self) -> &Self::Target {
48        &self.0
49    }
50}
51#[doc = "Field `EM0` writer - External Match 0. This bit reflects the state of output MAT0, whether or not this output is connected to a pin. When a match occurs between the TC and MR0, this bit can either toggle, go LOW, go HIGH, or do nothing, as selected by EMR\\[5:4\\]. This bit is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH."]
52pub struct EM0_W<'a> {
53    w: &'a mut W,
54}
55impl<'a> EM0_W<'a> {
56    #[doc = r"Sets the field bit"]
57    #[inline(always)]
58    pub fn set_bit(self) -> &'a mut W {
59        self.bit(true)
60    }
61    #[doc = r"Clears the field bit"]
62    #[inline(always)]
63    pub fn clear_bit(self) -> &'a mut W {
64        self.bit(false)
65    }
66    #[doc = r"Writes raw bits to the field"]
67    #[inline(always)]
68    pub fn bit(self, value: bool) -> &'a mut W {
69        self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
70        self.w
71    }
72}
73#[doc = "Field `EM1` reader - External Match 1. This bit reflects the state of output MAT1, whether or not this output is connected to a pin. When a match occurs between the TC and MR1, this bit can either toggle, go LOW, go HIGH, or do nothing, as selected by EMR\\[7:6\\]. This bit is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH."]
74pub struct EM1_R(crate::FieldReader<bool, bool>);
75impl EM1_R {
76    pub(crate) fn new(bits: bool) -> Self {
77        EM1_R(crate::FieldReader::new(bits))
78    }
79}
80impl core::ops::Deref for EM1_R {
81    type Target = crate::FieldReader<bool, bool>;
82    #[inline(always)]
83    fn deref(&self) -> &Self::Target {
84        &self.0
85    }
86}
87#[doc = "Field `EM1` writer - External Match 1. This bit reflects the state of output MAT1, whether or not this output is connected to a pin. When a match occurs between the TC and MR1, this bit can either toggle, go LOW, go HIGH, or do nothing, as selected by EMR\\[7:6\\]. This bit is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH."]
88pub struct EM1_W<'a> {
89    w: &'a mut W,
90}
91impl<'a> EM1_W<'a> {
92    #[doc = r"Sets the field bit"]
93    #[inline(always)]
94    pub fn set_bit(self) -> &'a mut W {
95        self.bit(true)
96    }
97    #[doc = r"Clears the field bit"]
98    #[inline(always)]
99    pub fn clear_bit(self) -> &'a mut W {
100        self.bit(false)
101    }
102    #[doc = r"Writes raw bits to the field"]
103    #[inline(always)]
104    pub fn bit(self, value: bool) -> &'a mut W {
105        self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
106        self.w
107    }
108}
109#[doc = "Field `EM2` reader - External Match 2. This bit reflects the state of output MAT2, whether or not this output is connected to a pin. When a match occurs between the TC and MR2, this bit can either toggle, go LOW, go HIGH, or do nothing, as selected by EMR\\[9:8\\]. This bit is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH."]
110pub struct EM2_R(crate::FieldReader<bool, bool>);
111impl EM2_R {
112    pub(crate) fn new(bits: bool) -> Self {
113        EM2_R(crate::FieldReader::new(bits))
114    }
115}
116impl core::ops::Deref for EM2_R {
117    type Target = crate::FieldReader<bool, bool>;
118    #[inline(always)]
119    fn deref(&self) -> &Self::Target {
120        &self.0
121    }
122}
123#[doc = "Field `EM2` writer - External Match 2. This bit reflects the state of output MAT2, whether or not this output is connected to a pin. When a match occurs between the TC and MR2, this bit can either toggle, go LOW, go HIGH, or do nothing, as selected by EMR\\[9:8\\]. This bit is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH."]
124pub struct EM2_W<'a> {
125    w: &'a mut W,
126}
127impl<'a> EM2_W<'a> {
128    #[doc = r"Sets the field bit"]
129    #[inline(always)]
130    pub fn set_bit(self) -> &'a mut W {
131        self.bit(true)
132    }
133    #[doc = r"Clears the field bit"]
134    #[inline(always)]
135    pub fn clear_bit(self) -> &'a mut W {
136        self.bit(false)
137    }
138    #[doc = r"Writes raw bits to the field"]
139    #[inline(always)]
140    pub fn bit(self, value: bool) -> &'a mut W {
141        self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
142        self.w
143    }
144}
145#[doc = "Field `EM3` reader - External Match 3. This bit reflects the state of output MAT3, whether or not this output is connected to a pin. When a match occurs between the TC and MR3, this bit can either toggle, go LOW, go HIGH, or do nothing, as selected by MR\\[11:10\\]. This bit is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH."]
146pub struct EM3_R(crate::FieldReader<bool, bool>);
147impl EM3_R {
148    pub(crate) fn new(bits: bool) -> Self {
149        EM3_R(crate::FieldReader::new(bits))
150    }
151}
152impl core::ops::Deref for EM3_R {
153    type Target = crate::FieldReader<bool, bool>;
154    #[inline(always)]
155    fn deref(&self) -> &Self::Target {
156        &self.0
157    }
158}
159#[doc = "Field `EM3` writer - External Match 3. This bit reflects the state of output MAT3, whether or not this output is connected to a pin. When a match occurs between the TC and MR3, this bit can either toggle, go LOW, go HIGH, or do nothing, as selected by MR\\[11:10\\]. This bit is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH."]
160pub struct EM3_W<'a> {
161    w: &'a mut W,
162}
163impl<'a> EM3_W<'a> {
164    #[doc = r"Sets the field bit"]
165    #[inline(always)]
166    pub fn set_bit(self) -> &'a mut W {
167        self.bit(true)
168    }
169    #[doc = r"Clears the field bit"]
170    #[inline(always)]
171    pub fn clear_bit(self) -> &'a mut W {
172        self.bit(false)
173    }
174    #[doc = r"Writes raw bits to the field"]
175    #[inline(always)]
176    pub fn bit(self, value: bool) -> &'a mut W {
177        self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
178        self.w
179    }
180}
181#[doc = "External Match Control 0. Determines the functionality of External Match 0.\n\nValue on reset: 0"]
182#[derive(Clone, Copy, Debug, PartialEq)]
183#[repr(u8)]
184pub enum EMC0_A {
185    #[doc = "0: Do Nothing."]
186    DO_NOTHING = 0,
187    #[doc = "1: Clear. Clear the corresponding External Match bit/output to 0 (MAT0 pin is LOW if pinned out)."]
188    CLEAR = 1,
189    #[doc = "2: Set. Set the corresponding External Match bit/output to 1 (MAT0 pin is HIGH if pinned out)."]
190    SET = 2,
191    #[doc = "3: Toggle. Toggle the corresponding External Match bit/output."]
192    TOGGLE = 3,
193}
194impl From<EMC0_A> for u8 {
195    #[inline(always)]
196    fn from(variant: EMC0_A) -> Self {
197        variant as _
198    }
199}
200#[doc = "Field `EMC0` reader - External Match Control 0. Determines the functionality of External Match 0."]
201pub struct EMC0_R(crate::FieldReader<u8, EMC0_A>);
202impl EMC0_R {
203    pub(crate) fn new(bits: u8) -> Self {
204        EMC0_R(crate::FieldReader::new(bits))
205    }
206    #[doc = r"Get enumerated values variant"]
207    #[inline(always)]
208    pub fn variant(&self) -> EMC0_A {
209        match self.bits {
210            0 => EMC0_A::DO_NOTHING,
211            1 => EMC0_A::CLEAR,
212            2 => EMC0_A::SET,
213            3 => EMC0_A::TOGGLE,
214            _ => unreachable!(),
215        }
216    }
217    #[doc = "Checks if the value of the field is `DO_NOTHING`"]
218    #[inline(always)]
219    pub fn is_do_nothing(&self) -> bool {
220        **self == EMC0_A::DO_NOTHING
221    }
222    #[doc = "Checks if the value of the field is `CLEAR`"]
223    #[inline(always)]
224    pub fn is_clear(&self) -> bool {
225        **self == EMC0_A::CLEAR
226    }
227    #[doc = "Checks if the value of the field is `SET`"]
228    #[inline(always)]
229    pub fn is_set(&self) -> bool {
230        **self == EMC0_A::SET
231    }
232    #[doc = "Checks if the value of the field is `TOGGLE`"]
233    #[inline(always)]
234    pub fn is_toggle(&self) -> bool {
235        **self == EMC0_A::TOGGLE
236    }
237}
238impl core::ops::Deref for EMC0_R {
239    type Target = crate::FieldReader<u8, EMC0_A>;
240    #[inline(always)]
241    fn deref(&self) -> &Self::Target {
242        &self.0
243    }
244}
245#[doc = "Field `EMC0` writer - External Match Control 0. Determines the functionality of External Match 0."]
246pub struct EMC0_W<'a> {
247    w: &'a mut W,
248}
249impl<'a> EMC0_W<'a> {
250    #[doc = r"Writes `variant` to the field"]
251    #[inline(always)]
252    pub fn variant(self, variant: EMC0_A) -> &'a mut W {
253        self.bits(variant.into())
254    }
255    #[doc = "Do Nothing."]
256    #[inline(always)]
257    pub fn do_nothing(self) -> &'a mut W {
258        self.variant(EMC0_A::DO_NOTHING)
259    }
260    #[doc = "Clear. Clear the corresponding External Match bit/output to 0 (MAT0 pin is LOW if pinned out)."]
261    #[inline(always)]
262    pub fn clear(self) -> &'a mut W {
263        self.variant(EMC0_A::CLEAR)
264    }
265    #[doc = "Set. Set the corresponding External Match bit/output to 1 (MAT0 pin is HIGH if pinned out)."]
266    #[inline(always)]
267    pub fn set(self) -> &'a mut W {
268        self.variant(EMC0_A::SET)
269    }
270    #[doc = "Toggle. Toggle the corresponding External Match bit/output."]
271    #[inline(always)]
272    pub fn toggle(self) -> &'a mut W {
273        self.variant(EMC0_A::TOGGLE)
274    }
275    #[doc = r"Writes raw bits to the field"]
276    #[inline(always)]
277    pub fn bits(self, value: u8) -> &'a mut W {
278        self.w.bits = (self.w.bits & !(0x03 << 4)) | ((value as u32 & 0x03) << 4);
279        self.w
280    }
281}
282#[doc = "External Match Control 1. Determines the functionality of External Match 1.\n\nValue on reset: 0"]
283#[derive(Clone, Copy, Debug, PartialEq)]
284#[repr(u8)]
285pub enum EMC1_A {
286    #[doc = "0: Do Nothing."]
287    DO_NOTHING = 0,
288    #[doc = "1: Clear. Clear the corresponding External Match bit/output to 0 (MAT1 pin is LOW if pinned out)."]
289    CLEAR = 1,
290    #[doc = "2: Set. Set the corresponding External Match bit/output to 1 (MAT1 pin is HIGH if pinned out)."]
291    SET = 2,
292    #[doc = "3: Toggle. Toggle the corresponding External Match bit/output."]
293    TOGGLE = 3,
294}
295impl From<EMC1_A> for u8 {
296    #[inline(always)]
297    fn from(variant: EMC1_A) -> Self {
298        variant as _
299    }
300}
301#[doc = "Field `EMC1` reader - External Match Control 1. Determines the functionality of External Match 1."]
302pub struct EMC1_R(crate::FieldReader<u8, EMC1_A>);
303impl EMC1_R {
304    pub(crate) fn new(bits: u8) -> Self {
305        EMC1_R(crate::FieldReader::new(bits))
306    }
307    #[doc = r"Get enumerated values variant"]
308    #[inline(always)]
309    pub fn variant(&self) -> EMC1_A {
310        match self.bits {
311            0 => EMC1_A::DO_NOTHING,
312            1 => EMC1_A::CLEAR,
313            2 => EMC1_A::SET,
314            3 => EMC1_A::TOGGLE,
315            _ => unreachable!(),
316        }
317    }
318    #[doc = "Checks if the value of the field is `DO_NOTHING`"]
319    #[inline(always)]
320    pub fn is_do_nothing(&self) -> bool {
321        **self == EMC1_A::DO_NOTHING
322    }
323    #[doc = "Checks if the value of the field is `CLEAR`"]
324    #[inline(always)]
325    pub fn is_clear(&self) -> bool {
326        **self == EMC1_A::CLEAR
327    }
328    #[doc = "Checks if the value of the field is `SET`"]
329    #[inline(always)]
330    pub fn is_set(&self) -> bool {
331        **self == EMC1_A::SET
332    }
333    #[doc = "Checks if the value of the field is `TOGGLE`"]
334    #[inline(always)]
335    pub fn is_toggle(&self) -> bool {
336        **self == EMC1_A::TOGGLE
337    }
338}
339impl core::ops::Deref for EMC1_R {
340    type Target = crate::FieldReader<u8, EMC1_A>;
341    #[inline(always)]
342    fn deref(&self) -> &Self::Target {
343        &self.0
344    }
345}
346#[doc = "Field `EMC1` writer - External Match Control 1. Determines the functionality of External Match 1."]
347pub struct EMC1_W<'a> {
348    w: &'a mut W,
349}
350impl<'a> EMC1_W<'a> {
351    #[doc = r"Writes `variant` to the field"]
352    #[inline(always)]
353    pub fn variant(self, variant: EMC1_A) -> &'a mut W {
354        self.bits(variant.into())
355    }
356    #[doc = "Do Nothing."]
357    #[inline(always)]
358    pub fn do_nothing(self) -> &'a mut W {
359        self.variant(EMC1_A::DO_NOTHING)
360    }
361    #[doc = "Clear. Clear the corresponding External Match bit/output to 0 (MAT1 pin is LOW if pinned out)."]
362    #[inline(always)]
363    pub fn clear(self) -> &'a mut W {
364        self.variant(EMC1_A::CLEAR)
365    }
366    #[doc = "Set. Set the corresponding External Match bit/output to 1 (MAT1 pin is HIGH if pinned out)."]
367    #[inline(always)]
368    pub fn set(self) -> &'a mut W {
369        self.variant(EMC1_A::SET)
370    }
371    #[doc = "Toggle. Toggle the corresponding External Match bit/output."]
372    #[inline(always)]
373    pub fn toggle(self) -> &'a mut W {
374        self.variant(EMC1_A::TOGGLE)
375    }
376    #[doc = r"Writes raw bits to the field"]
377    #[inline(always)]
378    pub fn bits(self, value: u8) -> &'a mut W {
379        self.w.bits = (self.w.bits & !(0x03 << 6)) | ((value as u32 & 0x03) << 6);
380        self.w
381    }
382}
383#[doc = "External Match Control 2. Determines the functionality of External Match 2.\n\nValue on reset: 0"]
384#[derive(Clone, Copy, Debug, PartialEq)]
385#[repr(u8)]
386pub enum EMC2_A {
387    #[doc = "0: Do Nothing."]
388    DO_NOTHING = 0,
389    #[doc = "1: Clear. Clear the corresponding External Match bit/output to 0 (MAT2 pin is LOW if pinned out)."]
390    CLEAR = 1,
391    #[doc = "2: Set. Set the corresponding External Match bit/output to 1 (MAT2 pin is HIGH if pinned out)."]
392    SET = 2,
393    #[doc = "3: Toggle. Toggle the corresponding External Match bit/output."]
394    TOGGLE = 3,
395}
396impl From<EMC2_A> for u8 {
397    #[inline(always)]
398    fn from(variant: EMC2_A) -> Self {
399        variant as _
400    }
401}
402#[doc = "Field `EMC2` reader - External Match Control 2. Determines the functionality of External Match 2."]
403pub struct EMC2_R(crate::FieldReader<u8, EMC2_A>);
404impl EMC2_R {
405    pub(crate) fn new(bits: u8) -> Self {
406        EMC2_R(crate::FieldReader::new(bits))
407    }
408    #[doc = r"Get enumerated values variant"]
409    #[inline(always)]
410    pub fn variant(&self) -> EMC2_A {
411        match self.bits {
412            0 => EMC2_A::DO_NOTHING,
413            1 => EMC2_A::CLEAR,
414            2 => EMC2_A::SET,
415            3 => EMC2_A::TOGGLE,
416            _ => unreachable!(),
417        }
418    }
419    #[doc = "Checks if the value of the field is `DO_NOTHING`"]
420    #[inline(always)]
421    pub fn is_do_nothing(&self) -> bool {
422        **self == EMC2_A::DO_NOTHING
423    }
424    #[doc = "Checks if the value of the field is `CLEAR`"]
425    #[inline(always)]
426    pub fn is_clear(&self) -> bool {
427        **self == EMC2_A::CLEAR
428    }
429    #[doc = "Checks if the value of the field is `SET`"]
430    #[inline(always)]
431    pub fn is_set(&self) -> bool {
432        **self == EMC2_A::SET
433    }
434    #[doc = "Checks if the value of the field is `TOGGLE`"]
435    #[inline(always)]
436    pub fn is_toggle(&self) -> bool {
437        **self == EMC2_A::TOGGLE
438    }
439}
440impl core::ops::Deref for EMC2_R {
441    type Target = crate::FieldReader<u8, EMC2_A>;
442    #[inline(always)]
443    fn deref(&self) -> &Self::Target {
444        &self.0
445    }
446}
447#[doc = "Field `EMC2` writer - External Match Control 2. Determines the functionality of External Match 2."]
448pub struct EMC2_W<'a> {
449    w: &'a mut W,
450}
451impl<'a> EMC2_W<'a> {
452    #[doc = r"Writes `variant` to the field"]
453    #[inline(always)]
454    pub fn variant(self, variant: EMC2_A) -> &'a mut W {
455        self.bits(variant.into())
456    }
457    #[doc = "Do Nothing."]
458    #[inline(always)]
459    pub fn do_nothing(self) -> &'a mut W {
460        self.variant(EMC2_A::DO_NOTHING)
461    }
462    #[doc = "Clear. Clear the corresponding External Match bit/output to 0 (MAT2 pin is LOW if pinned out)."]
463    #[inline(always)]
464    pub fn clear(self) -> &'a mut W {
465        self.variant(EMC2_A::CLEAR)
466    }
467    #[doc = "Set. Set the corresponding External Match bit/output to 1 (MAT2 pin is HIGH if pinned out)."]
468    #[inline(always)]
469    pub fn set(self) -> &'a mut W {
470        self.variant(EMC2_A::SET)
471    }
472    #[doc = "Toggle. Toggle the corresponding External Match bit/output."]
473    #[inline(always)]
474    pub fn toggle(self) -> &'a mut W {
475        self.variant(EMC2_A::TOGGLE)
476    }
477    #[doc = r"Writes raw bits to the field"]
478    #[inline(always)]
479    pub fn bits(self, value: u8) -> &'a mut W {
480        self.w.bits = (self.w.bits & !(0x03 << 8)) | ((value as u32 & 0x03) << 8);
481        self.w
482    }
483}
484#[doc = "External Match Control 3. Determines the functionality of External Match 3.\n\nValue on reset: 0"]
485#[derive(Clone, Copy, Debug, PartialEq)]
486#[repr(u8)]
487pub enum EMC3_A {
488    #[doc = "0: Do Nothing."]
489    DO_NOTHING = 0,
490    #[doc = "1: Clear. Clear the corresponding External Match bit/output to 0 (MAT3 pin is LOW if pinned out)."]
491    CLEAR = 1,
492    #[doc = "2: Set. Set the corresponding External Match bit/output to 1 (MAT3 pin is HIGH if pinned out)."]
493    SET = 2,
494    #[doc = "3: Toggle. Toggle the corresponding External Match bit/output."]
495    TOGGLE = 3,
496}
497impl From<EMC3_A> for u8 {
498    #[inline(always)]
499    fn from(variant: EMC3_A) -> Self {
500        variant as _
501    }
502}
503#[doc = "Field `EMC3` reader - External Match Control 3. Determines the functionality of External Match 3."]
504pub struct EMC3_R(crate::FieldReader<u8, EMC3_A>);
505impl EMC3_R {
506    pub(crate) fn new(bits: u8) -> Self {
507        EMC3_R(crate::FieldReader::new(bits))
508    }
509    #[doc = r"Get enumerated values variant"]
510    #[inline(always)]
511    pub fn variant(&self) -> EMC3_A {
512        match self.bits {
513            0 => EMC3_A::DO_NOTHING,
514            1 => EMC3_A::CLEAR,
515            2 => EMC3_A::SET,
516            3 => EMC3_A::TOGGLE,
517            _ => unreachable!(),
518        }
519    }
520    #[doc = "Checks if the value of the field is `DO_NOTHING`"]
521    #[inline(always)]
522    pub fn is_do_nothing(&self) -> bool {
523        **self == EMC3_A::DO_NOTHING
524    }
525    #[doc = "Checks if the value of the field is `CLEAR`"]
526    #[inline(always)]
527    pub fn is_clear(&self) -> bool {
528        **self == EMC3_A::CLEAR
529    }
530    #[doc = "Checks if the value of the field is `SET`"]
531    #[inline(always)]
532    pub fn is_set(&self) -> bool {
533        **self == EMC3_A::SET
534    }
535    #[doc = "Checks if the value of the field is `TOGGLE`"]
536    #[inline(always)]
537    pub fn is_toggle(&self) -> bool {
538        **self == EMC3_A::TOGGLE
539    }
540}
541impl core::ops::Deref for EMC3_R {
542    type Target = crate::FieldReader<u8, EMC3_A>;
543    #[inline(always)]
544    fn deref(&self) -> &Self::Target {
545        &self.0
546    }
547}
548#[doc = "Field `EMC3` writer - External Match Control 3. Determines the functionality of External Match 3."]
549pub struct EMC3_W<'a> {
550    w: &'a mut W,
551}
552impl<'a> EMC3_W<'a> {
553    #[doc = r"Writes `variant` to the field"]
554    #[inline(always)]
555    pub fn variant(self, variant: EMC3_A) -> &'a mut W {
556        self.bits(variant.into())
557    }
558    #[doc = "Do Nothing."]
559    #[inline(always)]
560    pub fn do_nothing(self) -> &'a mut W {
561        self.variant(EMC3_A::DO_NOTHING)
562    }
563    #[doc = "Clear. Clear the corresponding External Match bit/output to 0 (MAT3 pin is LOW if pinned out)."]
564    #[inline(always)]
565    pub fn clear(self) -> &'a mut W {
566        self.variant(EMC3_A::CLEAR)
567    }
568    #[doc = "Set. Set the corresponding External Match bit/output to 1 (MAT3 pin is HIGH if pinned out)."]
569    #[inline(always)]
570    pub fn set(self) -> &'a mut W {
571        self.variant(EMC3_A::SET)
572    }
573    #[doc = "Toggle. Toggle the corresponding External Match bit/output."]
574    #[inline(always)]
575    pub fn toggle(self) -> &'a mut W {
576        self.variant(EMC3_A::TOGGLE)
577    }
578    #[doc = r"Writes raw bits to the field"]
579    #[inline(always)]
580    pub fn bits(self, value: u8) -> &'a mut W {
581        self.w.bits = (self.w.bits & !(0x03 << 10)) | ((value as u32 & 0x03) << 10);
582        self.w
583    }
584}
585impl R {
586    #[doc = "Bit 0 - External Match 0. This bit reflects the state of output MAT0, whether or not this output is connected to a pin. When a match occurs between the TC and MR0, this bit can either toggle, go LOW, go HIGH, or do nothing, as selected by EMR\\[5:4\\]. This bit is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH."]
587    #[inline(always)]
588    pub fn em0(&self) -> EM0_R {
589        EM0_R::new((self.bits & 0x01) != 0)
590    }
591    #[doc = "Bit 1 - External Match 1. This bit reflects the state of output MAT1, whether or not this output is connected to a pin. When a match occurs between the TC and MR1, this bit can either toggle, go LOW, go HIGH, or do nothing, as selected by EMR\\[7:6\\]. This bit is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH."]
592    #[inline(always)]
593    pub fn em1(&self) -> EM1_R {
594        EM1_R::new(((self.bits >> 1) & 0x01) != 0)
595    }
596    #[doc = "Bit 2 - External Match 2. This bit reflects the state of output MAT2, whether or not this output is connected to a pin. When a match occurs between the TC and MR2, this bit can either toggle, go LOW, go HIGH, or do nothing, as selected by EMR\\[9:8\\]. This bit is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH."]
597    #[inline(always)]
598    pub fn em2(&self) -> EM2_R {
599        EM2_R::new(((self.bits >> 2) & 0x01) != 0)
600    }
601    #[doc = "Bit 3 - External Match 3. This bit reflects the state of output MAT3, whether or not this output is connected to a pin. When a match occurs between the TC and MR3, this bit can either toggle, go LOW, go HIGH, or do nothing, as selected by MR\\[11:10\\]. This bit is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH."]
602    #[inline(always)]
603    pub fn em3(&self) -> EM3_R {
604        EM3_R::new(((self.bits >> 3) & 0x01) != 0)
605    }
606    #[doc = "Bits 4:5 - External Match Control 0. Determines the functionality of External Match 0."]
607    #[inline(always)]
608    pub fn emc0(&self) -> EMC0_R {
609        EMC0_R::new(((self.bits >> 4) & 0x03) as u8)
610    }
611    #[doc = "Bits 6:7 - External Match Control 1. Determines the functionality of External Match 1."]
612    #[inline(always)]
613    pub fn emc1(&self) -> EMC1_R {
614        EMC1_R::new(((self.bits >> 6) & 0x03) as u8)
615    }
616    #[doc = "Bits 8:9 - External Match Control 2. Determines the functionality of External Match 2."]
617    #[inline(always)]
618    pub fn emc2(&self) -> EMC2_R {
619        EMC2_R::new(((self.bits >> 8) & 0x03) as u8)
620    }
621    #[doc = "Bits 10:11 - External Match Control 3. Determines the functionality of External Match 3."]
622    #[inline(always)]
623    pub fn emc3(&self) -> EMC3_R {
624        EMC3_R::new(((self.bits >> 10) & 0x03) as u8)
625    }
626}
627impl W {
628    #[doc = "Bit 0 - External Match 0. This bit reflects the state of output MAT0, whether or not this output is connected to a pin. When a match occurs between the TC and MR0, this bit can either toggle, go LOW, go HIGH, or do nothing, as selected by EMR\\[5:4\\]. This bit is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH."]
629    #[inline(always)]
630    pub fn em0(&mut self) -> EM0_W {
631        EM0_W { w: self }
632    }
633    #[doc = "Bit 1 - External Match 1. This bit reflects the state of output MAT1, whether or not this output is connected to a pin. When a match occurs between the TC and MR1, this bit can either toggle, go LOW, go HIGH, or do nothing, as selected by EMR\\[7:6\\]. This bit is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH."]
634    #[inline(always)]
635    pub fn em1(&mut self) -> EM1_W {
636        EM1_W { w: self }
637    }
638    #[doc = "Bit 2 - External Match 2. This bit reflects the state of output MAT2, whether or not this output is connected to a pin. When a match occurs between the TC and MR2, this bit can either toggle, go LOW, go HIGH, or do nothing, as selected by EMR\\[9:8\\]. This bit is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH."]
639    #[inline(always)]
640    pub fn em2(&mut self) -> EM2_W {
641        EM2_W { w: self }
642    }
643    #[doc = "Bit 3 - External Match 3. This bit reflects the state of output MAT3, whether or not this output is connected to a pin. When a match occurs between the TC and MR3, this bit can either toggle, go LOW, go HIGH, or do nothing, as selected by MR\\[11:10\\]. This bit is driven to the MAT pins if the match function is selected via IOCON. 0 = LOW. 1 = HIGH."]
644    #[inline(always)]
645    pub fn em3(&mut self) -> EM3_W {
646        EM3_W { w: self }
647    }
648    #[doc = "Bits 4:5 - External Match Control 0. Determines the functionality of External Match 0."]
649    #[inline(always)]
650    pub fn emc0(&mut self) -> EMC0_W {
651        EMC0_W { w: self }
652    }
653    #[doc = "Bits 6:7 - External Match Control 1. Determines the functionality of External Match 1."]
654    #[inline(always)]
655    pub fn emc1(&mut self) -> EMC1_W {
656        EMC1_W { w: self }
657    }
658    #[doc = "Bits 8:9 - External Match Control 2. Determines the functionality of External Match 2."]
659    #[inline(always)]
660    pub fn emc2(&mut self) -> EMC2_W {
661        EMC2_W { w: self }
662    }
663    #[doc = "Bits 10:11 - External Match Control 3. Determines the functionality of External Match 3."]
664    #[inline(always)]
665    pub fn emc3(&mut self) -> EMC3_W {
666        EMC3_W { w: self }
667    }
668    #[doc = "Writes raw bits to the register."]
669    #[inline(always)]
670    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
671        self.0.bits(bits);
672        self
673    }
674}
675#[doc = "External Match Register. The EMR controls the match function and the external match pins.\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 [emr](index.html) module"]
676pub struct EMR_SPEC;
677impl crate::RegisterSpec for EMR_SPEC {
678    type Ux = u32;
679}
680#[doc = "`read()` method returns [emr::R](R) reader structure"]
681impl crate::Readable for EMR_SPEC {
682    type Reader = R;
683}
684#[doc = "`write(|w| ..)` method takes [emr::W](W) writer structure"]
685impl crate::Writable for EMR_SPEC {
686    type Writer = W;
687}
688#[doc = "`reset()` method sets EMR to value 0"]
689impl crate::Resettable for EMR_SPEC {
690    #[inline(always)]
691    fn reset_value() -> Self::Ux {
692        0
693    }
694}