1#[doc = "Register `SM2INTEN` reader"]
2pub type R = crate::R<Sm2intenSpec>;
3#[doc = "Register `SM2INTEN` writer"]
4pub type W = crate::W<Sm2intenSpec>;
5#[doc = "Compare Interrupt Enables\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum Cmpie {
10 #[doc = "0: The corresponding STS\\[CMPF\\] bit will not cause an interrupt request."]
11 Disabled = 0,
12 #[doc = "1: The corresponding STS\\[CMPF\\] bit will cause an interrupt request."]
13 Enabled = 1,
14}
15impl From<Cmpie> for u8 {
16 #[inline(always)]
17 fn from(variant: Cmpie) -> Self {
18 variant as _
19 }
20}
21impl crate::FieldSpec for Cmpie {
22 type Ux = u8;
23}
24impl crate::IsEnum for Cmpie {}
25#[doc = "Field `CMPIE` reader - Compare Interrupt Enables"]
26pub type CmpieR = crate::FieldReader<Cmpie>;
27impl CmpieR {
28 #[doc = "Get enumerated values variant"]
29 #[inline(always)]
30 pub const fn variant(&self) -> Option<Cmpie> {
31 match self.bits {
32 0 => Some(Cmpie::Disabled),
33 1 => Some(Cmpie::Enabled),
34 _ => None,
35 }
36 }
37 #[doc = "The corresponding STS\\[CMPF\\] bit will not cause an interrupt request."]
38 #[inline(always)]
39 pub fn is_disabled(&self) -> bool {
40 *self == Cmpie::Disabled
41 }
42 #[doc = "The corresponding STS\\[CMPF\\] bit will cause an interrupt request."]
43 #[inline(always)]
44 pub fn is_enabled(&self) -> bool {
45 *self == Cmpie::Enabled
46 }
47}
48#[doc = "Field `CMPIE` writer - Compare Interrupt Enables"]
49pub type CmpieW<'a, REG> = crate::FieldWriter<'a, REG, 6, Cmpie>;
50impl<'a, REG> CmpieW<'a, REG>
51where
52 REG: crate::Writable + crate::RegisterSpec,
53 REG::Ux: From<u8>,
54{
55 #[doc = "The corresponding STS\\[CMPF\\] bit will not cause an interrupt request."]
56 #[inline(always)]
57 pub fn disabled(self) -> &'a mut crate::W<REG> {
58 self.variant(Cmpie::Disabled)
59 }
60 #[doc = "The corresponding STS\\[CMPF\\] bit will cause an interrupt request."]
61 #[inline(always)]
62 pub fn enabled(self) -> &'a mut crate::W<REG> {
63 self.variant(Cmpie::Enabled)
64 }
65}
66#[doc = "Capture X 0 Interrupt Enable\n\nValue on reset: 0"]
67#[cfg_attr(feature = "defmt", derive(defmt::Format))]
68#[derive(Clone, Copy, Debug, PartialEq, Eq)]
69pub enum Cx0ie {
70 #[doc = "0: Interrupt request disabled for STS\\[CFX0\\]."]
71 Disabled = 0,
72 #[doc = "1: Interrupt request enabled for STS\\[CFX0\\]."]
73 Enabled = 1,
74}
75impl From<Cx0ie> for bool {
76 #[inline(always)]
77 fn from(variant: Cx0ie) -> Self {
78 variant as u8 != 0
79 }
80}
81#[doc = "Field `CX0IE` reader - Capture X 0 Interrupt Enable"]
82pub type Cx0ieR = crate::BitReader<Cx0ie>;
83impl Cx0ieR {
84 #[doc = "Get enumerated values variant"]
85 #[inline(always)]
86 pub const fn variant(&self) -> Cx0ie {
87 match self.bits {
88 false => Cx0ie::Disabled,
89 true => Cx0ie::Enabled,
90 }
91 }
92 #[doc = "Interrupt request disabled for STS\\[CFX0\\]."]
93 #[inline(always)]
94 pub fn is_disabled(&self) -> bool {
95 *self == Cx0ie::Disabled
96 }
97 #[doc = "Interrupt request enabled for STS\\[CFX0\\]."]
98 #[inline(always)]
99 pub fn is_enabled(&self) -> bool {
100 *self == Cx0ie::Enabled
101 }
102}
103#[doc = "Field `CX0IE` writer - Capture X 0 Interrupt Enable"]
104pub type Cx0ieW<'a, REG> = crate::BitWriter<'a, REG, Cx0ie>;
105impl<'a, REG> Cx0ieW<'a, REG>
106where
107 REG: crate::Writable + crate::RegisterSpec,
108{
109 #[doc = "Interrupt request disabled for STS\\[CFX0\\]."]
110 #[inline(always)]
111 pub fn disabled(self) -> &'a mut crate::W<REG> {
112 self.variant(Cx0ie::Disabled)
113 }
114 #[doc = "Interrupt request enabled for STS\\[CFX0\\]."]
115 #[inline(always)]
116 pub fn enabled(self) -> &'a mut crate::W<REG> {
117 self.variant(Cx0ie::Enabled)
118 }
119}
120#[doc = "Capture X 1 Interrupt Enable\n\nValue on reset: 0"]
121#[cfg_attr(feature = "defmt", derive(defmt::Format))]
122#[derive(Clone, Copy, Debug, PartialEq, Eq)]
123pub enum Cx1ie {
124 #[doc = "0: Interrupt request disabled for STS\\[CFX1\\]."]
125 Disabled = 0,
126 #[doc = "1: Interrupt request enabled for STS\\[CFX1\\]."]
127 Enabled = 1,
128}
129impl From<Cx1ie> for bool {
130 #[inline(always)]
131 fn from(variant: Cx1ie) -> Self {
132 variant as u8 != 0
133 }
134}
135#[doc = "Field `CX1IE` reader - Capture X 1 Interrupt Enable"]
136pub type Cx1ieR = crate::BitReader<Cx1ie>;
137impl Cx1ieR {
138 #[doc = "Get enumerated values variant"]
139 #[inline(always)]
140 pub const fn variant(&self) -> Cx1ie {
141 match self.bits {
142 false => Cx1ie::Disabled,
143 true => Cx1ie::Enabled,
144 }
145 }
146 #[doc = "Interrupt request disabled for STS\\[CFX1\\]."]
147 #[inline(always)]
148 pub fn is_disabled(&self) -> bool {
149 *self == Cx1ie::Disabled
150 }
151 #[doc = "Interrupt request enabled for STS\\[CFX1\\]."]
152 #[inline(always)]
153 pub fn is_enabled(&self) -> bool {
154 *self == Cx1ie::Enabled
155 }
156}
157#[doc = "Field `CX1IE` writer - Capture X 1 Interrupt Enable"]
158pub type Cx1ieW<'a, REG> = crate::BitWriter<'a, REG, Cx1ie>;
159impl<'a, REG> Cx1ieW<'a, REG>
160where
161 REG: crate::Writable + crate::RegisterSpec,
162{
163 #[doc = "Interrupt request disabled for STS\\[CFX1\\]."]
164 #[inline(always)]
165 pub fn disabled(self) -> &'a mut crate::W<REG> {
166 self.variant(Cx1ie::Disabled)
167 }
168 #[doc = "Interrupt request enabled for STS\\[CFX1\\]."]
169 #[inline(always)]
170 pub fn enabled(self) -> &'a mut crate::W<REG> {
171 self.variant(Cx1ie::Enabled)
172 }
173}
174#[doc = "Reload Interrupt Enable\n\nValue on reset: 0"]
175#[cfg_attr(feature = "defmt", derive(defmt::Format))]
176#[derive(Clone, Copy, Debug, PartialEq, Eq)]
177pub enum Rie {
178 #[doc = "0: STS\\[RF\\] CPU interrupt requests disabled"]
179 Disabled = 0,
180 #[doc = "1: STS\\[RF\\] CPU interrupt requests enabled"]
181 Enabled = 1,
182}
183impl From<Rie> for bool {
184 #[inline(always)]
185 fn from(variant: Rie) -> Self {
186 variant as u8 != 0
187 }
188}
189#[doc = "Field `RIE` reader - Reload Interrupt Enable"]
190pub type RieR = crate::BitReader<Rie>;
191impl RieR {
192 #[doc = "Get enumerated values variant"]
193 #[inline(always)]
194 pub const fn variant(&self) -> Rie {
195 match self.bits {
196 false => Rie::Disabled,
197 true => Rie::Enabled,
198 }
199 }
200 #[doc = "STS\\[RF\\] CPU interrupt requests disabled"]
201 #[inline(always)]
202 pub fn is_disabled(&self) -> bool {
203 *self == Rie::Disabled
204 }
205 #[doc = "STS\\[RF\\] CPU interrupt requests enabled"]
206 #[inline(always)]
207 pub fn is_enabled(&self) -> bool {
208 *self == Rie::Enabled
209 }
210}
211#[doc = "Field `RIE` writer - Reload Interrupt Enable"]
212pub type RieW<'a, REG> = crate::BitWriter<'a, REG, Rie>;
213impl<'a, REG> RieW<'a, REG>
214where
215 REG: crate::Writable + crate::RegisterSpec,
216{
217 #[doc = "STS\\[RF\\] CPU interrupt requests disabled"]
218 #[inline(always)]
219 pub fn disabled(self) -> &'a mut crate::W<REG> {
220 self.variant(Rie::Disabled)
221 }
222 #[doc = "STS\\[RF\\] CPU interrupt requests enabled"]
223 #[inline(always)]
224 pub fn enabled(self) -> &'a mut crate::W<REG> {
225 self.variant(Rie::Enabled)
226 }
227}
228#[doc = "Reload Error Interrupt Enable\n\nValue on reset: 0"]
229#[cfg_attr(feature = "defmt", derive(defmt::Format))]
230#[derive(Clone, Copy, Debug, PartialEq, Eq)]
231pub enum Reie {
232 #[doc = "0: STS\\[REF\\] CPU interrupt requests disabled"]
233 Disabled = 0,
234 #[doc = "1: STS\\[REF\\] CPU interrupt requests enabled"]
235 Enabled = 1,
236}
237impl From<Reie> for bool {
238 #[inline(always)]
239 fn from(variant: Reie) -> Self {
240 variant as u8 != 0
241 }
242}
243#[doc = "Field `REIE` reader - Reload Error Interrupt Enable"]
244pub type ReieR = crate::BitReader<Reie>;
245impl ReieR {
246 #[doc = "Get enumerated values variant"]
247 #[inline(always)]
248 pub const fn variant(&self) -> Reie {
249 match self.bits {
250 false => Reie::Disabled,
251 true => Reie::Enabled,
252 }
253 }
254 #[doc = "STS\\[REF\\] CPU interrupt requests disabled"]
255 #[inline(always)]
256 pub fn is_disabled(&self) -> bool {
257 *self == Reie::Disabled
258 }
259 #[doc = "STS\\[REF\\] CPU interrupt requests enabled"]
260 #[inline(always)]
261 pub fn is_enabled(&self) -> bool {
262 *self == Reie::Enabled
263 }
264}
265#[doc = "Field `REIE` writer - Reload Error Interrupt Enable"]
266pub type ReieW<'a, REG> = crate::BitWriter<'a, REG, Reie>;
267impl<'a, REG> ReieW<'a, REG>
268where
269 REG: crate::Writable + crate::RegisterSpec,
270{
271 #[doc = "STS\\[REF\\] CPU interrupt requests disabled"]
272 #[inline(always)]
273 pub fn disabled(self) -> &'a mut crate::W<REG> {
274 self.variant(Reie::Disabled)
275 }
276 #[doc = "STS\\[REF\\] CPU interrupt requests enabled"]
277 #[inline(always)]
278 pub fn enabled(self) -> &'a mut crate::W<REG> {
279 self.variant(Reie::Enabled)
280 }
281}
282impl R {
283 #[doc = "Bits 0:5 - Compare Interrupt Enables"]
284 #[inline(always)]
285 pub fn cmpie(&self) -> CmpieR {
286 CmpieR::new((self.bits & 0x3f) as u8)
287 }
288 #[doc = "Bit 6 - Capture X 0 Interrupt Enable"]
289 #[inline(always)]
290 pub fn cx0ie(&self) -> Cx0ieR {
291 Cx0ieR::new(((self.bits >> 6) & 1) != 0)
292 }
293 #[doc = "Bit 7 - Capture X 1 Interrupt Enable"]
294 #[inline(always)]
295 pub fn cx1ie(&self) -> Cx1ieR {
296 Cx1ieR::new(((self.bits >> 7) & 1) != 0)
297 }
298 #[doc = "Bit 12 - Reload Interrupt Enable"]
299 #[inline(always)]
300 pub fn rie(&self) -> RieR {
301 RieR::new(((self.bits >> 12) & 1) != 0)
302 }
303 #[doc = "Bit 13 - Reload Error Interrupt Enable"]
304 #[inline(always)]
305 pub fn reie(&self) -> ReieR {
306 ReieR::new(((self.bits >> 13) & 1) != 0)
307 }
308}
309#[cfg(feature = "debug")]
310impl core::fmt::Debug for R {
311 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
312 f.debug_struct("SM2INTEN")
313 .field("cmpie", &self.cmpie())
314 .field("cx0ie", &self.cx0ie())
315 .field("cx1ie", &self.cx1ie())
316 .field("rie", &self.rie())
317 .field("reie", &self.reie())
318 .finish()
319 }
320}
321impl W {
322 #[doc = "Bits 0:5 - Compare Interrupt Enables"]
323 #[inline(always)]
324 pub fn cmpie(&mut self) -> CmpieW<'_, Sm2intenSpec> {
325 CmpieW::new(self, 0)
326 }
327 #[doc = "Bit 6 - Capture X 0 Interrupt Enable"]
328 #[inline(always)]
329 pub fn cx0ie(&mut self) -> Cx0ieW<'_, Sm2intenSpec> {
330 Cx0ieW::new(self, 6)
331 }
332 #[doc = "Bit 7 - Capture X 1 Interrupt Enable"]
333 #[inline(always)]
334 pub fn cx1ie(&mut self) -> Cx1ieW<'_, Sm2intenSpec> {
335 Cx1ieW::new(self, 7)
336 }
337 #[doc = "Bit 12 - Reload Interrupt Enable"]
338 #[inline(always)]
339 pub fn rie(&mut self) -> RieW<'_, Sm2intenSpec> {
340 RieW::new(self, 12)
341 }
342 #[doc = "Bit 13 - Reload Error Interrupt Enable"]
343 #[inline(always)]
344 pub fn reie(&mut self) -> ReieW<'_, Sm2intenSpec> {
345 ReieW::new(self, 13)
346 }
347}
348#[doc = "Interrupt Enable Register\n\nYou can [`read`](crate::Reg::read) this register and get [`sm2inten::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sm2inten::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
349pub struct Sm2intenSpec;
350impl crate::RegisterSpec for Sm2intenSpec {
351 type Ux = u16;
352}
353#[doc = "`read()` method returns [`sm2inten::R`](R) reader structure"]
354impl crate::Readable for Sm2intenSpec {}
355#[doc = "`write(|w| ..)` method takes [`sm2inten::W`](W) writer structure"]
356impl crate::Writable for Sm2intenSpec {
357 type Safety = crate::Unsafe;
358}
359#[doc = "`reset()` method sets SM2INTEN to value 0"]
360impl crate::Resettable for Sm2intenSpec {}