mcxa_pac/cmp0/
ier.rs

1#[doc = "Register `IER` reader"]
2pub type R = crate::R<IerSpec>;
3#[doc = "Register `IER` writer"]
4pub type W = crate::W<IerSpec>;
5#[doc = "Comparator Flag Rising Interrupt Enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum CfrIe {
9    #[doc = "0: Disables the comparator flag rising interrupt."]
10    Disable = 0,
11    #[doc = "1: Enables the comparator flag rising interrupt when CFR is set."]
12    Enable = 1,
13}
14impl From<CfrIe> for bool {
15    #[inline(always)]
16    fn from(variant: CfrIe) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `CFR_IE` reader - Comparator Flag Rising Interrupt Enable"]
21pub type CfrIeR = crate::BitReader<CfrIe>;
22impl CfrIeR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> CfrIe {
26        match self.bits {
27            false => CfrIe::Disable,
28            true => CfrIe::Enable,
29        }
30    }
31    #[doc = "Disables the comparator flag rising interrupt."]
32    #[inline(always)]
33    pub fn is_disable(&self) -> bool {
34        *self == CfrIe::Disable
35    }
36    #[doc = "Enables the comparator flag rising interrupt when CFR is set."]
37    #[inline(always)]
38    pub fn is_enable(&self) -> bool {
39        *self == CfrIe::Enable
40    }
41}
42#[doc = "Field `CFR_IE` writer - Comparator Flag Rising Interrupt Enable"]
43pub type CfrIeW<'a, REG> = crate::BitWriter<'a, REG, CfrIe>;
44impl<'a, REG> CfrIeW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "Disables the comparator flag rising interrupt."]
49    #[inline(always)]
50    pub fn disable(self) -> &'a mut crate::W<REG> {
51        self.variant(CfrIe::Disable)
52    }
53    #[doc = "Enables the comparator flag rising interrupt when CFR is set."]
54    #[inline(always)]
55    pub fn enable(self) -> &'a mut crate::W<REG> {
56        self.variant(CfrIe::Enable)
57    }
58}
59#[doc = "Comparator Flag Falling Interrupt Enable\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum CffIe {
63    #[doc = "0: Disables the comparator flag falling interrupt."]
64    Disable = 0,
65    #[doc = "1: Enables the comparator flag falling interrupt when CFF is set."]
66    Enable = 1,
67}
68impl From<CffIe> for bool {
69    #[inline(always)]
70    fn from(variant: CffIe) -> Self {
71        variant as u8 != 0
72    }
73}
74#[doc = "Field `CFF_IE` reader - Comparator Flag Falling Interrupt Enable"]
75pub type CffIeR = crate::BitReader<CffIe>;
76impl CffIeR {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub const fn variant(&self) -> CffIe {
80        match self.bits {
81            false => CffIe::Disable,
82            true => CffIe::Enable,
83        }
84    }
85    #[doc = "Disables the comparator flag falling interrupt."]
86    #[inline(always)]
87    pub fn is_disable(&self) -> bool {
88        *self == CffIe::Disable
89    }
90    #[doc = "Enables the comparator flag falling interrupt when CFF is set."]
91    #[inline(always)]
92    pub fn is_enable(&self) -> bool {
93        *self == CffIe::Enable
94    }
95}
96#[doc = "Field `CFF_IE` writer - Comparator Flag Falling Interrupt Enable"]
97pub type CffIeW<'a, REG> = crate::BitWriter<'a, REG, CffIe>;
98impl<'a, REG> CffIeW<'a, REG>
99where
100    REG: crate::Writable + crate::RegisterSpec,
101{
102    #[doc = "Disables the comparator flag falling interrupt."]
103    #[inline(always)]
104    pub fn disable(self) -> &'a mut crate::W<REG> {
105        self.variant(CffIe::Disable)
106    }
107    #[doc = "Enables the comparator flag falling interrupt when CFF is set."]
108    #[inline(always)]
109    pub fn enable(self) -> &'a mut crate::W<REG> {
110        self.variant(CffIe::Enable)
111    }
112}
113#[doc = "Round-Robin Flag Interrupt Enable\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum RrfIe {
117    #[doc = "0: Disables the round-robin flag interrupt."]
118    Disable = 0,
119    #[doc = "1: Enables the round-robin flag interrupt when the comparison result changes for a given channel."]
120    Enable = 1,
121}
122impl From<RrfIe> for bool {
123    #[inline(always)]
124    fn from(variant: RrfIe) -> Self {
125        variant as u8 != 0
126    }
127}
128#[doc = "Field `RRF_IE` reader - Round-Robin Flag Interrupt Enable"]
129pub type RrfIeR = crate::BitReader<RrfIe>;
130impl RrfIeR {
131    #[doc = "Get enumerated values variant"]
132    #[inline(always)]
133    pub const fn variant(&self) -> RrfIe {
134        match self.bits {
135            false => RrfIe::Disable,
136            true => RrfIe::Enable,
137        }
138    }
139    #[doc = "Disables the round-robin flag interrupt."]
140    #[inline(always)]
141    pub fn is_disable(&self) -> bool {
142        *self == RrfIe::Disable
143    }
144    #[doc = "Enables the round-robin flag interrupt when the comparison result changes for a given channel."]
145    #[inline(always)]
146    pub fn is_enable(&self) -> bool {
147        *self == RrfIe::Enable
148    }
149}
150#[doc = "Field `RRF_IE` writer - Round-Robin Flag Interrupt Enable"]
151pub type RrfIeW<'a, REG> = crate::BitWriter<'a, REG, RrfIe>;
152impl<'a, REG> RrfIeW<'a, REG>
153where
154    REG: crate::Writable + crate::RegisterSpec,
155{
156    #[doc = "Disables the round-robin flag interrupt."]
157    #[inline(always)]
158    pub fn disable(self) -> &'a mut crate::W<REG> {
159        self.variant(RrfIe::Disable)
160    }
161    #[doc = "Enables the round-robin flag interrupt when the comparison result changes for a given channel."]
162    #[inline(always)]
163    pub fn enable(self) -> &'a mut crate::W<REG> {
164        self.variant(RrfIe::Enable)
165    }
166}
167impl R {
168    #[doc = "Bit 0 - Comparator Flag Rising Interrupt Enable"]
169    #[inline(always)]
170    pub fn cfr_ie(&self) -> CfrIeR {
171        CfrIeR::new((self.bits & 1) != 0)
172    }
173    #[doc = "Bit 1 - Comparator Flag Falling Interrupt Enable"]
174    #[inline(always)]
175    pub fn cff_ie(&self) -> CffIeR {
176        CffIeR::new(((self.bits >> 1) & 1) != 0)
177    }
178    #[doc = "Bit 2 - Round-Robin Flag Interrupt Enable"]
179    #[inline(always)]
180    pub fn rrf_ie(&self) -> RrfIeR {
181        RrfIeR::new(((self.bits >> 2) & 1) != 0)
182    }
183}
184#[cfg(feature = "debug")]
185impl core::fmt::Debug for R {
186    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
187        f.debug_struct("IER")
188            .field("cfr_ie", &self.cfr_ie())
189            .field("cff_ie", &self.cff_ie())
190            .field("rrf_ie", &self.rrf_ie())
191            .finish()
192    }
193}
194impl W {
195    #[doc = "Bit 0 - Comparator Flag Rising Interrupt Enable"]
196    #[inline(always)]
197    pub fn cfr_ie(&mut self) -> CfrIeW<'_, IerSpec> {
198        CfrIeW::new(self, 0)
199    }
200    #[doc = "Bit 1 - Comparator Flag Falling Interrupt Enable"]
201    #[inline(always)]
202    pub fn cff_ie(&mut self) -> CffIeW<'_, IerSpec> {
203        CffIeW::new(self, 1)
204    }
205    #[doc = "Bit 2 - Round-Robin Flag Interrupt Enable"]
206    #[inline(always)]
207    pub fn rrf_ie(&mut self) -> RrfIeW<'_, IerSpec> {
208        RrfIeW::new(self, 2)
209    }
210}
211#[doc = "Interrupt Enable\n\nYou can [`read`](crate::Reg::read) this register and get [`ier::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ier::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
212pub struct IerSpec;
213impl crate::RegisterSpec for IerSpec {
214    type Ux = u32;
215}
216#[doc = "`read()` method returns [`ier::R`](R) reader structure"]
217impl crate::Readable for IerSpec {}
218#[doc = "`write(|w| ..)` method takes [`ier::W`](W) writer structure"]
219impl crate::Writable for IerSpec {
220    type Safety = crate::Unsafe;
221}
222#[doc = "`reset()` method sets IER to value 0"]
223impl crate::Resettable for IerSpec {}