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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#[doc = "Register `USBFSM` reader"]
pub struct R(crate::R<USBFSM_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<USBFSM_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl From<crate::R<USBFSM_SPEC>> for R {
    #[inline(always)]
    fn from(reader: crate::R<USBFSM_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Field `DRDSTATE` reader - DualRoleDevice state"]
pub type DRDSTATE_R = crate::FieldReader<u8, DRDSTATESELECT_A>;
#[doc = "DualRoleDevice state\n\nValue on reset: 9"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum DRDSTATESELECT_A {
    #[doc = "0: `0`"]
    A_IDLE = 0,
    #[doc = "1: `1`"]
    A_WAIT_VRISE = 1,
    #[doc = "2: `10`"]
    A_WAIT_BCON = 2,
    #[doc = "3: `11`"]
    A_HOST = 3,
    #[doc = "4: `100`"]
    A_SUSPEND = 4,
    #[doc = "5: `101`"]
    A_PERIPHERAL = 5,
    #[doc = "6: `110`"]
    A_WAIT_VFALL = 6,
    #[doc = "7: `111`"]
    A_VBUS_ERR = 7,
    #[doc = "8: `1000`"]
    A_WAIT_DISCHARGE = 8,
    #[doc = "9: `1001`"]
    B_IDLE = 9,
    #[doc = "10: `1010`"]
    B_PERIPHERAL = 10,
    #[doc = "11: `1011`"]
    B_WAIT_BEGIN_HNP = 11,
    #[doc = "12: `1100`"]
    B_WAIT_DISCHARGE = 12,
    #[doc = "13: `1101`"]
    B_WAIT_ACON = 13,
    #[doc = "14: `1110`"]
    B_HOST = 14,
    #[doc = "15: `1111`"]
    B_SRP_INIT = 15,
}
impl From<DRDSTATESELECT_A> for u8 {
    #[inline(always)]
    fn from(variant: DRDSTATESELECT_A) -> Self {
        variant as _
    }
}
impl DRDSTATE_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> DRDSTATESELECT_A {
        match self.bits {
            0 => DRDSTATESELECT_A::A_IDLE,
            1 => DRDSTATESELECT_A::A_WAIT_VRISE,
            2 => DRDSTATESELECT_A::A_WAIT_BCON,
            3 => DRDSTATESELECT_A::A_HOST,
            4 => DRDSTATESELECT_A::A_SUSPEND,
            5 => DRDSTATESELECT_A::A_PERIPHERAL,
            6 => DRDSTATESELECT_A::A_WAIT_VFALL,
            7 => DRDSTATESELECT_A::A_VBUS_ERR,
            8 => DRDSTATESELECT_A::A_WAIT_DISCHARGE,
            9 => DRDSTATESELECT_A::B_IDLE,
            10 => DRDSTATESELECT_A::B_PERIPHERAL,
            11 => DRDSTATESELECT_A::B_WAIT_BEGIN_HNP,
            12 => DRDSTATESELECT_A::B_WAIT_DISCHARGE,
            13 => DRDSTATESELECT_A::B_WAIT_ACON,
            14 => DRDSTATESELECT_A::B_HOST,
            15 => DRDSTATESELECT_A::B_SRP_INIT,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `A_IDLE`"]
    #[inline(always)]
    pub fn is_a_idle(&self) -> bool {
        *self == DRDSTATESELECT_A::A_IDLE
    }
    #[doc = "Checks if the value of the field is `A_WAIT_VRISE`"]
    #[inline(always)]
    pub fn is_a_wait_vrise(&self) -> bool {
        *self == DRDSTATESELECT_A::A_WAIT_VRISE
    }
    #[doc = "Checks if the value of the field is `A_WAIT_BCON`"]
    #[inline(always)]
    pub fn is_a_wait_bcon(&self) -> bool {
        *self == DRDSTATESELECT_A::A_WAIT_BCON
    }
    #[doc = "Checks if the value of the field is `A_HOST`"]
    #[inline(always)]
    pub fn is_a_host(&self) -> bool {
        *self == DRDSTATESELECT_A::A_HOST
    }
    #[doc = "Checks if the value of the field is `A_SUSPEND`"]
    #[inline(always)]
    pub fn is_a_suspend(&self) -> bool {
        *self == DRDSTATESELECT_A::A_SUSPEND
    }
    #[doc = "Checks if the value of the field is `A_PERIPHERAL`"]
    #[inline(always)]
    pub fn is_a_peripheral(&self) -> bool {
        *self == DRDSTATESELECT_A::A_PERIPHERAL
    }
    #[doc = "Checks if the value of the field is `A_WAIT_VFALL`"]
    #[inline(always)]
    pub fn is_a_wait_vfall(&self) -> bool {
        *self == DRDSTATESELECT_A::A_WAIT_VFALL
    }
    #[doc = "Checks if the value of the field is `A_VBUS_ERR`"]
    #[inline(always)]
    pub fn is_a_vbus_err(&self) -> bool {
        *self == DRDSTATESELECT_A::A_VBUS_ERR
    }
    #[doc = "Checks if the value of the field is `A_WAIT_DISCHARGE`"]
    #[inline(always)]
    pub fn is_a_wait_discharge(&self) -> bool {
        *self == DRDSTATESELECT_A::A_WAIT_DISCHARGE
    }
    #[doc = "Checks if the value of the field is `B_IDLE`"]
    #[inline(always)]
    pub fn is_b_idle(&self) -> bool {
        *self == DRDSTATESELECT_A::B_IDLE
    }
    #[doc = "Checks if the value of the field is `B_PERIPHERAL`"]
    #[inline(always)]
    pub fn is_b_peripheral(&self) -> bool {
        *self == DRDSTATESELECT_A::B_PERIPHERAL
    }
    #[doc = "Checks if the value of the field is `B_WAIT_BEGIN_HNP`"]
    #[inline(always)]
    pub fn is_b_wait_begin_hnp(&self) -> bool {
        *self == DRDSTATESELECT_A::B_WAIT_BEGIN_HNP
    }
    #[doc = "Checks if the value of the field is `B_WAIT_DISCHARGE`"]
    #[inline(always)]
    pub fn is_b_wait_discharge(&self) -> bool {
        *self == DRDSTATESELECT_A::B_WAIT_DISCHARGE
    }
    #[doc = "Checks if the value of the field is `B_WAIT_ACON`"]
    #[inline(always)]
    pub fn is_b_wait_acon(&self) -> bool {
        *self == DRDSTATESELECT_A::B_WAIT_ACON
    }
    #[doc = "Checks if the value of the field is `B_HOST`"]
    #[inline(always)]
    pub fn is_b_host(&self) -> bool {
        *self == DRDSTATESELECT_A::B_HOST
    }
    #[doc = "Checks if the value of the field is `B_SRP_INIT`"]
    #[inline(always)]
    pub fn is_b_srp_init(&self) -> bool {
        *self == DRDSTATESELECT_A::B_SRP_INIT
    }
}
impl R {
    #[doc = "Bits 0:3 - DualRoleDevice state"]
    #[inline(always)]
    pub fn drdstate(&self) -> DRDSTATE_R {
        DRDSTATE_R::new((self.bits & 0x0f) as u8)
    }
}
#[doc = "USB internal finite state machine\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 [usbfsm](index.html) module"]
pub struct USBFSM_SPEC;
impl crate::RegisterSpec for USBFSM_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [usbfsm::R](R) reader structure"]
impl crate::Readable for USBFSM_SPEC {
    type Reader = R;
}
#[doc = "`reset()` method sets USBFSM to value 0x09"]
impl crate::Resettable for USBFSM_SPEC {
    const RESET_VALUE: Self::Ux = 0x09;
}