stm32l4x2_pac/usb/
bcdr.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::BCDR {
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 = "Possible values of the field `BCDEN`"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum BCDENR {
48    #[doc = "disable the BCD support"]
49    DISABLED,
50    #[doc = "enable the BCD support within the USB device"]
51    ENABLED,
52}
53impl BCDENR {
54    #[doc = r" Returns `true` if the bit is clear (0)"]
55    #[inline]
56    pub fn bit_is_clear(&self) -> bool {
57        !self.bit()
58    }
59    #[doc = r" Returns `true` if the bit is set (1)"]
60    #[inline]
61    pub fn bit_is_set(&self) -> bool {
62        self.bit()
63    }
64    #[doc = r" Value of the field as raw bits"]
65    #[inline]
66    pub fn bit(&self) -> bool {
67        match *self {
68            BCDENR::DISABLED => false,
69            BCDENR::ENABLED => true,
70        }
71    }
72    #[allow(missing_docs)]
73    #[doc(hidden)]
74    #[inline]
75    pub fn _from(value: bool) -> BCDENR {
76        match value {
77            false => BCDENR::DISABLED,
78            true => BCDENR::ENABLED,
79        }
80    }
81    #[doc = "Checks if the value of the field is `DISABLED`"]
82    #[inline]
83    pub fn is_disabled(&self) -> bool {
84        *self == BCDENR::DISABLED
85    }
86    #[doc = "Checks if the value of the field is `ENABLED`"]
87    #[inline]
88    pub fn is_enabled(&self) -> bool {
89        *self == BCDENR::ENABLED
90    }
91}
92#[doc = "Possible values of the field `DCDEN`"]
93#[derive(Clone, Copy, Debug, PartialEq)]
94pub enum DCDENR {
95    #[doc = "Data contact detection (DCD) mode disabled"]
96    DISABLED,
97    #[doc = "Data contact detection (DCD) mode enabled"]
98    ENABLED,
99}
100impl DCDENR {
101    #[doc = r" Returns `true` if the bit is clear (0)"]
102    #[inline]
103    pub fn bit_is_clear(&self) -> bool {
104        !self.bit()
105    }
106    #[doc = r" Returns `true` if the bit is set (1)"]
107    #[inline]
108    pub fn bit_is_set(&self) -> bool {
109        self.bit()
110    }
111    #[doc = r" Value of the field as raw bits"]
112    #[inline]
113    pub fn bit(&self) -> bool {
114        match *self {
115            DCDENR::DISABLED => false,
116            DCDENR::ENABLED => true,
117        }
118    }
119    #[allow(missing_docs)]
120    #[doc(hidden)]
121    #[inline]
122    pub fn _from(value: bool) -> DCDENR {
123        match value {
124            false => DCDENR::DISABLED,
125            true => DCDENR::ENABLED,
126        }
127    }
128    #[doc = "Checks if the value of the field is `DISABLED`"]
129    #[inline]
130    pub fn is_disabled(&self) -> bool {
131        *self == DCDENR::DISABLED
132    }
133    #[doc = "Checks if the value of the field is `ENABLED`"]
134    #[inline]
135    pub fn is_enabled(&self) -> bool {
136        *self == DCDENR::ENABLED
137    }
138}
139#[doc = "Possible values of the field `PDEN`"]
140#[derive(Clone, Copy, Debug, PartialEq)]
141pub enum PDENR {
142    #[doc = "Primary detection (PD) mode disabled"]
143    DISABLED,
144    #[doc = "Primary detection (PD) mode enabled"]
145    ENABLED,
146}
147impl PDENR {
148    #[doc = r" Returns `true` if the bit is clear (0)"]
149    #[inline]
150    pub fn bit_is_clear(&self) -> bool {
151        !self.bit()
152    }
153    #[doc = r" Returns `true` if the bit is set (1)"]
154    #[inline]
155    pub fn bit_is_set(&self) -> bool {
156        self.bit()
157    }
158    #[doc = r" Value of the field as raw bits"]
159    #[inline]
160    pub fn bit(&self) -> bool {
161        match *self {
162            PDENR::DISABLED => false,
163            PDENR::ENABLED => true,
164        }
165    }
166    #[allow(missing_docs)]
167    #[doc(hidden)]
168    #[inline]
169    pub fn _from(value: bool) -> PDENR {
170        match value {
171            false => PDENR::DISABLED,
172            true => PDENR::ENABLED,
173        }
174    }
175    #[doc = "Checks if the value of the field is `DISABLED`"]
176    #[inline]
177    pub fn is_disabled(&self) -> bool {
178        *self == PDENR::DISABLED
179    }
180    #[doc = "Checks if the value of the field is `ENABLED`"]
181    #[inline]
182    pub fn is_enabled(&self) -> bool {
183        *self == PDENR::ENABLED
184    }
185}
186#[doc = "Possible values of the field `SDEN`"]
187#[derive(Clone, Copy, Debug, PartialEq)]
188pub enum SDENR {
189    #[doc = "Secondary detection (SD) mode disabled"]
190    DISABLED,
191    #[doc = "Secondary detection (SD) mode enabled"]
192    ENABLED,
193}
194impl SDENR {
195    #[doc = r" Returns `true` if the bit is clear (0)"]
196    #[inline]
197    pub fn bit_is_clear(&self) -> bool {
198        !self.bit()
199    }
200    #[doc = r" Returns `true` if the bit is set (1)"]
201    #[inline]
202    pub fn bit_is_set(&self) -> bool {
203        self.bit()
204    }
205    #[doc = r" Value of the field as raw bits"]
206    #[inline]
207    pub fn bit(&self) -> bool {
208        match *self {
209            SDENR::DISABLED => false,
210            SDENR::ENABLED => true,
211        }
212    }
213    #[allow(missing_docs)]
214    #[doc(hidden)]
215    #[inline]
216    pub fn _from(value: bool) -> SDENR {
217        match value {
218            false => SDENR::DISABLED,
219            true => SDENR::ENABLED,
220        }
221    }
222    #[doc = "Checks if the value of the field is `DISABLED`"]
223    #[inline]
224    pub fn is_disabled(&self) -> bool {
225        *self == SDENR::DISABLED
226    }
227    #[doc = "Checks if the value of the field is `ENABLED`"]
228    #[inline]
229    pub fn is_enabled(&self) -> bool {
230        *self == SDENR::ENABLED
231    }
232}
233#[doc = "Possible values of the field `DCDET`"]
234#[derive(Clone, Copy, Debug, PartialEq)]
235pub enum DCDETR {
236    #[doc = "data lines contact not detected"]
237    NOTDETECTED,
238    #[doc = "data lines contact detected"]
239    DETECTED,
240}
241impl DCDETR {
242    #[doc = r" Returns `true` if the bit is clear (0)"]
243    #[inline]
244    pub fn bit_is_clear(&self) -> bool {
245        !self.bit()
246    }
247    #[doc = r" Returns `true` if the bit is set (1)"]
248    #[inline]
249    pub fn bit_is_set(&self) -> bool {
250        self.bit()
251    }
252    #[doc = r" Value of the field as raw bits"]
253    #[inline]
254    pub fn bit(&self) -> bool {
255        match *self {
256            DCDETR::NOTDETECTED => false,
257            DCDETR::DETECTED => true,
258        }
259    }
260    #[allow(missing_docs)]
261    #[doc(hidden)]
262    #[inline]
263    pub fn _from(value: bool) -> DCDETR {
264        match value {
265            false => DCDETR::NOTDETECTED,
266            true => DCDETR::DETECTED,
267        }
268    }
269    #[doc = "Checks if the value of the field is `NOTDETECTED`"]
270    #[inline]
271    pub fn is_not_detected(&self) -> bool {
272        *self == DCDETR::NOTDETECTED
273    }
274    #[doc = "Checks if the value of the field is `DETECTED`"]
275    #[inline]
276    pub fn is_detected(&self) -> bool {
277        *self == DCDETR::DETECTED
278    }
279}
280#[doc = "Possible values of the field `PDET`"]
281#[derive(Clone, Copy, Debug, PartialEq)]
282pub enum PDETR {
283    #[doc = "no BCD support detected"]
284    NOBCD,
285    #[doc = "BCD support detected"]
286    BCD,
287}
288impl PDETR {
289    #[doc = r" Returns `true` if the bit is clear (0)"]
290    #[inline]
291    pub fn bit_is_clear(&self) -> bool {
292        !self.bit()
293    }
294    #[doc = r" Returns `true` if the bit is set (1)"]
295    #[inline]
296    pub fn bit_is_set(&self) -> bool {
297        self.bit()
298    }
299    #[doc = r" Value of the field as raw bits"]
300    #[inline]
301    pub fn bit(&self) -> bool {
302        match *self {
303            PDETR::NOBCD => false,
304            PDETR::BCD => true,
305        }
306    }
307    #[allow(missing_docs)]
308    #[doc(hidden)]
309    #[inline]
310    pub fn _from(value: bool) -> PDETR {
311        match value {
312            false => PDETR::NOBCD,
313            true => PDETR::BCD,
314        }
315    }
316    #[doc = "Checks if the value of the field is `NOBCD`"]
317    #[inline]
318    pub fn is_no_bcd(&self) -> bool {
319        *self == PDETR::NOBCD
320    }
321    #[doc = "Checks if the value of the field is `BCD`"]
322    #[inline]
323    pub fn is_bcd(&self) -> bool {
324        *self == PDETR::BCD
325    }
326}
327#[doc = "Possible values of the field `SDET`"]
328#[derive(Clone, Copy, Debug, PartialEq)]
329pub enum SDETR {
330    #[doc = "CDP detected"]
331    CDP,
332    #[doc = "DCP detected"]
333    DCP,
334}
335impl SDETR {
336    #[doc = r" Returns `true` if the bit is clear (0)"]
337    #[inline]
338    pub fn bit_is_clear(&self) -> bool {
339        !self.bit()
340    }
341    #[doc = r" Returns `true` if the bit is set (1)"]
342    #[inline]
343    pub fn bit_is_set(&self) -> bool {
344        self.bit()
345    }
346    #[doc = r" Value of the field as raw bits"]
347    #[inline]
348    pub fn bit(&self) -> bool {
349        match *self {
350            SDETR::CDP => false,
351            SDETR::DCP => true,
352        }
353    }
354    #[allow(missing_docs)]
355    #[doc(hidden)]
356    #[inline]
357    pub fn _from(value: bool) -> SDETR {
358        match value {
359            false => SDETR::CDP,
360            true => SDETR::DCP,
361        }
362    }
363    #[doc = "Checks if the value of the field is `CDP`"]
364    #[inline]
365    pub fn is_cdp(&self) -> bool {
366        *self == SDETR::CDP
367    }
368    #[doc = "Checks if the value of the field is `DCP`"]
369    #[inline]
370    pub fn is_dcp(&self) -> bool {
371        *self == SDETR::DCP
372    }
373}
374#[doc = "Possible values of the field `PS2DET`"]
375#[derive(Clone, Copy, Debug, PartialEq)]
376pub enum PS2DETR {
377    #[doc = "Normal port detected"]
378    NORMAL,
379    #[doc = "PS2 port or proprietary charger detected"]
380    PS2,
381}
382impl PS2DETR {
383    #[doc = r" Returns `true` if the bit is clear (0)"]
384    #[inline]
385    pub fn bit_is_clear(&self) -> bool {
386        !self.bit()
387    }
388    #[doc = r" Returns `true` if the bit is set (1)"]
389    #[inline]
390    pub fn bit_is_set(&self) -> bool {
391        self.bit()
392    }
393    #[doc = r" Value of the field as raw bits"]
394    #[inline]
395    pub fn bit(&self) -> bool {
396        match *self {
397            PS2DETR::NORMAL => false,
398            PS2DETR::PS2 => true,
399        }
400    }
401    #[allow(missing_docs)]
402    #[doc(hidden)]
403    #[inline]
404    pub fn _from(value: bool) -> PS2DETR {
405        match value {
406            false => PS2DETR::NORMAL,
407            true => PS2DETR::PS2,
408        }
409    }
410    #[doc = "Checks if the value of the field is `NORMAL`"]
411    #[inline]
412    pub fn is_normal(&self) -> bool {
413        *self == PS2DETR::NORMAL
414    }
415    #[doc = "Checks if the value of the field is `PS2`"]
416    #[inline]
417    pub fn is_ps2(&self) -> bool {
418        *self == PS2DETR::PS2
419    }
420}
421#[doc = "Possible values of the field `DPPU`"]
422#[derive(Clone, Copy, Debug, PartialEq)]
423pub enum DPPUR {
424    #[doc = "signalize disconnect to the host when needed by the user software"]
425    DISABLED,
426    #[doc = "enable the embedded pull-up on the DP line"]
427    ENABLED,
428}
429impl DPPUR {
430    #[doc = r" Returns `true` if the bit is clear (0)"]
431    #[inline]
432    pub fn bit_is_clear(&self) -> bool {
433        !self.bit()
434    }
435    #[doc = r" Returns `true` if the bit is set (1)"]
436    #[inline]
437    pub fn bit_is_set(&self) -> bool {
438        self.bit()
439    }
440    #[doc = r" Value of the field as raw bits"]
441    #[inline]
442    pub fn bit(&self) -> bool {
443        match *self {
444            DPPUR::DISABLED => false,
445            DPPUR::ENABLED => true,
446        }
447    }
448    #[allow(missing_docs)]
449    #[doc(hidden)]
450    #[inline]
451    pub fn _from(value: bool) -> DPPUR {
452        match value {
453            false => DPPUR::DISABLED,
454            true => DPPUR::ENABLED,
455        }
456    }
457    #[doc = "Checks if the value of the field is `DISABLED`"]
458    #[inline]
459    pub fn is_disabled(&self) -> bool {
460        *self == DPPUR::DISABLED
461    }
462    #[doc = "Checks if the value of the field is `ENABLED`"]
463    #[inline]
464    pub fn is_enabled(&self) -> bool {
465        *self == DPPUR::ENABLED
466    }
467}
468#[doc = "Values that can be written to the field `BCDEN`"]
469pub enum BCDENW {
470    #[doc = "disable the BCD support"]
471    DISABLED,
472    #[doc = "enable the BCD support within the USB device"]
473    ENABLED,
474}
475impl BCDENW {
476    #[allow(missing_docs)]
477    #[doc(hidden)]
478    #[inline]
479    pub fn _bits(&self) -> bool {
480        match *self {
481            BCDENW::DISABLED => false,
482            BCDENW::ENABLED => true,
483        }
484    }
485}
486#[doc = r" Proxy"]
487pub struct _BCDENW<'a> {
488    w: &'a mut W,
489}
490impl<'a> _BCDENW<'a> {
491    #[doc = r" Writes `variant` to the field"]
492    #[inline]
493    pub fn variant(self, variant: BCDENW) -> &'a mut W {
494        {
495            self.bit(variant._bits())
496        }
497    }
498    #[doc = "disable the BCD support"]
499    #[inline]
500    pub fn disabled(self) -> &'a mut W {
501        self.variant(BCDENW::DISABLED)
502    }
503    #[doc = "enable the BCD support within the USB device"]
504    #[inline]
505    pub fn enabled(self) -> &'a mut W {
506        self.variant(BCDENW::ENABLED)
507    }
508    #[doc = r" Sets the field bit"]
509    pub fn set_bit(self) -> &'a mut W {
510        self.bit(true)
511    }
512    #[doc = r" Clears the field bit"]
513    pub fn clear_bit(self) -> &'a mut W {
514        self.bit(false)
515    }
516    #[doc = r" Writes raw bits to the field"]
517    #[inline]
518    pub fn bit(self, value: bool) -> &'a mut W {
519        const MASK: bool = true;
520        const OFFSET: u8 = 0;
521        self.w.bits &= !((MASK as u32) << OFFSET);
522        self.w.bits |= ((value & MASK) as u32) << OFFSET;
523        self.w
524    }
525}
526#[doc = "Values that can be written to the field `DCDEN`"]
527pub enum DCDENW {
528    #[doc = "Data contact detection (DCD) mode disabled"]
529    DISABLED,
530    #[doc = "Data contact detection (DCD) mode enabled"]
531    ENABLED,
532}
533impl DCDENW {
534    #[allow(missing_docs)]
535    #[doc(hidden)]
536    #[inline]
537    pub fn _bits(&self) -> bool {
538        match *self {
539            DCDENW::DISABLED => false,
540            DCDENW::ENABLED => true,
541        }
542    }
543}
544#[doc = r" Proxy"]
545pub struct _DCDENW<'a> {
546    w: &'a mut W,
547}
548impl<'a> _DCDENW<'a> {
549    #[doc = r" Writes `variant` to the field"]
550    #[inline]
551    pub fn variant(self, variant: DCDENW) -> &'a mut W {
552        {
553            self.bit(variant._bits())
554        }
555    }
556    #[doc = "Data contact detection (DCD) mode disabled"]
557    #[inline]
558    pub fn disabled(self) -> &'a mut W {
559        self.variant(DCDENW::DISABLED)
560    }
561    #[doc = "Data contact detection (DCD) mode enabled"]
562    #[inline]
563    pub fn enabled(self) -> &'a mut W {
564        self.variant(DCDENW::ENABLED)
565    }
566    #[doc = r" Sets the field bit"]
567    pub fn set_bit(self) -> &'a mut W {
568        self.bit(true)
569    }
570    #[doc = r" Clears the field bit"]
571    pub fn clear_bit(self) -> &'a mut W {
572        self.bit(false)
573    }
574    #[doc = r" Writes raw bits to the field"]
575    #[inline]
576    pub fn bit(self, value: bool) -> &'a mut W {
577        const MASK: bool = true;
578        const OFFSET: u8 = 1;
579        self.w.bits &= !((MASK as u32) << OFFSET);
580        self.w.bits |= ((value & MASK) as u32) << OFFSET;
581        self.w
582    }
583}
584#[doc = "Values that can be written to the field `PDEN`"]
585pub enum PDENW {
586    #[doc = "Primary detection (PD) mode disabled"]
587    DISABLED,
588    #[doc = "Primary detection (PD) mode enabled"]
589    ENABLED,
590}
591impl PDENW {
592    #[allow(missing_docs)]
593    #[doc(hidden)]
594    #[inline]
595    pub fn _bits(&self) -> bool {
596        match *self {
597            PDENW::DISABLED => false,
598            PDENW::ENABLED => true,
599        }
600    }
601}
602#[doc = r" Proxy"]
603pub struct _PDENW<'a> {
604    w: &'a mut W,
605}
606impl<'a> _PDENW<'a> {
607    #[doc = r" Writes `variant` to the field"]
608    #[inline]
609    pub fn variant(self, variant: PDENW) -> &'a mut W {
610        {
611            self.bit(variant._bits())
612        }
613    }
614    #[doc = "Primary detection (PD) mode disabled"]
615    #[inline]
616    pub fn disabled(self) -> &'a mut W {
617        self.variant(PDENW::DISABLED)
618    }
619    #[doc = "Primary detection (PD) mode enabled"]
620    #[inline]
621    pub fn enabled(self) -> &'a mut W {
622        self.variant(PDENW::ENABLED)
623    }
624    #[doc = r" Sets the field bit"]
625    pub fn set_bit(self) -> &'a mut W {
626        self.bit(true)
627    }
628    #[doc = r" Clears the field bit"]
629    pub fn clear_bit(self) -> &'a mut W {
630        self.bit(false)
631    }
632    #[doc = r" Writes raw bits to the field"]
633    #[inline]
634    pub fn bit(self, value: bool) -> &'a mut W {
635        const MASK: bool = true;
636        const OFFSET: u8 = 2;
637        self.w.bits &= !((MASK as u32) << OFFSET);
638        self.w.bits |= ((value & MASK) as u32) << OFFSET;
639        self.w
640    }
641}
642#[doc = "Values that can be written to the field `SDEN`"]
643pub enum SDENW {
644    #[doc = "Secondary detection (SD) mode disabled"]
645    DISABLED,
646    #[doc = "Secondary detection (SD) mode enabled"]
647    ENABLED,
648}
649impl SDENW {
650    #[allow(missing_docs)]
651    #[doc(hidden)]
652    #[inline]
653    pub fn _bits(&self) -> bool {
654        match *self {
655            SDENW::DISABLED => false,
656            SDENW::ENABLED => true,
657        }
658    }
659}
660#[doc = r" Proxy"]
661pub struct _SDENW<'a> {
662    w: &'a mut W,
663}
664impl<'a> _SDENW<'a> {
665    #[doc = r" Writes `variant` to the field"]
666    #[inline]
667    pub fn variant(self, variant: SDENW) -> &'a mut W {
668        {
669            self.bit(variant._bits())
670        }
671    }
672    #[doc = "Secondary detection (SD) mode disabled"]
673    #[inline]
674    pub fn disabled(self) -> &'a mut W {
675        self.variant(SDENW::DISABLED)
676    }
677    #[doc = "Secondary detection (SD) mode enabled"]
678    #[inline]
679    pub fn enabled(self) -> &'a mut W {
680        self.variant(SDENW::ENABLED)
681    }
682    #[doc = r" Sets the field bit"]
683    pub fn set_bit(self) -> &'a mut W {
684        self.bit(true)
685    }
686    #[doc = r" Clears the field bit"]
687    pub fn clear_bit(self) -> &'a mut W {
688        self.bit(false)
689    }
690    #[doc = r" Writes raw bits to the field"]
691    #[inline]
692    pub fn bit(self, value: bool) -> &'a mut W {
693        const MASK: bool = true;
694        const OFFSET: u8 = 3;
695        self.w.bits &= !((MASK as u32) << OFFSET);
696        self.w.bits |= ((value & MASK) as u32) << OFFSET;
697        self.w
698    }
699}
700#[doc = "Values that can be written to the field `DPPU`"]
701pub enum DPPUW {
702    #[doc = "signalize disconnect to the host when needed by the user software"]
703    DISABLED,
704    #[doc = "enable the embedded pull-up on the DP line"]
705    ENABLED,
706}
707impl DPPUW {
708    #[allow(missing_docs)]
709    #[doc(hidden)]
710    #[inline]
711    pub fn _bits(&self) -> bool {
712        match *self {
713            DPPUW::DISABLED => false,
714            DPPUW::ENABLED => true,
715        }
716    }
717}
718#[doc = r" Proxy"]
719pub struct _DPPUW<'a> {
720    w: &'a mut W,
721}
722impl<'a> _DPPUW<'a> {
723    #[doc = r" Writes `variant` to the field"]
724    #[inline]
725    pub fn variant(self, variant: DPPUW) -> &'a mut W {
726        {
727            self.bit(variant._bits())
728        }
729    }
730    #[doc = "signalize disconnect to the host when needed by the user software"]
731    #[inline]
732    pub fn disabled(self) -> &'a mut W {
733        self.variant(DPPUW::DISABLED)
734    }
735    #[doc = "enable the embedded pull-up on the DP line"]
736    #[inline]
737    pub fn enabled(self) -> &'a mut W {
738        self.variant(DPPUW::ENABLED)
739    }
740    #[doc = r" Sets the field bit"]
741    pub fn set_bit(self) -> &'a mut W {
742        self.bit(true)
743    }
744    #[doc = r" Clears the field bit"]
745    pub fn clear_bit(self) -> &'a mut W {
746        self.bit(false)
747    }
748    #[doc = r" Writes raw bits to the field"]
749    #[inline]
750    pub fn bit(self, value: bool) -> &'a mut W {
751        const MASK: bool = true;
752        const OFFSET: u8 = 15;
753        self.w.bits &= !((MASK as u32) << OFFSET);
754        self.w.bits |= ((value & MASK) as u32) << OFFSET;
755        self.w
756    }
757}
758impl R {
759    #[doc = r" Value of the register as raw bits"]
760    #[inline]
761    pub fn bits(&self) -> u32 {
762        self.bits
763    }
764    #[doc = "Bit 0 - Battery charging detector"]
765    #[inline]
766    pub fn bcden(&self) -> BCDENR {
767        BCDENR::_from({
768            const MASK: bool = true;
769            const OFFSET: u8 = 0;
770            ((self.bits >> OFFSET) & MASK as u32) != 0
771        })
772    }
773    #[doc = "Bit 1 - Data contact detection"]
774    #[inline]
775    pub fn dcden(&self) -> DCDENR {
776        DCDENR::_from({
777            const MASK: bool = true;
778            const OFFSET: u8 = 1;
779            ((self.bits >> OFFSET) & MASK as u32) != 0
780        })
781    }
782    #[doc = "Bit 2 - Primary detection"]
783    #[inline]
784    pub fn pden(&self) -> PDENR {
785        PDENR::_from({
786            const MASK: bool = true;
787            const OFFSET: u8 = 2;
788            ((self.bits >> OFFSET) & MASK as u32) != 0
789        })
790    }
791    #[doc = "Bit 3 - Secondary detection"]
792    #[inline]
793    pub fn sden(&self) -> SDENR {
794        SDENR::_from({
795            const MASK: bool = true;
796            const OFFSET: u8 = 3;
797            ((self.bits >> OFFSET) & MASK as u32) != 0
798        })
799    }
800    #[doc = "Bit 4 - Data contact detection"]
801    #[inline]
802    pub fn dcdet(&self) -> DCDETR {
803        DCDETR::_from({
804            const MASK: bool = true;
805            const OFFSET: u8 = 4;
806            ((self.bits >> OFFSET) & MASK as u32) != 0
807        })
808    }
809    #[doc = "Bit 5 - Primary detection"]
810    #[inline]
811    pub fn pdet(&self) -> PDETR {
812        PDETR::_from({
813            const MASK: bool = true;
814            const OFFSET: u8 = 5;
815            ((self.bits >> OFFSET) & MASK as u32) != 0
816        })
817    }
818    #[doc = "Bit 6 - Secondary detection"]
819    #[inline]
820    pub fn sdet(&self) -> SDETR {
821        SDETR::_from({
822            const MASK: bool = true;
823            const OFFSET: u8 = 6;
824            ((self.bits >> OFFSET) & MASK as u32) != 0
825        })
826    }
827    #[doc = "Bit 7 - DM pull-up detection status"]
828    #[inline]
829    pub fn ps2det(&self) -> PS2DETR {
830        PS2DETR::_from({
831            const MASK: bool = true;
832            const OFFSET: u8 = 7;
833            ((self.bits >> OFFSET) & MASK as u32) != 0
834        })
835    }
836    #[doc = "Bit 15 - DP pull-up control"]
837    #[inline]
838    pub fn dppu(&self) -> DPPUR {
839        DPPUR::_from({
840            const MASK: bool = true;
841            const OFFSET: u8 = 15;
842            ((self.bits >> OFFSET) & MASK as u32) != 0
843        })
844    }
845}
846impl W {
847    #[doc = r" Reset value of the register"]
848    #[inline]
849    pub fn reset_value() -> W {
850        W { bits: 0 }
851    }
852    #[doc = r" Writes raw bits to the register"]
853    #[inline]
854    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
855        self.bits = bits;
856        self
857    }
858    #[doc = "Bit 0 - Battery charging detector"]
859    #[inline]
860    pub fn bcden(&mut self) -> _BCDENW {
861        _BCDENW { w: self }
862    }
863    #[doc = "Bit 1 - Data contact detection"]
864    #[inline]
865    pub fn dcden(&mut self) -> _DCDENW {
866        _DCDENW { w: self }
867    }
868    #[doc = "Bit 2 - Primary detection"]
869    #[inline]
870    pub fn pden(&mut self) -> _PDENW {
871        _PDENW { w: self }
872    }
873    #[doc = "Bit 3 - Secondary detection"]
874    #[inline]
875    pub fn sden(&mut self) -> _SDENW {
876        _SDENW { w: self }
877    }
878    #[doc = "Bit 15 - DP pull-up control"]
879    #[inline]
880    pub fn dppu(&mut self) -> _DPPUW {
881        _DPPUW { w: self }
882    }
883}