mcxa_pac/usb0/
erren.rs

1#[doc = "Register `ERREN` reader"]
2pub type R = crate::R<ErrenSpec>;
3#[doc = "Register `ERREN` writer"]
4pub type W = crate::W<ErrenSpec>;
5#[doc = "PIDERR Interrupt Enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Piderren {
9    #[doc = "0: Disable"]
10    DisPiderrInt = 0,
11    #[doc = "1: Enable"]
12    EnPiderrInt = 1,
13}
14impl From<Piderren> for bool {
15    #[inline(always)]
16    fn from(variant: Piderren) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `PIDERREN` reader - PIDERR Interrupt Enable"]
21pub type PiderrenR = crate::BitReader<Piderren>;
22impl PiderrenR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Piderren {
26        match self.bits {
27            false => Piderren::DisPiderrInt,
28            true => Piderren::EnPiderrInt,
29        }
30    }
31    #[doc = "Disable"]
32    #[inline(always)]
33    pub fn is_dis_piderr_int(&self) -> bool {
34        *self == Piderren::DisPiderrInt
35    }
36    #[doc = "Enable"]
37    #[inline(always)]
38    pub fn is_en_piderr_int(&self) -> bool {
39        *self == Piderren::EnPiderrInt
40    }
41}
42#[doc = "Field `PIDERREN` writer - PIDERR Interrupt Enable"]
43pub type PiderrenW<'a, REG> = crate::BitWriter<'a, REG, Piderren>;
44impl<'a, REG> PiderrenW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "Disable"]
49    #[inline(always)]
50    pub fn dis_piderr_int(self) -> &'a mut crate::W<REG> {
51        self.variant(Piderren::DisPiderrInt)
52    }
53    #[doc = "Enable"]
54    #[inline(always)]
55    pub fn en_piderr_int(self) -> &'a mut crate::W<REG> {
56        self.variant(Piderren::EnPiderrInt)
57    }
58}
59#[doc = "CRC5/EOF Interrupt Enable\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Crc5eofen {
63    #[doc = "0: Disable"]
64    DisCrc5Int = 0,
65    #[doc = "1: Enable"]
66    EnCrc5Int = 1,
67}
68impl From<Crc5eofen> for bool {
69    #[inline(always)]
70    fn from(variant: Crc5eofen) -> Self {
71        variant as u8 != 0
72    }
73}
74#[doc = "Field `CRC5EOFEN` reader - CRC5/EOF Interrupt Enable"]
75pub type Crc5eofenR = crate::BitReader<Crc5eofen>;
76impl Crc5eofenR {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub const fn variant(&self) -> Crc5eofen {
80        match self.bits {
81            false => Crc5eofen::DisCrc5Int,
82            true => Crc5eofen::EnCrc5Int,
83        }
84    }
85    #[doc = "Disable"]
86    #[inline(always)]
87    pub fn is_dis_crc5_int(&self) -> bool {
88        *self == Crc5eofen::DisCrc5Int
89    }
90    #[doc = "Enable"]
91    #[inline(always)]
92    pub fn is_en_crc5_int(&self) -> bool {
93        *self == Crc5eofen::EnCrc5Int
94    }
95}
96#[doc = "Field `CRC5EOFEN` writer - CRC5/EOF Interrupt Enable"]
97pub type Crc5eofenW<'a, REG> = crate::BitWriter<'a, REG, Crc5eofen>;
98impl<'a, REG> Crc5eofenW<'a, REG>
99where
100    REG: crate::Writable + crate::RegisterSpec,
101{
102    #[doc = "Disable"]
103    #[inline(always)]
104    pub fn dis_crc5_int(self) -> &'a mut crate::W<REG> {
105        self.variant(Crc5eofen::DisCrc5Int)
106    }
107    #[doc = "Enable"]
108    #[inline(always)]
109    pub fn en_crc5_int(self) -> &'a mut crate::W<REG> {
110        self.variant(Crc5eofen::EnCrc5Int)
111    }
112}
113#[doc = "CRC16 Interrupt Enable\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum Crc16en {
117    #[doc = "0: Disable"]
118    DisCrc16Int = 0,
119    #[doc = "1: Enable"]
120    EnCrc16Int = 1,
121}
122impl From<Crc16en> for bool {
123    #[inline(always)]
124    fn from(variant: Crc16en) -> Self {
125        variant as u8 != 0
126    }
127}
128#[doc = "Field `CRC16EN` reader - CRC16 Interrupt Enable"]
129pub type Crc16enR = crate::BitReader<Crc16en>;
130impl Crc16enR {
131    #[doc = "Get enumerated values variant"]
132    #[inline(always)]
133    pub const fn variant(&self) -> Crc16en {
134        match self.bits {
135            false => Crc16en::DisCrc16Int,
136            true => Crc16en::EnCrc16Int,
137        }
138    }
139    #[doc = "Disable"]
140    #[inline(always)]
141    pub fn is_dis_crc16_int(&self) -> bool {
142        *self == Crc16en::DisCrc16Int
143    }
144    #[doc = "Enable"]
145    #[inline(always)]
146    pub fn is_en_crc16_int(&self) -> bool {
147        *self == Crc16en::EnCrc16Int
148    }
149}
150#[doc = "Field `CRC16EN` writer - CRC16 Interrupt Enable"]
151pub type Crc16enW<'a, REG> = crate::BitWriter<'a, REG, Crc16en>;
152impl<'a, REG> Crc16enW<'a, REG>
153where
154    REG: crate::Writable + crate::RegisterSpec,
155{
156    #[doc = "Disable"]
157    #[inline(always)]
158    pub fn dis_crc16_int(self) -> &'a mut crate::W<REG> {
159        self.variant(Crc16en::DisCrc16Int)
160    }
161    #[doc = "Enable"]
162    #[inline(always)]
163    pub fn en_crc16_int(self) -> &'a mut crate::W<REG> {
164        self.variant(Crc16en::EnCrc16Int)
165    }
166}
167#[doc = "DFN8 (Data Field Not Integer Number of Bytes) Interrupt Enable\n\nValue on reset: 0"]
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum Dfn8en {
171    #[doc = "0: Disable"]
172    DisDfn8Int = 0,
173    #[doc = "1: Enable"]
174    EnDfn8Int = 1,
175}
176impl From<Dfn8en> for bool {
177    #[inline(always)]
178    fn from(variant: Dfn8en) -> Self {
179        variant as u8 != 0
180    }
181}
182#[doc = "Field `DFN8EN` reader - DFN8 (Data Field Not Integer Number of Bytes) Interrupt Enable"]
183pub type Dfn8enR = crate::BitReader<Dfn8en>;
184impl Dfn8enR {
185    #[doc = "Get enumerated values variant"]
186    #[inline(always)]
187    pub const fn variant(&self) -> Dfn8en {
188        match self.bits {
189            false => Dfn8en::DisDfn8Int,
190            true => Dfn8en::EnDfn8Int,
191        }
192    }
193    #[doc = "Disable"]
194    #[inline(always)]
195    pub fn is_dis_dfn8_int(&self) -> bool {
196        *self == Dfn8en::DisDfn8Int
197    }
198    #[doc = "Enable"]
199    #[inline(always)]
200    pub fn is_en_dfn8_int(&self) -> bool {
201        *self == Dfn8en::EnDfn8Int
202    }
203}
204#[doc = "Field `DFN8EN` writer - DFN8 (Data Field Not Integer Number of Bytes) Interrupt Enable"]
205pub type Dfn8enW<'a, REG> = crate::BitWriter<'a, REG, Dfn8en>;
206impl<'a, REG> Dfn8enW<'a, REG>
207where
208    REG: crate::Writable + crate::RegisterSpec,
209{
210    #[doc = "Disable"]
211    #[inline(always)]
212    pub fn dis_dfn8_int(self) -> &'a mut crate::W<REG> {
213        self.variant(Dfn8en::DisDfn8Int)
214    }
215    #[doc = "Enable"]
216    #[inline(always)]
217    pub fn en_dfn8_int(self) -> &'a mut crate::W<REG> {
218        self.variant(Dfn8en::EnDfn8Int)
219    }
220}
221#[doc = "BTOERR (Bus Timeout Error) Interrupt Enable\n\nValue on reset: 0"]
222#[cfg_attr(feature = "defmt", derive(defmt::Format))]
223#[derive(Clone, Copy, Debug, PartialEq, Eq)]
224pub enum Btoerren {
225    #[doc = "0: Disable"]
226    DisBtoerrInt = 0,
227    #[doc = "1: Enable"]
228    EnBtoerrInt = 1,
229}
230impl From<Btoerren> for bool {
231    #[inline(always)]
232    fn from(variant: Btoerren) -> Self {
233        variant as u8 != 0
234    }
235}
236#[doc = "Field `BTOERREN` reader - BTOERR (Bus Timeout Error) Interrupt Enable"]
237pub type BtoerrenR = crate::BitReader<Btoerren>;
238impl BtoerrenR {
239    #[doc = "Get enumerated values variant"]
240    #[inline(always)]
241    pub const fn variant(&self) -> Btoerren {
242        match self.bits {
243            false => Btoerren::DisBtoerrInt,
244            true => Btoerren::EnBtoerrInt,
245        }
246    }
247    #[doc = "Disable"]
248    #[inline(always)]
249    pub fn is_dis_btoerr_int(&self) -> bool {
250        *self == Btoerren::DisBtoerrInt
251    }
252    #[doc = "Enable"]
253    #[inline(always)]
254    pub fn is_en_btoerr_int(&self) -> bool {
255        *self == Btoerren::EnBtoerrInt
256    }
257}
258#[doc = "Field `BTOERREN` writer - BTOERR (Bus Timeout Error) Interrupt Enable"]
259pub type BtoerrenW<'a, REG> = crate::BitWriter<'a, REG, Btoerren>;
260impl<'a, REG> BtoerrenW<'a, REG>
261where
262    REG: crate::Writable + crate::RegisterSpec,
263{
264    #[doc = "Disable"]
265    #[inline(always)]
266    pub fn dis_btoerr_int(self) -> &'a mut crate::W<REG> {
267        self.variant(Btoerren::DisBtoerrInt)
268    }
269    #[doc = "Enable"]
270    #[inline(always)]
271    pub fn en_btoerr_int(self) -> &'a mut crate::W<REG> {
272        self.variant(Btoerren::EnBtoerrInt)
273    }
274}
275#[doc = "DMAERR Interrupt Enable\n\nValue on reset: 0"]
276#[cfg_attr(feature = "defmt", derive(defmt::Format))]
277#[derive(Clone, Copy, Debug, PartialEq, Eq)]
278pub enum Dmaerren {
279    #[doc = "0: Disable"]
280    DisDmaerrInt = 0,
281    #[doc = "1: Enable"]
282    EnDmaerrInt = 1,
283}
284impl From<Dmaerren> for bool {
285    #[inline(always)]
286    fn from(variant: Dmaerren) -> Self {
287        variant as u8 != 0
288    }
289}
290#[doc = "Field `DMAERREN` reader - DMAERR Interrupt Enable"]
291pub type DmaerrenR = crate::BitReader<Dmaerren>;
292impl DmaerrenR {
293    #[doc = "Get enumerated values variant"]
294    #[inline(always)]
295    pub const fn variant(&self) -> Dmaerren {
296        match self.bits {
297            false => Dmaerren::DisDmaerrInt,
298            true => Dmaerren::EnDmaerrInt,
299        }
300    }
301    #[doc = "Disable"]
302    #[inline(always)]
303    pub fn is_dis_dmaerr_int(&self) -> bool {
304        *self == Dmaerren::DisDmaerrInt
305    }
306    #[doc = "Enable"]
307    #[inline(always)]
308    pub fn is_en_dmaerr_int(&self) -> bool {
309        *self == Dmaerren::EnDmaerrInt
310    }
311}
312#[doc = "Field `DMAERREN` writer - DMAERR Interrupt Enable"]
313pub type DmaerrenW<'a, REG> = crate::BitWriter<'a, REG, Dmaerren>;
314impl<'a, REG> DmaerrenW<'a, REG>
315where
316    REG: crate::Writable + crate::RegisterSpec,
317{
318    #[doc = "Disable"]
319    #[inline(always)]
320    pub fn dis_dmaerr_int(self) -> &'a mut crate::W<REG> {
321        self.variant(Dmaerren::DisDmaerrInt)
322    }
323    #[doc = "Enable"]
324    #[inline(always)]
325    pub fn en_dmaerr_int(self) -> &'a mut crate::W<REG> {
326        self.variant(Dmaerren::EnDmaerrInt)
327    }
328}
329#[doc = "OWNERR Interrupt Enable\n\nValue on reset: 0"]
330#[cfg_attr(feature = "defmt", derive(defmt::Format))]
331#[derive(Clone, Copy, Debug, PartialEq, Eq)]
332pub enum Ownerren {
333    #[doc = "0: Disable"]
334    DisOwnerrInt = 0,
335    #[doc = "1: Enable"]
336    EnOwnerrInt = 1,
337}
338impl From<Ownerren> for bool {
339    #[inline(always)]
340    fn from(variant: Ownerren) -> Self {
341        variant as u8 != 0
342    }
343}
344#[doc = "Field `OWNERREN` reader - OWNERR Interrupt Enable"]
345pub type OwnerrenR = crate::BitReader<Ownerren>;
346impl OwnerrenR {
347    #[doc = "Get enumerated values variant"]
348    #[inline(always)]
349    pub const fn variant(&self) -> Ownerren {
350        match self.bits {
351            false => Ownerren::DisOwnerrInt,
352            true => Ownerren::EnOwnerrInt,
353        }
354    }
355    #[doc = "Disable"]
356    #[inline(always)]
357    pub fn is_dis_ownerr_int(&self) -> bool {
358        *self == Ownerren::DisOwnerrInt
359    }
360    #[doc = "Enable"]
361    #[inline(always)]
362    pub fn is_en_ownerr_int(&self) -> bool {
363        *self == Ownerren::EnOwnerrInt
364    }
365}
366#[doc = "Field `OWNERREN` writer - OWNERR Interrupt Enable"]
367pub type OwnerrenW<'a, REG> = crate::BitWriter<'a, REG, Ownerren>;
368impl<'a, REG> OwnerrenW<'a, REG>
369where
370    REG: crate::Writable + crate::RegisterSpec,
371{
372    #[doc = "Disable"]
373    #[inline(always)]
374    pub fn dis_ownerr_int(self) -> &'a mut crate::W<REG> {
375        self.variant(Ownerren::DisOwnerrInt)
376    }
377    #[doc = "Enable"]
378    #[inline(always)]
379    pub fn en_ownerr_int(self) -> &'a mut crate::W<REG> {
380        self.variant(Ownerren::EnOwnerrInt)
381    }
382}
383#[doc = "BTSERR (Bit Stuff Error) Interrupt Enable\n\nValue on reset: 0"]
384#[cfg_attr(feature = "defmt", derive(defmt::Format))]
385#[derive(Clone, Copy, Debug, PartialEq, Eq)]
386pub enum Btserren {
387    #[doc = "0: Disable"]
388    DisBtserrenInt = 0,
389    #[doc = "1: Enable"]
390    EnBtserrenInt = 1,
391}
392impl From<Btserren> for bool {
393    #[inline(always)]
394    fn from(variant: Btserren) -> Self {
395        variant as u8 != 0
396    }
397}
398#[doc = "Field `BTSERREN` reader - BTSERR (Bit Stuff Error) Interrupt Enable"]
399pub type BtserrenR = crate::BitReader<Btserren>;
400impl BtserrenR {
401    #[doc = "Get enumerated values variant"]
402    #[inline(always)]
403    pub const fn variant(&self) -> Btserren {
404        match self.bits {
405            false => Btserren::DisBtserrenInt,
406            true => Btserren::EnBtserrenInt,
407        }
408    }
409    #[doc = "Disable"]
410    #[inline(always)]
411    pub fn is_dis_btserren_int(&self) -> bool {
412        *self == Btserren::DisBtserrenInt
413    }
414    #[doc = "Enable"]
415    #[inline(always)]
416    pub fn is_en_btserren_int(&self) -> bool {
417        *self == Btserren::EnBtserrenInt
418    }
419}
420#[doc = "Field `BTSERREN` writer - BTSERR (Bit Stuff Error) Interrupt Enable"]
421pub type BtserrenW<'a, REG> = crate::BitWriter<'a, REG, Btserren>;
422impl<'a, REG> BtserrenW<'a, REG>
423where
424    REG: crate::Writable + crate::RegisterSpec,
425{
426    #[doc = "Disable"]
427    #[inline(always)]
428    pub fn dis_btserren_int(self) -> &'a mut crate::W<REG> {
429        self.variant(Btserren::DisBtserrenInt)
430    }
431    #[doc = "Enable"]
432    #[inline(always)]
433    pub fn en_btserren_int(self) -> &'a mut crate::W<REG> {
434        self.variant(Btserren::EnBtserrenInt)
435    }
436}
437impl R {
438    #[doc = "Bit 0 - PIDERR Interrupt Enable"]
439    #[inline(always)]
440    pub fn piderren(&self) -> PiderrenR {
441        PiderrenR::new((self.bits & 1) != 0)
442    }
443    #[doc = "Bit 1 - CRC5/EOF Interrupt Enable"]
444    #[inline(always)]
445    pub fn crc5eofen(&self) -> Crc5eofenR {
446        Crc5eofenR::new(((self.bits >> 1) & 1) != 0)
447    }
448    #[doc = "Bit 2 - CRC16 Interrupt Enable"]
449    #[inline(always)]
450    pub fn crc16en(&self) -> Crc16enR {
451        Crc16enR::new(((self.bits >> 2) & 1) != 0)
452    }
453    #[doc = "Bit 3 - DFN8 (Data Field Not Integer Number of Bytes) Interrupt Enable"]
454    #[inline(always)]
455    pub fn dfn8en(&self) -> Dfn8enR {
456        Dfn8enR::new(((self.bits >> 3) & 1) != 0)
457    }
458    #[doc = "Bit 4 - BTOERR (Bus Timeout Error) Interrupt Enable"]
459    #[inline(always)]
460    pub fn btoerren(&self) -> BtoerrenR {
461        BtoerrenR::new(((self.bits >> 4) & 1) != 0)
462    }
463    #[doc = "Bit 5 - DMAERR Interrupt Enable"]
464    #[inline(always)]
465    pub fn dmaerren(&self) -> DmaerrenR {
466        DmaerrenR::new(((self.bits >> 5) & 1) != 0)
467    }
468    #[doc = "Bit 6 - OWNERR Interrupt Enable"]
469    #[inline(always)]
470    pub fn ownerren(&self) -> OwnerrenR {
471        OwnerrenR::new(((self.bits >> 6) & 1) != 0)
472    }
473    #[doc = "Bit 7 - BTSERR (Bit Stuff Error) Interrupt Enable"]
474    #[inline(always)]
475    pub fn btserren(&self) -> BtserrenR {
476        BtserrenR::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("ERREN")
483            .field("piderren", &self.piderren())
484            .field("crc5eofen", &self.crc5eofen())
485            .field("crc16en", &self.crc16en())
486            .field("dfn8en", &self.dfn8en())
487            .field("btoerren", &self.btoerren())
488            .field("dmaerren", &self.dmaerren())
489            .field("ownerren", &self.ownerren())
490            .field("btserren", &self.btserren())
491            .finish()
492    }
493}
494impl W {
495    #[doc = "Bit 0 - PIDERR Interrupt Enable"]
496    #[inline(always)]
497    pub fn piderren(&mut self) -> PiderrenW<'_, ErrenSpec> {
498        PiderrenW::new(self, 0)
499    }
500    #[doc = "Bit 1 - CRC5/EOF Interrupt Enable"]
501    #[inline(always)]
502    pub fn crc5eofen(&mut self) -> Crc5eofenW<'_, ErrenSpec> {
503        Crc5eofenW::new(self, 1)
504    }
505    #[doc = "Bit 2 - CRC16 Interrupt Enable"]
506    #[inline(always)]
507    pub fn crc16en(&mut self) -> Crc16enW<'_, ErrenSpec> {
508        Crc16enW::new(self, 2)
509    }
510    #[doc = "Bit 3 - DFN8 (Data Field Not Integer Number of Bytes) Interrupt Enable"]
511    #[inline(always)]
512    pub fn dfn8en(&mut self) -> Dfn8enW<'_, ErrenSpec> {
513        Dfn8enW::new(self, 3)
514    }
515    #[doc = "Bit 4 - BTOERR (Bus Timeout Error) Interrupt Enable"]
516    #[inline(always)]
517    pub fn btoerren(&mut self) -> BtoerrenW<'_, ErrenSpec> {
518        BtoerrenW::new(self, 4)
519    }
520    #[doc = "Bit 5 - DMAERR Interrupt Enable"]
521    #[inline(always)]
522    pub fn dmaerren(&mut self) -> DmaerrenW<'_, ErrenSpec> {
523        DmaerrenW::new(self, 5)
524    }
525    #[doc = "Bit 6 - OWNERR Interrupt Enable"]
526    #[inline(always)]
527    pub fn ownerren(&mut self) -> OwnerrenW<'_, ErrenSpec> {
528        OwnerrenW::new(self, 6)
529    }
530    #[doc = "Bit 7 - BTSERR (Bit Stuff Error) Interrupt Enable"]
531    #[inline(always)]
532    pub fn btserren(&mut self) -> BtserrenW<'_, ErrenSpec> {
533        BtserrenW::new(self, 7)
534    }
535}
536#[doc = "Error Interrupt Enable\n\nYou can [`read`](crate::Reg::read) this register and get [`erren::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`erren::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
537pub struct ErrenSpec;
538impl crate::RegisterSpec for ErrenSpec {
539    type Ux = u8;
540}
541#[doc = "`read()` method returns [`erren::R`](R) reader structure"]
542impl crate::Readable for ErrenSpec {}
543#[doc = "`write(|w| ..)` method takes [`erren::W`](W) writer structure"]
544impl crate::Writable for ErrenSpec {
545    type Safety = crate::Unsafe;
546}
547#[doc = "`reset()` method sets ERREN to value 0"]
548impl crate::Resettable for ErrenSpec {}