stm32l4x2_pac/usb/
istr.rs

1#[doc = r" Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7    bits: u32,
8}
9impl super::ISTR {
10    #[doc = r" Modifies the contents of the register"]
11    #[inline]
12    pub fn modify<F>(&self, f: F)
13    where
14        for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15    {
16        let bits = self.register.get();
17        let r = R { bits: bits };
18        let mut w = W { bits: bits };
19        f(&r, &mut w);
20        self.register.set(w.bits);
21    }
22    #[doc = r" Reads the contents of the register"]
23    #[inline]
24    pub fn read(&self) -> R {
25        R {
26            bits: self.register.get(),
27        }
28    }
29    #[doc = r" Writes to the register"]
30    #[inline]
31    pub fn write<F>(&self, f: F)
32    where
33        F: FnOnce(&mut W) -> &mut W,
34    {
35        let mut w = W::reset_value();
36        f(&mut w);
37        self.register.set(w.bits);
38    }
39    #[doc = r" Writes the reset value to the register"]
40    #[inline]
41    pub fn reset(&self) {
42        self.write(|w| w)
43    }
44}
45#[doc = r" Value of the field"]
46pub struct EP_IDR {
47    bits: u8,
48}
49impl EP_IDR {
50    #[doc = r" Value of the field as raw bits"]
51    #[inline]
52    pub fn bits(&self) -> u8 {
53        self.bits
54    }
55}
56#[doc = "Possible values of the field `DIR`"]
57#[derive(Clone, Copy, Debug, PartialEq)]
58pub enum DIRR {
59    #[doc = "data transmitted by the USB peripheral to the host PC"]
60    TO,
61    #[doc = "data received by the USB peripheral from the host PC"]
62    FROM,
63}
64impl DIRR {
65    #[doc = r" Returns `true` if the bit is clear (0)"]
66    #[inline]
67    pub fn bit_is_clear(&self) -> bool {
68        !self.bit()
69    }
70    #[doc = r" Returns `true` if the bit is set (1)"]
71    #[inline]
72    pub fn bit_is_set(&self) -> bool {
73        self.bit()
74    }
75    #[doc = r" Value of the field as raw bits"]
76    #[inline]
77    pub fn bit(&self) -> bool {
78        match *self {
79            DIRR::TO => false,
80            DIRR::FROM => true,
81        }
82    }
83    #[allow(missing_docs)]
84    #[doc(hidden)]
85    #[inline]
86    pub fn _from(value: bool) -> DIRR {
87        match value {
88            false => DIRR::TO,
89            true => DIRR::FROM,
90        }
91    }
92    #[doc = "Checks if the value of the field is `TO`"]
93    #[inline]
94    pub fn is_to(&self) -> bool {
95        *self == DIRR::TO
96    }
97    #[doc = "Checks if the value of the field is `FROM`"]
98    #[inline]
99    pub fn is_from(&self) -> bool {
100        *self == DIRR::FROM
101    }
102}
103#[doc = "Possible values of the field `L1REQ`"]
104#[derive(Clone, Copy, Debug, PartialEq)]
105pub enum L1REQR {
106    #[doc = "LPM command to enter the L1 state is successfully received and acknowledged"]
107    RECEIVED,
108    #[doc = r" Reserved"]
109    _Reserved(bool),
110}
111impl L1REQR {
112    #[doc = r" Returns `true` if the bit is clear (0)"]
113    #[inline]
114    pub fn bit_is_clear(&self) -> bool {
115        !self.bit()
116    }
117    #[doc = r" Returns `true` if the bit is set (1)"]
118    #[inline]
119    pub fn bit_is_set(&self) -> bool {
120        self.bit()
121    }
122    #[doc = r" Value of the field as raw bits"]
123    #[inline]
124    pub fn bit(&self) -> bool {
125        match *self {
126            L1REQR::RECEIVED => true,
127            L1REQR::_Reserved(bits) => bits,
128        }
129    }
130    #[allow(missing_docs)]
131    #[doc(hidden)]
132    #[inline]
133    pub fn _from(value: bool) -> L1REQR {
134        match value {
135            true => L1REQR::RECEIVED,
136            i => L1REQR::_Reserved(i),
137        }
138    }
139    #[doc = "Checks if the value of the field is `RECEIVED`"]
140    #[inline]
141    pub fn is_received(&self) -> bool {
142        *self == L1REQR::RECEIVED
143    }
144}
145#[doc = "Possible values of the field `ESOF`"]
146#[derive(Clone, Copy, Debug, PartialEq)]
147pub enum ESOFR {
148    #[doc = "an SOF packet is expected but not received"]
149    EXPECTEDSTARTOFFRAME,
150    #[doc = r" Reserved"]
151    _Reserved(bool),
152}
153impl ESOFR {
154    #[doc = r" Returns `true` if the bit is clear (0)"]
155    #[inline]
156    pub fn bit_is_clear(&self) -> bool {
157        !self.bit()
158    }
159    #[doc = r" Returns `true` if the bit is set (1)"]
160    #[inline]
161    pub fn bit_is_set(&self) -> bool {
162        self.bit()
163    }
164    #[doc = r" Value of the field as raw bits"]
165    #[inline]
166    pub fn bit(&self) -> bool {
167        match *self {
168            ESOFR::EXPECTEDSTARTOFFRAME => true,
169            ESOFR::_Reserved(bits) => bits,
170        }
171    }
172    #[allow(missing_docs)]
173    #[doc(hidden)]
174    #[inline]
175    pub fn _from(value: bool) -> ESOFR {
176        match value {
177            true => ESOFR::EXPECTEDSTARTOFFRAME,
178            i => ESOFR::_Reserved(i),
179        }
180    }
181    #[doc = "Checks if the value of the field is `EXPECTEDSTARTOFFRAME`"]
182    #[inline]
183    pub fn is_expected_start_of_frame(&self) -> bool {
184        *self == ESOFR::EXPECTEDSTARTOFFRAME
185    }
186}
187#[doc = "Possible values of the field `SOF`"]
188#[derive(Clone, Copy, Debug, PartialEq)]
189pub enum SOFR {
190    #[doc = "beginning of a new USB frame and it is set when a SOF packet arrives through the USB bus"]
191    STARTOFFRAME,
192    #[doc = r" Reserved"]
193    _Reserved(bool),
194}
195impl SOFR {
196    #[doc = r" Returns `true` if the bit is clear (0)"]
197    #[inline]
198    pub fn bit_is_clear(&self) -> bool {
199        !self.bit()
200    }
201    #[doc = r" Returns `true` if the bit is set (1)"]
202    #[inline]
203    pub fn bit_is_set(&self) -> bool {
204        self.bit()
205    }
206    #[doc = r" Value of the field as raw bits"]
207    #[inline]
208    pub fn bit(&self) -> bool {
209        match *self {
210            SOFR::STARTOFFRAME => true,
211            SOFR::_Reserved(bits) => bits,
212        }
213    }
214    #[allow(missing_docs)]
215    #[doc(hidden)]
216    #[inline]
217    pub fn _from(value: bool) -> SOFR {
218        match value {
219            true => SOFR::STARTOFFRAME,
220            i => SOFR::_Reserved(i),
221        }
222    }
223    #[doc = "Checks if the value of the field is `STARTOFFRAME`"]
224    #[inline]
225    pub fn is_start_of_frame(&self) -> bool {
226        *self == SOFR::STARTOFFRAME
227    }
228}
229#[doc = "Possible values of the field `RESET`"]
230#[derive(Clone, Copy, Debug, PartialEq)]
231pub enum RESETR {
232    #[doc = "peripheral detects an active USB RESET signal at its inputs"]
233    RESET,
234    #[doc = r" Reserved"]
235    _Reserved(bool),
236}
237impl RESETR {
238    #[doc = r" Returns `true` if the bit is clear (0)"]
239    #[inline]
240    pub fn bit_is_clear(&self) -> bool {
241        !self.bit()
242    }
243    #[doc = r" Returns `true` if the bit is set (1)"]
244    #[inline]
245    pub fn bit_is_set(&self) -> bool {
246        self.bit()
247    }
248    #[doc = r" Value of the field as raw bits"]
249    #[inline]
250    pub fn bit(&self) -> bool {
251        match *self {
252            RESETR::RESET => true,
253            RESETR::_Reserved(bits) => bits,
254        }
255    }
256    #[allow(missing_docs)]
257    #[doc(hidden)]
258    #[inline]
259    pub fn _from(value: bool) -> RESETR {
260        match value {
261            true => RESETR::RESET,
262            i => RESETR::_Reserved(i),
263        }
264    }
265    #[doc = "Checks if the value of the field is `RESET`"]
266    #[inline]
267    pub fn is_reset(&self) -> bool {
268        *self == RESETR::RESET
269    }
270}
271#[doc = "Possible values of the field `SUSP`"]
272#[derive(Clone, Copy, Debug, PartialEq)]
273pub enum SUSPR {
274    #[doc = "no traffic has been received for 3 ms, indicating a suspend mode request from the USB bus"]
275    SUSPEND,
276    #[doc = r" Reserved"]
277    _Reserved(bool),
278}
279impl SUSPR {
280    #[doc = r" Returns `true` if the bit is clear (0)"]
281    #[inline]
282    pub fn bit_is_clear(&self) -> bool {
283        !self.bit()
284    }
285    #[doc = r" Returns `true` if the bit is set (1)"]
286    #[inline]
287    pub fn bit_is_set(&self) -> bool {
288        self.bit()
289    }
290    #[doc = r" Value of the field as raw bits"]
291    #[inline]
292    pub fn bit(&self) -> bool {
293        match *self {
294            SUSPR::SUSPEND => true,
295            SUSPR::_Reserved(bits) => bits,
296        }
297    }
298    #[allow(missing_docs)]
299    #[doc(hidden)]
300    #[inline]
301    pub fn _from(value: bool) -> SUSPR {
302        match value {
303            true => SUSPR::SUSPEND,
304            i => SUSPR::_Reserved(i),
305        }
306    }
307    #[doc = "Checks if the value of the field is `SUSPEND`"]
308    #[inline]
309    pub fn is_suspend(&self) -> bool {
310        *self == SUSPR::SUSPEND
311    }
312}
313#[doc = "Possible values of the field `WKUP`"]
314#[derive(Clone, Copy, Debug, PartialEq)]
315pub enum WKUPR {
316    #[doc = "activity is detected that wakes up the USB peripheral"]
317    WAKEUP,
318    #[doc = r" Reserved"]
319    _Reserved(bool),
320}
321impl WKUPR {
322    #[doc = r" Returns `true` if the bit is clear (0)"]
323    #[inline]
324    pub fn bit_is_clear(&self) -> bool {
325        !self.bit()
326    }
327    #[doc = r" Returns `true` if the bit is set (1)"]
328    #[inline]
329    pub fn bit_is_set(&self) -> bool {
330        self.bit()
331    }
332    #[doc = r" Value of the field as raw bits"]
333    #[inline]
334    pub fn bit(&self) -> bool {
335        match *self {
336            WKUPR::WAKEUP => true,
337            WKUPR::_Reserved(bits) => bits,
338        }
339    }
340    #[allow(missing_docs)]
341    #[doc(hidden)]
342    #[inline]
343    pub fn _from(value: bool) -> WKUPR {
344        match value {
345            true => WKUPR::WAKEUP,
346            i => WKUPR::_Reserved(i),
347        }
348    }
349    #[doc = "Checks if the value of the field is `WAKEUP`"]
350    #[inline]
351    pub fn is_wakeup(&self) -> bool {
352        *self == WKUPR::WAKEUP
353    }
354}
355#[doc = "Possible values of the field `ERR`"]
356#[derive(Clone, Copy, Debug, PartialEq)]
357pub enum ERRR {
358    #[doc = "One of No ANSwer, Cyclic Redundancy Check, Bit Stuffing or Framing format Violation error occurred"]
359    ERROR,
360    #[doc = r" Reserved"]
361    _Reserved(bool),
362}
363impl ERRR {
364    #[doc = r" Returns `true` if the bit is clear (0)"]
365    #[inline]
366    pub fn bit_is_clear(&self) -> bool {
367        !self.bit()
368    }
369    #[doc = r" Returns `true` if the bit is set (1)"]
370    #[inline]
371    pub fn bit_is_set(&self) -> bool {
372        self.bit()
373    }
374    #[doc = r" Value of the field as raw bits"]
375    #[inline]
376    pub fn bit(&self) -> bool {
377        match *self {
378            ERRR::ERROR => true,
379            ERRR::_Reserved(bits) => bits,
380        }
381    }
382    #[allow(missing_docs)]
383    #[doc(hidden)]
384    #[inline]
385    pub fn _from(value: bool) -> ERRR {
386        match value {
387            true => ERRR::ERROR,
388            i => ERRR::_Reserved(i),
389        }
390    }
391    #[doc = "Checks if the value of the field is `ERROR`"]
392    #[inline]
393    pub fn is_error(&self) -> bool {
394        *self == ERRR::ERROR
395    }
396}
397#[doc = "Possible values of the field `PMAOVR`"]
398#[derive(Clone, Copy, Debug, PartialEq)]
399pub enum PMAOVRR {
400    #[doc = "microcontroller has not been able to respond in time to an USB memory request"]
401    OVERRUN,
402    #[doc = r" Reserved"]
403    _Reserved(bool),
404}
405impl PMAOVRR {
406    #[doc = r" Returns `true` if the bit is clear (0)"]
407    #[inline]
408    pub fn bit_is_clear(&self) -> bool {
409        !self.bit()
410    }
411    #[doc = r" Returns `true` if the bit is set (1)"]
412    #[inline]
413    pub fn bit_is_set(&self) -> bool {
414        self.bit()
415    }
416    #[doc = r" Value of the field as raw bits"]
417    #[inline]
418    pub fn bit(&self) -> bool {
419        match *self {
420            PMAOVRR::OVERRUN => true,
421            PMAOVRR::_Reserved(bits) => bits,
422        }
423    }
424    #[allow(missing_docs)]
425    #[doc(hidden)]
426    #[inline]
427    pub fn _from(value: bool) -> PMAOVRR {
428        match value {
429            true => PMAOVRR::OVERRUN,
430            i => PMAOVRR::_Reserved(i),
431        }
432    }
433    #[doc = "Checks if the value of the field is `OVERRUN`"]
434    #[inline]
435    pub fn is_overrun(&self) -> bool {
436        *self == PMAOVRR::OVERRUN
437    }
438}
439#[doc = "Possible values of the field `CTR`"]
440#[derive(Clone, Copy, Debug, PartialEq)]
441pub enum CTRR {
442    #[doc = "endpoint has successfully completed a transaction"]
443    COMPLETED,
444    #[doc = r" Reserved"]
445    _Reserved(bool),
446}
447impl CTRR {
448    #[doc = r" Returns `true` if the bit is clear (0)"]
449    #[inline]
450    pub fn bit_is_clear(&self) -> bool {
451        !self.bit()
452    }
453    #[doc = r" Returns `true` if the bit is set (1)"]
454    #[inline]
455    pub fn bit_is_set(&self) -> bool {
456        self.bit()
457    }
458    #[doc = r" Value of the field as raw bits"]
459    #[inline]
460    pub fn bit(&self) -> bool {
461        match *self {
462            CTRR::COMPLETED => true,
463            CTRR::_Reserved(bits) => bits,
464        }
465    }
466    #[allow(missing_docs)]
467    #[doc(hidden)]
468    #[inline]
469    pub fn _from(value: bool) -> CTRR {
470        match value {
471            true => CTRR::COMPLETED,
472            i => CTRR::_Reserved(i),
473        }
474    }
475    #[doc = "Checks if the value of the field is `COMPLETED`"]
476    #[inline]
477    pub fn is_completed(&self) -> bool {
478        *self == CTRR::COMPLETED
479    }
480}
481#[doc = "Values that can be written to the field `L1REQ`"]
482pub enum L1REQW {
483    #[doc = "LPM command to enter the L1 state is successfully received and acknowledged"]
484    RECEIVED,
485}
486impl L1REQW {
487    #[allow(missing_docs)]
488    #[doc(hidden)]
489    #[inline]
490    pub fn _bits(&self) -> bool {
491        match *self {
492            L1REQW::RECEIVED => true,
493        }
494    }
495}
496#[doc = r" Proxy"]
497pub struct _L1REQW<'a> {
498    w: &'a mut W,
499}
500impl<'a> _L1REQW<'a> {
501    #[doc = r" Writes `variant` to the field"]
502    #[inline]
503    pub fn variant(self, variant: L1REQW) -> &'a mut W {
504        {
505            self.bit(variant._bits())
506        }
507    }
508    #[doc = "LPM command to enter the L1 state is successfully received and acknowledged"]
509    #[inline]
510    pub fn received(self) -> &'a mut W {
511        self.variant(L1REQW::RECEIVED)
512    }
513    #[doc = r" Sets the field bit"]
514    pub fn set_bit(self) -> &'a mut W {
515        self.bit(true)
516    }
517    #[doc = r" Clears the field bit"]
518    pub fn clear_bit(self) -> &'a mut W {
519        self.bit(false)
520    }
521    #[doc = r" Writes raw bits to the field"]
522    #[inline]
523    pub fn bit(self, value: bool) -> &'a mut W {
524        const MASK: bool = true;
525        const OFFSET: u8 = 7;
526        self.w.bits &= !((MASK as u32) << OFFSET);
527        self.w.bits |= ((value & MASK) as u32) << OFFSET;
528        self.w
529    }
530}
531#[doc = "Values that can be written to the field `ESOF`"]
532pub enum ESOFW {
533    #[doc = "an SOF packet is expected but not received"]
534    EXPECTEDSTARTOFFRAME,
535}
536impl ESOFW {
537    #[allow(missing_docs)]
538    #[doc(hidden)]
539    #[inline]
540    pub fn _bits(&self) -> bool {
541        match *self {
542            ESOFW::EXPECTEDSTARTOFFRAME => true,
543        }
544    }
545}
546#[doc = r" Proxy"]
547pub struct _ESOFW<'a> {
548    w: &'a mut W,
549}
550impl<'a> _ESOFW<'a> {
551    #[doc = r" Writes `variant` to the field"]
552    #[inline]
553    pub fn variant(self, variant: ESOFW) -> &'a mut W {
554        {
555            self.bit(variant._bits())
556        }
557    }
558    #[doc = "an SOF packet is expected but not received"]
559    #[inline]
560    pub fn expected_start_of_frame(self) -> &'a mut W {
561        self.variant(ESOFW::EXPECTEDSTARTOFFRAME)
562    }
563    #[doc = r" Sets the field bit"]
564    pub fn set_bit(self) -> &'a mut W {
565        self.bit(true)
566    }
567    #[doc = r" Clears the field bit"]
568    pub fn clear_bit(self) -> &'a mut W {
569        self.bit(false)
570    }
571    #[doc = r" Writes raw bits to the field"]
572    #[inline]
573    pub fn bit(self, value: bool) -> &'a mut W {
574        const MASK: bool = true;
575        const OFFSET: u8 = 8;
576        self.w.bits &= !((MASK as u32) << OFFSET);
577        self.w.bits |= ((value & MASK) as u32) << OFFSET;
578        self.w
579    }
580}
581#[doc = "Values that can be written to the field `SOF`"]
582pub enum SOFW {
583    #[doc = "beginning of a new USB frame and it is set when a SOF packet arrives through the USB bus"]
584    STARTOFFRAME,
585}
586impl SOFW {
587    #[allow(missing_docs)]
588    #[doc(hidden)]
589    #[inline]
590    pub fn _bits(&self) -> bool {
591        match *self {
592            SOFW::STARTOFFRAME => true,
593        }
594    }
595}
596#[doc = r" Proxy"]
597pub struct _SOFW<'a> {
598    w: &'a mut W,
599}
600impl<'a> _SOFW<'a> {
601    #[doc = r" Writes `variant` to the field"]
602    #[inline]
603    pub fn variant(self, variant: SOFW) -> &'a mut W {
604        {
605            self.bit(variant._bits())
606        }
607    }
608    #[doc = "beginning of a new USB frame and it is set when a SOF packet arrives through the USB bus"]
609    #[inline]
610    pub fn start_of_frame(self) -> &'a mut W {
611        self.variant(SOFW::STARTOFFRAME)
612    }
613    #[doc = r" Sets the field bit"]
614    pub fn set_bit(self) -> &'a mut W {
615        self.bit(true)
616    }
617    #[doc = r" Clears the field bit"]
618    pub fn clear_bit(self) -> &'a mut W {
619        self.bit(false)
620    }
621    #[doc = r" Writes raw bits to the field"]
622    #[inline]
623    pub fn bit(self, value: bool) -> &'a mut W {
624        const MASK: bool = true;
625        const OFFSET: u8 = 9;
626        self.w.bits &= !((MASK as u32) << OFFSET);
627        self.w.bits |= ((value & MASK) as u32) << OFFSET;
628        self.w
629    }
630}
631#[doc = "Values that can be written to the field `RESET`"]
632pub enum RESETW {
633    #[doc = "peripheral detects an active USB RESET signal at its inputs"]
634    RESET,
635}
636impl RESETW {
637    #[allow(missing_docs)]
638    #[doc(hidden)]
639    #[inline]
640    pub fn _bits(&self) -> bool {
641        match *self {
642            RESETW::RESET => true,
643        }
644    }
645}
646#[doc = r" Proxy"]
647pub struct _RESETW<'a> {
648    w: &'a mut W,
649}
650impl<'a> _RESETW<'a> {
651    #[doc = r" Writes `variant` to the field"]
652    #[inline]
653    pub fn variant(self, variant: RESETW) -> &'a mut W {
654        {
655            self.bit(variant._bits())
656        }
657    }
658    #[doc = "peripheral detects an active USB RESET signal at its inputs"]
659    #[inline]
660    pub fn reset(self) -> &'a mut W {
661        self.variant(RESETW::RESET)
662    }
663    #[doc = r" Sets the field bit"]
664    pub fn set_bit(self) -> &'a mut W {
665        self.bit(true)
666    }
667    #[doc = r" Clears the field bit"]
668    pub fn clear_bit(self) -> &'a mut W {
669        self.bit(false)
670    }
671    #[doc = r" Writes raw bits to the field"]
672    #[inline]
673    pub fn bit(self, value: bool) -> &'a mut W {
674        const MASK: bool = true;
675        const OFFSET: u8 = 10;
676        self.w.bits &= !((MASK as u32) << OFFSET);
677        self.w.bits |= ((value & MASK) as u32) << OFFSET;
678        self.w
679    }
680}
681#[doc = "Values that can be written to the field `SUSP`"]
682pub enum SUSPW {
683    #[doc = "no traffic has been received for 3 ms, indicating a suspend mode request from the USB bus"]
684    SUSPEND,
685}
686impl SUSPW {
687    #[allow(missing_docs)]
688    #[doc(hidden)]
689    #[inline]
690    pub fn _bits(&self) -> bool {
691        match *self {
692            SUSPW::SUSPEND => true,
693        }
694    }
695}
696#[doc = r" Proxy"]
697pub struct _SUSPW<'a> {
698    w: &'a mut W,
699}
700impl<'a> _SUSPW<'a> {
701    #[doc = r" Writes `variant` to the field"]
702    #[inline]
703    pub fn variant(self, variant: SUSPW) -> &'a mut W {
704        {
705            self.bit(variant._bits())
706        }
707    }
708    #[doc = "no traffic has been received for 3 ms, indicating a suspend mode request from the USB bus"]
709    #[inline]
710    pub fn suspend(self) -> &'a mut W {
711        self.variant(SUSPW::SUSPEND)
712    }
713    #[doc = r" Sets the field bit"]
714    pub fn set_bit(self) -> &'a mut W {
715        self.bit(true)
716    }
717    #[doc = r" Clears the field bit"]
718    pub fn clear_bit(self) -> &'a mut W {
719        self.bit(false)
720    }
721    #[doc = r" Writes raw bits to the field"]
722    #[inline]
723    pub fn bit(self, value: bool) -> &'a mut W {
724        const MASK: bool = true;
725        const OFFSET: u8 = 11;
726        self.w.bits &= !((MASK as u32) << OFFSET);
727        self.w.bits |= ((value & MASK) as u32) << OFFSET;
728        self.w
729    }
730}
731#[doc = "Values that can be written to the field `WKUP`"]
732pub enum WKUPW {
733    #[doc = "activity is detected that wakes up the USB peripheral"]
734    WAKEUP,
735}
736impl WKUPW {
737    #[allow(missing_docs)]
738    #[doc(hidden)]
739    #[inline]
740    pub fn _bits(&self) -> bool {
741        match *self {
742            WKUPW::WAKEUP => true,
743        }
744    }
745}
746#[doc = r" Proxy"]
747pub struct _WKUPW<'a> {
748    w: &'a mut W,
749}
750impl<'a> _WKUPW<'a> {
751    #[doc = r" Writes `variant` to the field"]
752    #[inline]
753    pub fn variant(self, variant: WKUPW) -> &'a mut W {
754        {
755            self.bit(variant._bits())
756        }
757    }
758    #[doc = "activity is detected that wakes up the USB peripheral"]
759    #[inline]
760    pub fn wakeup(self) -> &'a mut W {
761        self.variant(WKUPW::WAKEUP)
762    }
763    #[doc = r" Sets the field bit"]
764    pub fn set_bit(self) -> &'a mut W {
765        self.bit(true)
766    }
767    #[doc = r" Clears the field bit"]
768    pub fn clear_bit(self) -> &'a mut W {
769        self.bit(false)
770    }
771    #[doc = r" Writes raw bits to the field"]
772    #[inline]
773    pub fn bit(self, value: bool) -> &'a mut W {
774        const MASK: bool = true;
775        const OFFSET: u8 = 12;
776        self.w.bits &= !((MASK as u32) << OFFSET);
777        self.w.bits |= ((value & MASK) as u32) << OFFSET;
778        self.w
779    }
780}
781#[doc = "Values that can be written to the field `ERR`"]
782pub enum ERRW {
783    #[doc = "One of No ANSwer, Cyclic Redundancy Check, Bit Stuffing or Framing format Violation error occurred"]
784    ERROR,
785}
786impl ERRW {
787    #[allow(missing_docs)]
788    #[doc(hidden)]
789    #[inline]
790    pub fn _bits(&self) -> bool {
791        match *self {
792            ERRW::ERROR => true,
793        }
794    }
795}
796#[doc = r" Proxy"]
797pub struct _ERRW<'a> {
798    w: &'a mut W,
799}
800impl<'a> _ERRW<'a> {
801    #[doc = r" Writes `variant` to the field"]
802    #[inline]
803    pub fn variant(self, variant: ERRW) -> &'a mut W {
804        {
805            self.bit(variant._bits())
806        }
807    }
808    #[doc = "One of No ANSwer, Cyclic Redundancy Check, Bit Stuffing or Framing format Violation error occurred"]
809    #[inline]
810    pub fn error(self) -> &'a mut W {
811        self.variant(ERRW::ERROR)
812    }
813    #[doc = r" Sets the field bit"]
814    pub fn set_bit(self) -> &'a mut W {
815        self.bit(true)
816    }
817    #[doc = r" Clears the field bit"]
818    pub fn clear_bit(self) -> &'a mut W {
819        self.bit(false)
820    }
821    #[doc = r" Writes raw bits to the field"]
822    #[inline]
823    pub fn bit(self, value: bool) -> &'a mut W {
824        const MASK: bool = true;
825        const OFFSET: u8 = 13;
826        self.w.bits &= !((MASK as u32) << OFFSET);
827        self.w.bits |= ((value & MASK) as u32) << OFFSET;
828        self.w
829    }
830}
831#[doc = "Values that can be written to the field `PMAOVR`"]
832pub enum PMAOVRW {
833    #[doc = "microcontroller has not been able to respond in time to an USB memory request"]
834    OVERRUN,
835}
836impl PMAOVRW {
837    #[allow(missing_docs)]
838    #[doc(hidden)]
839    #[inline]
840    pub fn _bits(&self) -> bool {
841        match *self {
842            PMAOVRW::OVERRUN => true,
843        }
844    }
845}
846#[doc = r" Proxy"]
847pub struct _PMAOVRW<'a> {
848    w: &'a mut W,
849}
850impl<'a> _PMAOVRW<'a> {
851    #[doc = r" Writes `variant` to the field"]
852    #[inline]
853    pub fn variant(self, variant: PMAOVRW) -> &'a mut W {
854        {
855            self.bit(variant._bits())
856        }
857    }
858    #[doc = "microcontroller has not been able to respond in time to an USB memory request"]
859    #[inline]
860    pub fn overrun(self) -> &'a mut W {
861        self.variant(PMAOVRW::OVERRUN)
862    }
863    #[doc = r" Sets the field bit"]
864    pub fn set_bit(self) -> &'a mut W {
865        self.bit(true)
866    }
867    #[doc = r" Clears the field bit"]
868    pub fn clear_bit(self) -> &'a mut W {
869        self.bit(false)
870    }
871    #[doc = r" Writes raw bits to the field"]
872    #[inline]
873    pub fn bit(self, value: bool) -> &'a mut W {
874        const MASK: bool = true;
875        const OFFSET: u8 = 14;
876        self.w.bits &= !((MASK as u32) << OFFSET);
877        self.w.bits |= ((value & MASK) as u32) << OFFSET;
878        self.w
879    }
880}
881impl R {
882    #[doc = r" Value of the register as raw bits"]
883    #[inline]
884    pub fn bits(&self) -> u32 {
885        self.bits
886    }
887    #[doc = "Bits 0:3 - Endpoint Identifier"]
888    #[inline]
889    pub fn ep_id(&self) -> EP_IDR {
890        let bits = {
891            const MASK: u8 = 15;
892            const OFFSET: u8 = 0;
893            ((self.bits >> OFFSET) & MASK as u32) as u8
894        };
895        EP_IDR { bits }
896    }
897    #[doc = "Bit 4 - Direction of transaction"]
898    #[inline]
899    pub fn dir(&self) -> DIRR {
900        DIRR::_from({
901            const MASK: bool = true;
902            const OFFSET: u8 = 4;
903            ((self.bits >> OFFSET) & MASK as u32) != 0
904        })
905    }
906    #[doc = "Bit 7 - LPM L1 state request"]
907    #[inline]
908    pub fn l1req(&self) -> L1REQR {
909        L1REQR::_from({
910            const MASK: bool = true;
911            const OFFSET: u8 = 7;
912            ((self.bits >> OFFSET) & MASK as u32) != 0
913        })
914    }
915    #[doc = "Bit 8 - Expected start frame"]
916    #[inline]
917    pub fn esof(&self) -> ESOFR {
918        ESOFR::_from({
919            const MASK: bool = true;
920            const OFFSET: u8 = 8;
921            ((self.bits >> OFFSET) & MASK as u32) != 0
922        })
923    }
924    #[doc = "Bit 9 - start of frame"]
925    #[inline]
926    pub fn sof(&self) -> SOFR {
927        SOFR::_from({
928            const MASK: bool = true;
929            const OFFSET: u8 = 9;
930            ((self.bits >> OFFSET) & MASK as u32) != 0
931        })
932    }
933    #[doc = "Bit 10 - reset request"]
934    #[inline]
935    pub fn reset(&self) -> RESETR {
936        RESETR::_from({
937            const MASK: bool = true;
938            const OFFSET: u8 = 10;
939            ((self.bits >> OFFSET) & MASK as u32) != 0
940        })
941    }
942    #[doc = "Bit 11 - Suspend mode request"]
943    #[inline]
944    pub fn susp(&self) -> SUSPR {
945        SUSPR::_from({
946            const MASK: bool = true;
947            const OFFSET: u8 = 11;
948            ((self.bits >> OFFSET) & MASK as u32) != 0
949        })
950    }
951    #[doc = "Bit 12 - Wakeup"]
952    #[inline]
953    pub fn wkup(&self) -> WKUPR {
954        WKUPR::_from({
955            const MASK: bool = true;
956            const OFFSET: u8 = 12;
957            ((self.bits >> OFFSET) & MASK as u32) != 0
958        })
959    }
960    #[doc = "Bit 13 - Error"]
961    #[inline]
962    pub fn err(&self) -> ERRR {
963        ERRR::_from({
964            const MASK: bool = true;
965            const OFFSET: u8 = 13;
966            ((self.bits >> OFFSET) & MASK as u32) != 0
967        })
968    }
969    #[doc = "Bit 14 - Packet memory area over / underrun"]
970    #[inline]
971    pub fn pmaovr(&self) -> PMAOVRR {
972        PMAOVRR::_from({
973            const MASK: bool = true;
974            const OFFSET: u8 = 14;
975            ((self.bits >> OFFSET) & MASK as u32) != 0
976        })
977    }
978    #[doc = "Bit 15 - Correct transfer"]
979    #[inline]
980    pub fn ctr(&self) -> CTRR {
981        CTRR::_from({
982            const MASK: bool = true;
983            const OFFSET: u8 = 15;
984            ((self.bits >> OFFSET) & MASK as u32) != 0
985        })
986    }
987}
988impl W {
989    #[doc = r" Reset value of the register"]
990    #[inline]
991    pub fn reset_value() -> W {
992        W { bits: 0 }
993    }
994    #[doc = r" Writes raw bits to the register"]
995    #[inline]
996    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
997        self.bits = bits;
998        self
999    }
1000    #[doc = "Bit 7 - LPM L1 state request"]
1001    #[inline]
1002    pub fn l1req(&mut self) -> _L1REQW {
1003        _L1REQW { w: self }
1004    }
1005    #[doc = "Bit 8 - Expected start frame"]
1006    #[inline]
1007    pub fn esof(&mut self) -> _ESOFW {
1008        _ESOFW { w: self }
1009    }
1010    #[doc = "Bit 9 - start of frame"]
1011    #[inline]
1012    pub fn sof(&mut self) -> _SOFW {
1013        _SOFW { w: self }
1014    }
1015    #[doc = "Bit 10 - reset request"]
1016    #[inline]
1017    pub fn reset(&mut self) -> _RESETW {
1018        _RESETW { w: self }
1019    }
1020    #[doc = "Bit 11 - Suspend mode request"]
1021    #[inline]
1022    pub fn susp(&mut self) -> _SUSPW {
1023        _SUSPW { w: self }
1024    }
1025    #[doc = "Bit 12 - Wakeup"]
1026    #[inline]
1027    pub fn wkup(&mut self) -> _WKUPW {
1028        _WKUPW { w: self }
1029    }
1030    #[doc = "Bit 13 - Error"]
1031    #[inline]
1032    pub fn err(&mut self) -> _ERRW {
1033        _ERRW { w: self }
1034    }
1035    #[doc = "Bit 14 - Packet memory area over / underrun"]
1036    #[inline]
1037    pub fn pmaovr(&mut self) -> _PMAOVRW {
1038        _PMAOVRW { w: self }
1039    }
1040}