1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#[doc = "Register `USBREGSTATUS` reader"]
pub struct R(crate::R<USBREGSTATUS_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<USBREGSTATUS_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl From<crate::R<USBREGSTATUS_SPEC>> for R {
    #[inline(always)]
    fn from(reader: crate::R<USBREGSTATUS_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Field `VBUSDETECT` reader - VBUS input detection status (USBDETECTED and USBREMOVED events are derived from this information)"]
pub type VBUSDETECT_R = crate::BitReader<VBUSDETECT_A>;
#[doc = "VBUS input detection status (USBDETECTED and USBREMOVED events are derived from this information)\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum VBUSDETECT_A {
    #[doc = "0: VBUS voltage below valid threshold"]
    NO_VBUS = 0,
    #[doc = "1: VBUS voltage above valid threshold"]
    VBUS_PRESENT = 1,
}
impl From<VBUSDETECT_A> for bool {
    #[inline(always)]
    fn from(variant: VBUSDETECT_A) -> Self {
        variant as u8 != 0
    }
}
impl VBUSDETECT_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> VBUSDETECT_A {
        match self.bits {
            false => VBUSDETECT_A::NO_VBUS,
            true => VBUSDETECT_A::VBUS_PRESENT,
        }
    }
    #[doc = "Checks if the value of the field is `NO_VBUS`"]
    #[inline(always)]
    pub fn is_no_vbus(&self) -> bool {
        *self == VBUSDETECT_A::NO_VBUS
    }
    #[doc = "Checks if the value of the field is `VBUS_PRESENT`"]
    #[inline(always)]
    pub fn is_vbus_present(&self) -> bool {
        *self == VBUSDETECT_A::VBUS_PRESENT
    }
}
#[doc = "Field `OUTPUTRDY` reader - USB supply output settling time elapsed"]
pub type OUTPUTRDY_R = crate::BitReader<OUTPUTRDY_A>;
#[doc = "USB supply output settling time elapsed\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OUTPUTRDY_A {
    #[doc = "0: USBREG output settling time not elapsed"]
    NOT_READY = 0,
    #[doc = "1: USBREG output settling time elapsed (same information as USBPWRRDY event)"]
    READY = 1,
}
impl From<OUTPUTRDY_A> for bool {
    #[inline(always)]
    fn from(variant: OUTPUTRDY_A) -> Self {
        variant as u8 != 0
    }
}
impl OUTPUTRDY_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> OUTPUTRDY_A {
        match self.bits {
            false => OUTPUTRDY_A::NOT_READY,
            true => OUTPUTRDY_A::READY,
        }
    }
    #[doc = "Checks if the value of the field is `NOT_READY`"]
    #[inline(always)]
    pub fn is_not_ready(&self) -> bool {
        *self == OUTPUTRDY_A::NOT_READY
    }
    #[doc = "Checks if the value of the field is `READY`"]
    #[inline(always)]
    pub fn is_ready(&self) -> bool {
        *self == OUTPUTRDY_A::READY
    }
}
impl R {
    #[doc = "Bit 0 - VBUS input detection status (USBDETECTED and USBREMOVED events are derived from this information)"]
    #[inline(always)]
    pub fn vbusdetect(&self) -> VBUSDETECT_R {
        VBUSDETECT_R::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - USB supply output settling time elapsed"]
    #[inline(always)]
    pub fn outputrdy(&self) -> OUTPUTRDY_R {
        OUTPUTRDY_R::new(((self.bits >> 1) & 1) != 0)
    }
}
#[doc = "USB supply status\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [usbregstatus](index.html) module"]
pub struct USBREGSTATUS_SPEC;
impl crate::RegisterSpec for USBREGSTATUS_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [usbregstatus::R](R) reader structure"]
impl crate::Readable for USBREGSTATUS_SPEC {
    type Reader = R;
}
#[doc = "`reset()` method sets USBREGSTATUS to value 0"]
impl crate::Resettable for USBREGSTATUS_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}