mcxa_pac/usb0/
inten.rs

1#[doc = "Register `INTEN` reader"]
2pub type R = crate::R<IntenSpec>;
3#[doc = "Register `INTEN` writer"]
4pub type W = crate::W<IntenSpec>;
5#[doc = "USBRST Interrupt Enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Usbrsten {
9    #[doc = "0: Disable"]
10    DisUsbrstInt = 0,
11    #[doc = "1: Enable"]
12    EnUsbrstInt = 1,
13}
14impl From<Usbrsten> for bool {
15    #[inline(always)]
16    fn from(variant: Usbrsten) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `USBRSTEN` reader - USBRST Interrupt Enable"]
21pub type UsbrstenR = crate::BitReader<Usbrsten>;
22impl UsbrstenR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Usbrsten {
26        match self.bits {
27            false => Usbrsten::DisUsbrstInt,
28            true => Usbrsten::EnUsbrstInt,
29        }
30    }
31    #[doc = "Disable"]
32    #[inline(always)]
33    pub fn is_dis_usbrst_int(&self) -> bool {
34        *self == Usbrsten::DisUsbrstInt
35    }
36    #[doc = "Enable"]
37    #[inline(always)]
38    pub fn is_en_usbrst_int(&self) -> bool {
39        *self == Usbrsten::EnUsbrstInt
40    }
41}
42#[doc = "Field `USBRSTEN` writer - USBRST Interrupt Enable"]
43pub type UsbrstenW<'a, REG> = crate::BitWriter<'a, REG, Usbrsten>;
44impl<'a, REG> UsbrstenW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "Disable"]
49    #[inline(always)]
50    pub fn dis_usbrst_int(self) -> &'a mut crate::W<REG> {
51        self.variant(Usbrsten::DisUsbrstInt)
52    }
53    #[doc = "Enable"]
54    #[inline(always)]
55    pub fn en_usbrst_int(self) -> &'a mut crate::W<REG> {
56        self.variant(Usbrsten::EnUsbrstInt)
57    }
58}
59#[doc = "ERROR Interrupt Enable\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Erroren {
63    #[doc = "0: Disable"]
64    DisErrorInt = 0,
65    #[doc = "1: Enable"]
66    EnErrorInt = 1,
67}
68impl From<Erroren> for bool {
69    #[inline(always)]
70    fn from(variant: Erroren) -> Self {
71        variant as u8 != 0
72    }
73}
74#[doc = "Field `ERROREN` reader - ERROR Interrupt Enable"]
75pub type ErrorenR = crate::BitReader<Erroren>;
76impl ErrorenR {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub const fn variant(&self) -> Erroren {
80        match self.bits {
81            false => Erroren::DisErrorInt,
82            true => Erroren::EnErrorInt,
83        }
84    }
85    #[doc = "Disable"]
86    #[inline(always)]
87    pub fn is_dis_error_int(&self) -> bool {
88        *self == Erroren::DisErrorInt
89    }
90    #[doc = "Enable"]
91    #[inline(always)]
92    pub fn is_en_error_int(&self) -> bool {
93        *self == Erroren::EnErrorInt
94    }
95}
96#[doc = "Field `ERROREN` writer - ERROR Interrupt Enable"]
97pub type ErrorenW<'a, REG> = crate::BitWriter<'a, REG, Erroren>;
98impl<'a, REG> ErrorenW<'a, REG>
99where
100    REG: crate::Writable + crate::RegisterSpec,
101{
102    #[doc = "Disable"]
103    #[inline(always)]
104    pub fn dis_error_int(self) -> &'a mut crate::W<REG> {
105        self.variant(Erroren::DisErrorInt)
106    }
107    #[doc = "Enable"]
108    #[inline(always)]
109    pub fn en_error_int(self) -> &'a mut crate::W<REG> {
110        self.variant(Erroren::EnErrorInt)
111    }
112}
113#[doc = "SOFTOK Interrupt Enable\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum Softoken {
117    #[doc = "0: Disable"]
118    DisSoftokInt = 0,
119    #[doc = "1: Enable"]
120    EnSoftokInt = 1,
121}
122impl From<Softoken> for bool {
123    #[inline(always)]
124    fn from(variant: Softoken) -> Self {
125        variant as u8 != 0
126    }
127}
128#[doc = "Field `SOFTOKEN` reader - SOFTOK Interrupt Enable"]
129pub type SoftokenR = crate::BitReader<Softoken>;
130impl SoftokenR {
131    #[doc = "Get enumerated values variant"]
132    #[inline(always)]
133    pub const fn variant(&self) -> Softoken {
134        match self.bits {
135            false => Softoken::DisSoftokInt,
136            true => Softoken::EnSoftokInt,
137        }
138    }
139    #[doc = "Disable"]
140    #[inline(always)]
141    pub fn is_dis_softok_int(&self) -> bool {
142        *self == Softoken::DisSoftokInt
143    }
144    #[doc = "Enable"]
145    #[inline(always)]
146    pub fn is_en_softok_int(&self) -> bool {
147        *self == Softoken::EnSoftokInt
148    }
149}
150#[doc = "Field `SOFTOKEN` writer - SOFTOK Interrupt Enable"]
151pub type SoftokenW<'a, REG> = crate::BitWriter<'a, REG, Softoken>;
152impl<'a, REG> SoftokenW<'a, REG>
153where
154    REG: crate::Writable + crate::RegisterSpec,
155{
156    #[doc = "Disable"]
157    #[inline(always)]
158    pub fn dis_softok_int(self) -> &'a mut crate::W<REG> {
159        self.variant(Softoken::DisSoftokInt)
160    }
161    #[doc = "Enable"]
162    #[inline(always)]
163    pub fn en_softok_int(self) -> &'a mut crate::W<REG> {
164        self.variant(Softoken::EnSoftokInt)
165    }
166}
167#[doc = "TOKDNE Interrupt Enable\n\nValue on reset: 0"]
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum Tokdneen {
171    #[doc = "0: Disable"]
172    DisTokdneInt = 0,
173    #[doc = "1: Enable"]
174    EnTokdneInt = 1,
175}
176impl From<Tokdneen> for bool {
177    #[inline(always)]
178    fn from(variant: Tokdneen) -> Self {
179        variant as u8 != 0
180    }
181}
182#[doc = "Field `TOKDNEEN` reader - TOKDNE Interrupt Enable"]
183pub type TokdneenR = crate::BitReader<Tokdneen>;
184impl TokdneenR {
185    #[doc = "Get enumerated values variant"]
186    #[inline(always)]
187    pub const fn variant(&self) -> Tokdneen {
188        match self.bits {
189            false => Tokdneen::DisTokdneInt,
190            true => Tokdneen::EnTokdneInt,
191        }
192    }
193    #[doc = "Disable"]
194    #[inline(always)]
195    pub fn is_dis_tokdne_int(&self) -> bool {
196        *self == Tokdneen::DisTokdneInt
197    }
198    #[doc = "Enable"]
199    #[inline(always)]
200    pub fn is_en_tokdne_int(&self) -> bool {
201        *self == Tokdneen::EnTokdneInt
202    }
203}
204#[doc = "Field `TOKDNEEN` writer - TOKDNE Interrupt Enable"]
205pub type TokdneenW<'a, REG> = crate::BitWriter<'a, REG, Tokdneen>;
206impl<'a, REG> TokdneenW<'a, REG>
207where
208    REG: crate::Writable + crate::RegisterSpec,
209{
210    #[doc = "Disable"]
211    #[inline(always)]
212    pub fn dis_tokdne_int(self) -> &'a mut crate::W<REG> {
213        self.variant(Tokdneen::DisTokdneInt)
214    }
215    #[doc = "Enable"]
216    #[inline(always)]
217    pub fn en_tokdne_int(self) -> &'a mut crate::W<REG> {
218        self.variant(Tokdneen::EnTokdneInt)
219    }
220}
221#[doc = "SLEEP Interrupt Enable\n\nValue on reset: 0"]
222#[cfg_attr(feature = "defmt", derive(defmt::Format))]
223#[derive(Clone, Copy, Debug, PartialEq, Eq)]
224pub enum Sleepen {
225    #[doc = "0: Disable"]
226    DisSleepInt = 0,
227    #[doc = "1: Enable"]
228    EnSleepInt = 1,
229}
230impl From<Sleepen> for bool {
231    #[inline(always)]
232    fn from(variant: Sleepen) -> Self {
233        variant as u8 != 0
234    }
235}
236#[doc = "Field `SLEEPEN` reader - SLEEP Interrupt Enable"]
237pub type SleepenR = crate::BitReader<Sleepen>;
238impl SleepenR {
239    #[doc = "Get enumerated values variant"]
240    #[inline(always)]
241    pub const fn variant(&self) -> Sleepen {
242        match self.bits {
243            false => Sleepen::DisSleepInt,
244            true => Sleepen::EnSleepInt,
245        }
246    }
247    #[doc = "Disable"]
248    #[inline(always)]
249    pub fn is_dis_sleep_int(&self) -> bool {
250        *self == Sleepen::DisSleepInt
251    }
252    #[doc = "Enable"]
253    #[inline(always)]
254    pub fn is_en_sleep_int(&self) -> bool {
255        *self == Sleepen::EnSleepInt
256    }
257}
258#[doc = "Field `SLEEPEN` writer - SLEEP Interrupt Enable"]
259pub type SleepenW<'a, REG> = crate::BitWriter<'a, REG, Sleepen>;
260impl<'a, REG> SleepenW<'a, REG>
261where
262    REG: crate::Writable + crate::RegisterSpec,
263{
264    #[doc = "Disable"]
265    #[inline(always)]
266    pub fn dis_sleep_int(self) -> &'a mut crate::W<REG> {
267        self.variant(Sleepen::DisSleepInt)
268    }
269    #[doc = "Enable"]
270    #[inline(always)]
271    pub fn en_sleep_int(self) -> &'a mut crate::W<REG> {
272        self.variant(Sleepen::EnSleepInt)
273    }
274}
275#[doc = "RESUME Interrupt Enable\n\nValue on reset: 0"]
276#[cfg_attr(feature = "defmt", derive(defmt::Format))]
277#[derive(Clone, Copy, Debug, PartialEq, Eq)]
278pub enum Resumeen {
279    #[doc = "0: Disable"]
280    DisResumeInt = 0,
281    #[doc = "1: Enable"]
282    EnResumeInt = 1,
283}
284impl From<Resumeen> for bool {
285    #[inline(always)]
286    fn from(variant: Resumeen) -> Self {
287        variant as u8 != 0
288    }
289}
290#[doc = "Field `RESUMEEN` reader - RESUME Interrupt Enable"]
291pub type ResumeenR = crate::BitReader<Resumeen>;
292impl ResumeenR {
293    #[doc = "Get enumerated values variant"]
294    #[inline(always)]
295    pub const fn variant(&self) -> Resumeen {
296        match self.bits {
297            false => Resumeen::DisResumeInt,
298            true => Resumeen::EnResumeInt,
299        }
300    }
301    #[doc = "Disable"]
302    #[inline(always)]
303    pub fn is_dis_resume_int(&self) -> bool {
304        *self == Resumeen::DisResumeInt
305    }
306    #[doc = "Enable"]
307    #[inline(always)]
308    pub fn is_en_resume_int(&self) -> bool {
309        *self == Resumeen::EnResumeInt
310    }
311}
312#[doc = "Field `RESUMEEN` writer - RESUME Interrupt Enable"]
313pub type ResumeenW<'a, REG> = crate::BitWriter<'a, REG, Resumeen>;
314impl<'a, REG> ResumeenW<'a, REG>
315where
316    REG: crate::Writable + crate::RegisterSpec,
317{
318    #[doc = "Disable"]
319    #[inline(always)]
320    pub fn dis_resume_int(self) -> &'a mut crate::W<REG> {
321        self.variant(Resumeen::DisResumeInt)
322    }
323    #[doc = "Enable"]
324    #[inline(always)]
325    pub fn en_resume_int(self) -> &'a mut crate::W<REG> {
326        self.variant(Resumeen::EnResumeInt)
327    }
328}
329#[doc = "ATTACH Interrupt Enable\n\nValue on reset: 0"]
330#[cfg_attr(feature = "defmt", derive(defmt::Format))]
331#[derive(Clone, Copy, Debug, PartialEq, Eq)]
332pub enum Attachen {
333    #[doc = "0: Disable"]
334    DisAttachInt = 0,
335    #[doc = "1: Enable"]
336    EnAttachInt = 1,
337}
338impl From<Attachen> for bool {
339    #[inline(always)]
340    fn from(variant: Attachen) -> Self {
341        variant as u8 != 0
342    }
343}
344#[doc = "Field `ATTACHEN` reader - ATTACH Interrupt Enable"]
345pub type AttachenR = crate::BitReader<Attachen>;
346impl AttachenR {
347    #[doc = "Get enumerated values variant"]
348    #[inline(always)]
349    pub const fn variant(&self) -> Attachen {
350        match self.bits {
351            false => Attachen::DisAttachInt,
352            true => Attachen::EnAttachInt,
353        }
354    }
355    #[doc = "Disable"]
356    #[inline(always)]
357    pub fn is_dis_attach_int(&self) -> bool {
358        *self == Attachen::DisAttachInt
359    }
360    #[doc = "Enable"]
361    #[inline(always)]
362    pub fn is_en_attach_int(&self) -> bool {
363        *self == Attachen::EnAttachInt
364    }
365}
366#[doc = "Field `ATTACHEN` writer - ATTACH Interrupt Enable"]
367pub type AttachenW<'a, REG> = crate::BitWriter<'a, REG, Attachen>;
368impl<'a, REG> AttachenW<'a, REG>
369where
370    REG: crate::Writable + crate::RegisterSpec,
371{
372    #[doc = "Disable"]
373    #[inline(always)]
374    pub fn dis_attach_int(self) -> &'a mut crate::W<REG> {
375        self.variant(Attachen::DisAttachInt)
376    }
377    #[doc = "Enable"]
378    #[inline(always)]
379    pub fn en_attach_int(self) -> &'a mut crate::W<REG> {
380        self.variant(Attachen::EnAttachInt)
381    }
382}
383#[doc = "STALL Interrupt Enable\n\nValue on reset: 0"]
384#[cfg_attr(feature = "defmt", derive(defmt::Format))]
385#[derive(Clone, Copy, Debug, PartialEq, Eq)]
386pub enum Stallen {
387    #[doc = "0: Disable"]
388    DisStallInt = 0,
389    #[doc = "1: Enable"]
390    EnStallInt = 1,
391}
392impl From<Stallen> for bool {
393    #[inline(always)]
394    fn from(variant: Stallen) -> Self {
395        variant as u8 != 0
396    }
397}
398#[doc = "Field `STALLEN` reader - STALL Interrupt Enable"]
399pub type StallenR = crate::BitReader<Stallen>;
400impl StallenR {
401    #[doc = "Get enumerated values variant"]
402    #[inline(always)]
403    pub const fn variant(&self) -> Stallen {
404        match self.bits {
405            false => Stallen::DisStallInt,
406            true => Stallen::EnStallInt,
407        }
408    }
409    #[doc = "Disable"]
410    #[inline(always)]
411    pub fn is_dis_stall_int(&self) -> bool {
412        *self == Stallen::DisStallInt
413    }
414    #[doc = "Enable"]
415    #[inline(always)]
416    pub fn is_en_stall_int(&self) -> bool {
417        *self == Stallen::EnStallInt
418    }
419}
420#[doc = "Field `STALLEN` writer - STALL Interrupt Enable"]
421pub type StallenW<'a, REG> = crate::BitWriter<'a, REG, Stallen>;
422impl<'a, REG> StallenW<'a, REG>
423where
424    REG: crate::Writable + crate::RegisterSpec,
425{
426    #[doc = "Disable"]
427    #[inline(always)]
428    pub fn dis_stall_int(self) -> &'a mut crate::W<REG> {
429        self.variant(Stallen::DisStallInt)
430    }
431    #[doc = "Enable"]
432    #[inline(always)]
433    pub fn en_stall_int(self) -> &'a mut crate::W<REG> {
434        self.variant(Stallen::EnStallInt)
435    }
436}
437impl R {
438    #[doc = "Bit 0 - USBRST Interrupt Enable"]
439    #[inline(always)]
440    pub fn usbrsten(&self) -> UsbrstenR {
441        UsbrstenR::new((self.bits & 1) != 0)
442    }
443    #[doc = "Bit 1 - ERROR Interrupt Enable"]
444    #[inline(always)]
445    pub fn erroren(&self) -> ErrorenR {
446        ErrorenR::new(((self.bits >> 1) & 1) != 0)
447    }
448    #[doc = "Bit 2 - SOFTOK Interrupt Enable"]
449    #[inline(always)]
450    pub fn softoken(&self) -> SoftokenR {
451        SoftokenR::new(((self.bits >> 2) & 1) != 0)
452    }
453    #[doc = "Bit 3 - TOKDNE Interrupt Enable"]
454    #[inline(always)]
455    pub fn tokdneen(&self) -> TokdneenR {
456        TokdneenR::new(((self.bits >> 3) & 1) != 0)
457    }
458    #[doc = "Bit 4 - SLEEP Interrupt Enable"]
459    #[inline(always)]
460    pub fn sleepen(&self) -> SleepenR {
461        SleepenR::new(((self.bits >> 4) & 1) != 0)
462    }
463    #[doc = "Bit 5 - RESUME Interrupt Enable"]
464    #[inline(always)]
465    pub fn resumeen(&self) -> ResumeenR {
466        ResumeenR::new(((self.bits >> 5) & 1) != 0)
467    }
468    #[doc = "Bit 6 - ATTACH Interrupt Enable"]
469    #[inline(always)]
470    pub fn attachen(&self) -> AttachenR {
471        AttachenR::new(((self.bits >> 6) & 1) != 0)
472    }
473    #[doc = "Bit 7 - STALL Interrupt Enable"]
474    #[inline(always)]
475    pub fn stallen(&self) -> StallenR {
476        StallenR::new(((self.bits >> 7) & 1) != 0)
477    }
478}
479#[cfg(feature = "debug")]
480impl core::fmt::Debug for R {
481    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
482        f.debug_struct("INTEN")
483            .field("usbrsten", &self.usbrsten())
484            .field("erroren", &self.erroren())
485            .field("softoken", &self.softoken())
486            .field("tokdneen", &self.tokdneen())
487            .field("sleepen", &self.sleepen())
488            .field("resumeen", &self.resumeen())
489            .field("attachen", &self.attachen())
490            .field("stallen", &self.stallen())
491            .finish()
492    }
493}
494impl W {
495    #[doc = "Bit 0 - USBRST Interrupt Enable"]
496    #[inline(always)]
497    pub fn usbrsten(&mut self) -> UsbrstenW<'_, IntenSpec> {
498        UsbrstenW::new(self, 0)
499    }
500    #[doc = "Bit 1 - ERROR Interrupt Enable"]
501    #[inline(always)]
502    pub fn erroren(&mut self) -> ErrorenW<'_, IntenSpec> {
503        ErrorenW::new(self, 1)
504    }
505    #[doc = "Bit 2 - SOFTOK Interrupt Enable"]
506    #[inline(always)]
507    pub fn softoken(&mut self) -> SoftokenW<'_, IntenSpec> {
508        SoftokenW::new(self, 2)
509    }
510    #[doc = "Bit 3 - TOKDNE Interrupt Enable"]
511    #[inline(always)]
512    pub fn tokdneen(&mut self) -> TokdneenW<'_, IntenSpec> {
513        TokdneenW::new(self, 3)
514    }
515    #[doc = "Bit 4 - SLEEP Interrupt Enable"]
516    #[inline(always)]
517    pub fn sleepen(&mut self) -> SleepenW<'_, IntenSpec> {
518        SleepenW::new(self, 4)
519    }
520    #[doc = "Bit 5 - RESUME Interrupt Enable"]
521    #[inline(always)]
522    pub fn resumeen(&mut self) -> ResumeenW<'_, IntenSpec> {
523        ResumeenW::new(self, 5)
524    }
525    #[doc = "Bit 6 - ATTACH Interrupt Enable"]
526    #[inline(always)]
527    pub fn attachen(&mut self) -> AttachenW<'_, IntenSpec> {
528        AttachenW::new(self, 6)
529    }
530    #[doc = "Bit 7 - STALL Interrupt Enable"]
531    #[inline(always)]
532    pub fn stallen(&mut self) -> StallenW<'_, IntenSpec> {
533        StallenW::new(self, 7)
534    }
535}
536#[doc = "Interrupt Enable\n\nYou can [`read`](crate::Reg::read) this register and get [`inten::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`inten::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
537pub struct IntenSpec;
538impl crate::RegisterSpec for IntenSpec {
539    type Ux = u8;
540}
541#[doc = "`read()` method returns [`inten::R`](R) reader structure"]
542impl crate::Readable for IntenSpec {}
543#[doc = "`write(|w| ..)` method takes [`inten::W`](W) writer structure"]
544impl crate::Writable for IntenSpec {
545    type Safety = crate::Unsafe;
546}
547#[doc = "`reset()` method sets INTEN to value 0"]
548impl crate::Resettable for IntenSpec {}