mcxa_pac/adc0/
ie.rs

1#[doc = "Register `IE` reader"]
2pub type R = crate::R<IeSpec>;
3#[doc = "Register `IE` writer"]
4pub type W = crate::W<IeSpec>;
5#[doc = "FIFO 0 Watermark Interrupt Enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Fwmie0 {
9    #[doc = "0: FIFO 0 watermark interrupts are not enabled."]
10    Disabled = 0,
11    #[doc = "1: FIFO 0 watermark interrupts are enabled."]
12    Enabled = 1,
13}
14impl From<Fwmie0> for bool {
15    #[inline(always)]
16    fn from(variant: Fwmie0) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `FWMIE0` reader - FIFO 0 Watermark Interrupt Enable"]
21pub type Fwmie0R = crate::BitReader<Fwmie0>;
22impl Fwmie0R {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Fwmie0 {
26        match self.bits {
27            false => Fwmie0::Disabled,
28            true => Fwmie0::Enabled,
29        }
30    }
31    #[doc = "FIFO 0 watermark interrupts are not enabled."]
32    #[inline(always)]
33    pub fn is_disabled(&self) -> bool {
34        *self == Fwmie0::Disabled
35    }
36    #[doc = "FIFO 0 watermark interrupts are enabled."]
37    #[inline(always)]
38    pub fn is_enabled(&self) -> bool {
39        *self == Fwmie0::Enabled
40    }
41}
42#[doc = "Field `FWMIE0` writer - FIFO 0 Watermark Interrupt Enable"]
43pub type Fwmie0W<'a, REG> = crate::BitWriter<'a, REG, Fwmie0>;
44impl<'a, REG> Fwmie0W<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "FIFO 0 watermark interrupts are not enabled."]
49    #[inline(always)]
50    pub fn disabled(self) -> &'a mut crate::W<REG> {
51        self.variant(Fwmie0::Disabled)
52    }
53    #[doc = "FIFO 0 watermark interrupts are enabled."]
54    #[inline(always)]
55    pub fn enabled(self) -> &'a mut crate::W<REG> {
56        self.variant(Fwmie0::Enabled)
57    }
58}
59#[doc = "Result FIFO 0 Overflow Interrupt Enable\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Fofie0 {
63    #[doc = "0: FIFO 0 overflow interrupts are not enabled."]
64    Disabled = 0,
65    #[doc = "1: FIFO 0 overflow interrupts are enabled."]
66    Enabled = 1,
67}
68impl From<Fofie0> for bool {
69    #[inline(always)]
70    fn from(variant: Fofie0) -> Self {
71        variant as u8 != 0
72    }
73}
74#[doc = "Field `FOFIE0` reader - Result FIFO 0 Overflow Interrupt Enable"]
75pub type Fofie0R = crate::BitReader<Fofie0>;
76impl Fofie0R {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub const fn variant(&self) -> Fofie0 {
80        match self.bits {
81            false => Fofie0::Disabled,
82            true => Fofie0::Enabled,
83        }
84    }
85    #[doc = "FIFO 0 overflow interrupts are not enabled."]
86    #[inline(always)]
87    pub fn is_disabled(&self) -> bool {
88        *self == Fofie0::Disabled
89    }
90    #[doc = "FIFO 0 overflow interrupts are enabled."]
91    #[inline(always)]
92    pub fn is_enabled(&self) -> bool {
93        *self == Fofie0::Enabled
94    }
95}
96#[doc = "Field `FOFIE0` writer - Result FIFO 0 Overflow Interrupt Enable"]
97pub type Fofie0W<'a, REG> = crate::BitWriter<'a, REG, Fofie0>;
98impl<'a, REG> Fofie0W<'a, REG>
99where
100    REG: crate::Writable + crate::RegisterSpec,
101{
102    #[doc = "FIFO 0 overflow interrupts are not enabled."]
103    #[inline(always)]
104    pub fn disabled(self) -> &'a mut crate::W<REG> {
105        self.variant(Fofie0::Disabled)
106    }
107    #[doc = "FIFO 0 overflow interrupts are enabled."]
108    #[inline(always)]
109    pub fn enabled(self) -> &'a mut crate::W<REG> {
110        self.variant(Fofie0::Enabled)
111    }
112}
113#[doc = "Trigger Exception Interrupt Enable\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum TexcIe {
117    #[doc = "0: Trigger exception interrupts are disabled."]
118    Disabled = 0,
119    #[doc = "1: Trigger exception interrupts are enabled."]
120    Enabled = 1,
121}
122impl From<TexcIe> for bool {
123    #[inline(always)]
124    fn from(variant: TexcIe) -> Self {
125        variant as u8 != 0
126    }
127}
128#[doc = "Field `TEXC_IE` reader - Trigger Exception Interrupt Enable"]
129pub type TexcIeR = crate::BitReader<TexcIe>;
130impl TexcIeR {
131    #[doc = "Get enumerated values variant"]
132    #[inline(always)]
133    pub const fn variant(&self) -> TexcIe {
134        match self.bits {
135            false => TexcIe::Disabled,
136            true => TexcIe::Enabled,
137        }
138    }
139    #[doc = "Trigger exception interrupts are disabled."]
140    #[inline(always)]
141    pub fn is_disabled(&self) -> bool {
142        *self == TexcIe::Disabled
143    }
144    #[doc = "Trigger exception interrupts are enabled."]
145    #[inline(always)]
146    pub fn is_enabled(&self) -> bool {
147        *self == TexcIe::Enabled
148    }
149}
150#[doc = "Field `TEXC_IE` writer - Trigger Exception Interrupt Enable"]
151pub type TexcIeW<'a, REG> = crate::BitWriter<'a, REG, TexcIe>;
152impl<'a, REG> TexcIeW<'a, REG>
153where
154    REG: crate::Writable + crate::RegisterSpec,
155{
156    #[doc = "Trigger exception interrupts are disabled."]
157    #[inline(always)]
158    pub fn disabled(self) -> &'a mut crate::W<REG> {
159        self.variant(TexcIe::Disabled)
160    }
161    #[doc = "Trigger exception interrupts are enabled."]
162    #[inline(always)]
163    pub fn enabled(self) -> &'a mut crate::W<REG> {
164        self.variant(TexcIe::Enabled)
165    }
166}
167#[doc = "Trigger Completion Interrupt Enable\n\nValue on reset: 0"]
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170#[repr(u8)]
171pub enum TcompIe {
172    #[doc = "0: Trigger completion interrupts are disabled."]
173    Disabled = 0,
174    #[doc = "1: Trigger completion interrupts are enabled for trigger source 0 only."]
175    Trigger0CompleteEnabled = 1,
176    #[doc = "2: Trigger completion interrupts are enabled for trigger source 1 only."]
177    Trigger1CompleteEnabled = 2,
178    #[doc = "3: Associated trigger completion interrupts are enabled."]
179    TriggerXCompleteEnabled3 = 3,
180    #[doc = "4: Associated trigger completion interrupts are enabled."]
181    TriggerXCompleteEnabled4 = 4,
182    #[doc = "5: Associated trigger completion interrupts are enabled."]
183    TriggerXCompleteEnabled5 = 5,
184    #[doc = "6: Associated trigger completion interrupts are enabled."]
185    TriggerXCompleteEnabled6 = 6,
186    #[doc = "7: Associated trigger completion interrupts are enabled."]
187    TriggerXCompleteEnabled7 = 7,
188    #[doc = "8: Associated trigger completion interrupts are enabled."]
189    TriggerXCompleteEnabled8 = 8,
190    #[doc = "9: Associated trigger completion interrupts are enabled."]
191    TriggerXCompleteEnabled9 = 9,
192    #[doc = "15: Trigger completion interrupts are enabled for every trigger source."]
193    AllTriggerCompletesEnabled = 15,
194}
195impl From<TcompIe> for u8 {
196    #[inline(always)]
197    fn from(variant: TcompIe) -> Self {
198        variant as _
199    }
200}
201impl crate::FieldSpec for TcompIe {
202    type Ux = u8;
203}
204impl crate::IsEnum for TcompIe {}
205#[doc = "Field `TCOMP_IE` reader - Trigger Completion Interrupt Enable"]
206pub type TcompIeR = crate::FieldReader<TcompIe>;
207impl TcompIeR {
208    #[doc = "Get enumerated values variant"]
209    #[inline(always)]
210    pub const fn variant(&self) -> Option<TcompIe> {
211        match self.bits {
212            0 => Some(TcompIe::Disabled),
213            1 => Some(TcompIe::Trigger0CompleteEnabled),
214            2 => Some(TcompIe::Trigger1CompleteEnabled),
215            3 => Some(TcompIe::TriggerXCompleteEnabled3),
216            4 => Some(TcompIe::TriggerXCompleteEnabled4),
217            5 => Some(TcompIe::TriggerXCompleteEnabled5),
218            6 => Some(TcompIe::TriggerXCompleteEnabled6),
219            7 => Some(TcompIe::TriggerXCompleteEnabled7),
220            8 => Some(TcompIe::TriggerXCompleteEnabled8),
221            9 => Some(TcompIe::TriggerXCompleteEnabled9),
222            15 => Some(TcompIe::AllTriggerCompletesEnabled),
223            _ => None,
224        }
225    }
226    #[doc = "Trigger completion interrupts are disabled."]
227    #[inline(always)]
228    pub fn is_disabled(&self) -> bool {
229        *self == TcompIe::Disabled
230    }
231    #[doc = "Trigger completion interrupts are enabled for trigger source 0 only."]
232    #[inline(always)]
233    pub fn is_trigger_0_complete_enabled(&self) -> bool {
234        *self == TcompIe::Trigger0CompleteEnabled
235    }
236    #[doc = "Trigger completion interrupts are enabled for trigger source 1 only."]
237    #[inline(always)]
238    pub fn is_trigger_1_complete_enabled(&self) -> bool {
239        *self == TcompIe::Trigger1CompleteEnabled
240    }
241    #[doc = "Associated trigger completion interrupts are enabled."]
242    #[inline(always)]
243    pub fn is_trigger_x_complete_enabled_3(&self) -> bool {
244        *self == TcompIe::TriggerXCompleteEnabled3
245    }
246    #[doc = "Associated trigger completion interrupts are enabled."]
247    #[inline(always)]
248    pub fn is_trigger_x_complete_enabled_4(&self) -> bool {
249        *self == TcompIe::TriggerXCompleteEnabled4
250    }
251    #[doc = "Associated trigger completion interrupts are enabled."]
252    #[inline(always)]
253    pub fn is_trigger_x_complete_enabled_5(&self) -> bool {
254        *self == TcompIe::TriggerXCompleteEnabled5
255    }
256    #[doc = "Associated trigger completion interrupts are enabled."]
257    #[inline(always)]
258    pub fn is_trigger_x_complete_enabled_6(&self) -> bool {
259        *self == TcompIe::TriggerXCompleteEnabled6
260    }
261    #[doc = "Associated trigger completion interrupts are enabled."]
262    #[inline(always)]
263    pub fn is_trigger_x_complete_enabled_7(&self) -> bool {
264        *self == TcompIe::TriggerXCompleteEnabled7
265    }
266    #[doc = "Associated trigger completion interrupts are enabled."]
267    #[inline(always)]
268    pub fn is_trigger_x_complete_enabled_8(&self) -> bool {
269        *self == TcompIe::TriggerXCompleteEnabled8
270    }
271    #[doc = "Associated trigger completion interrupts are enabled."]
272    #[inline(always)]
273    pub fn is_trigger_x_complete_enabled_9(&self) -> bool {
274        *self == TcompIe::TriggerXCompleteEnabled9
275    }
276    #[doc = "Trigger completion interrupts are enabled for every trigger source."]
277    #[inline(always)]
278    pub fn is_all_trigger_completes_enabled(&self) -> bool {
279        *self == TcompIe::AllTriggerCompletesEnabled
280    }
281}
282#[doc = "Field `TCOMP_IE` writer - Trigger Completion Interrupt Enable"]
283pub type TcompIeW<'a, REG> = crate::FieldWriter<'a, REG, 4, TcompIe>;
284impl<'a, REG> TcompIeW<'a, REG>
285where
286    REG: crate::Writable + crate::RegisterSpec,
287    REG::Ux: From<u8>,
288{
289    #[doc = "Trigger completion interrupts are disabled."]
290    #[inline(always)]
291    pub fn disabled(self) -> &'a mut crate::W<REG> {
292        self.variant(TcompIe::Disabled)
293    }
294    #[doc = "Trigger completion interrupts are enabled for trigger source 0 only."]
295    #[inline(always)]
296    pub fn trigger_0_complete_enabled(self) -> &'a mut crate::W<REG> {
297        self.variant(TcompIe::Trigger0CompleteEnabled)
298    }
299    #[doc = "Trigger completion interrupts are enabled for trigger source 1 only."]
300    #[inline(always)]
301    pub fn trigger_1_complete_enabled(self) -> &'a mut crate::W<REG> {
302        self.variant(TcompIe::Trigger1CompleteEnabled)
303    }
304    #[doc = "Associated trigger completion interrupts are enabled."]
305    #[inline(always)]
306    pub fn trigger_x_complete_enabled_3(self) -> &'a mut crate::W<REG> {
307        self.variant(TcompIe::TriggerXCompleteEnabled3)
308    }
309    #[doc = "Associated trigger completion interrupts are enabled."]
310    #[inline(always)]
311    pub fn trigger_x_complete_enabled_4(self) -> &'a mut crate::W<REG> {
312        self.variant(TcompIe::TriggerXCompleteEnabled4)
313    }
314    #[doc = "Associated trigger completion interrupts are enabled."]
315    #[inline(always)]
316    pub fn trigger_x_complete_enabled_5(self) -> &'a mut crate::W<REG> {
317        self.variant(TcompIe::TriggerXCompleteEnabled5)
318    }
319    #[doc = "Associated trigger completion interrupts are enabled."]
320    #[inline(always)]
321    pub fn trigger_x_complete_enabled_6(self) -> &'a mut crate::W<REG> {
322        self.variant(TcompIe::TriggerXCompleteEnabled6)
323    }
324    #[doc = "Associated trigger completion interrupts are enabled."]
325    #[inline(always)]
326    pub fn trigger_x_complete_enabled_7(self) -> &'a mut crate::W<REG> {
327        self.variant(TcompIe::TriggerXCompleteEnabled7)
328    }
329    #[doc = "Associated trigger completion interrupts are enabled."]
330    #[inline(always)]
331    pub fn trigger_x_complete_enabled_8(self) -> &'a mut crate::W<REG> {
332        self.variant(TcompIe::TriggerXCompleteEnabled8)
333    }
334    #[doc = "Associated trigger completion interrupts are enabled."]
335    #[inline(always)]
336    pub fn trigger_x_complete_enabled_9(self) -> &'a mut crate::W<REG> {
337        self.variant(TcompIe::TriggerXCompleteEnabled9)
338    }
339    #[doc = "Trigger completion interrupts are enabled for every trigger source."]
340    #[inline(always)]
341    pub fn all_trigger_completes_enabled(self) -> &'a mut crate::W<REG> {
342        self.variant(TcompIe::AllTriggerCompletesEnabled)
343    }
344}
345impl R {
346    #[doc = "Bit 0 - FIFO 0 Watermark Interrupt Enable"]
347    #[inline(always)]
348    pub fn fwmie0(&self) -> Fwmie0R {
349        Fwmie0R::new((self.bits & 1) != 0)
350    }
351    #[doc = "Bit 1 - Result FIFO 0 Overflow Interrupt Enable"]
352    #[inline(always)]
353    pub fn fofie0(&self) -> Fofie0R {
354        Fofie0R::new(((self.bits >> 1) & 1) != 0)
355    }
356    #[doc = "Bit 8 - Trigger Exception Interrupt Enable"]
357    #[inline(always)]
358    pub fn texc_ie(&self) -> TexcIeR {
359        TexcIeR::new(((self.bits >> 8) & 1) != 0)
360    }
361    #[doc = "Bits 16:19 - Trigger Completion Interrupt Enable"]
362    #[inline(always)]
363    pub fn tcomp_ie(&self) -> TcompIeR {
364        TcompIeR::new(((self.bits >> 16) & 0x0f) as u8)
365    }
366}
367#[cfg(feature = "debug")]
368impl core::fmt::Debug for R {
369    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
370        f.debug_struct("IE")
371            .field("fwmie0", &self.fwmie0())
372            .field("fofie0", &self.fofie0())
373            .field("texc_ie", &self.texc_ie())
374            .field("tcomp_ie", &self.tcomp_ie())
375            .finish()
376    }
377}
378impl W {
379    #[doc = "Bit 0 - FIFO 0 Watermark Interrupt Enable"]
380    #[inline(always)]
381    pub fn fwmie0(&mut self) -> Fwmie0W<'_, IeSpec> {
382        Fwmie0W::new(self, 0)
383    }
384    #[doc = "Bit 1 - Result FIFO 0 Overflow Interrupt Enable"]
385    #[inline(always)]
386    pub fn fofie0(&mut self) -> Fofie0W<'_, IeSpec> {
387        Fofie0W::new(self, 1)
388    }
389    #[doc = "Bit 8 - Trigger Exception Interrupt Enable"]
390    #[inline(always)]
391    pub fn texc_ie(&mut self) -> TexcIeW<'_, IeSpec> {
392        TexcIeW::new(self, 8)
393    }
394    #[doc = "Bits 16:19 - Trigger Completion Interrupt Enable"]
395    #[inline(always)]
396    pub fn tcomp_ie(&mut self) -> TcompIeW<'_, IeSpec> {
397        TcompIeW::new(self, 16)
398    }
399}
400#[doc = "Interrupt Enable Register\n\nYou can [`read`](crate::Reg::read) this register and get [`ie::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ie::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
401pub struct IeSpec;
402impl crate::RegisterSpec for IeSpec {
403    type Ux = u32;
404}
405#[doc = "`read()` method returns [`ie::R`](R) reader structure"]
406impl crate::Readable for IeSpec {}
407#[doc = "`write(|w| ..)` method takes [`ie::W`](W) writer structure"]
408impl crate::Writable for IeSpec {
409    type Safety = crate::Unsafe;
410}
411#[doc = "`reset()` method sets IE to value 0"]
412impl crate::Resettable for IeSpec {}