1#[doc = "Reader of register EP0R"]
2pub type R = crate::R<u16, super::EP0R>;
3#[doc = "Writer for register EP0R"]
4pub type W = crate::W<u16, super::EP0R>;
5#[doc = "Register EP0R `reset()`'s with value 0"]
6impl crate::ResetValue for super::EP0R {
7 type Type = u16;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `EA`"]
14pub type EA_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `EA`"]
16pub struct EA_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> EA_W<'a> {
20 #[doc = r"Writes raw bits to the field"]
21 #[inline(always)]
22 pub unsafe fn bits(self, value: u8) -> &'a mut W {
23 self.w.bits = (self.w.bits & !0x0f) | ((value as u16) & 0x0f);
24 self.w
25 }
26}
27#[doc = "Reader of field `STAT_TX`"]
28pub type STAT_TX_R = crate::R<u8, u8>;
29#[doc = "Write proxy for field `STAT_TX`"]
30pub struct STAT_TX_W<'a> {
31 w: &'a mut W,
32}
33impl<'a> STAT_TX_W<'a> {
34 #[doc = r"Writes raw bits to the field"]
35 #[inline(always)]
36 pub unsafe fn bits(self, value: u8) -> &'a mut W {
37 self.w.bits = (self.w.bits & !(0x03 << 4)) | (((value as u16) & 0x03) << 4);
38 self.w
39 }
40}
41#[doc = "Reader of field `DTOG_TX`"]
42pub type DTOG_TX_R = crate::R<bool, bool>;
43#[doc = "Write proxy for field `DTOG_TX`"]
44pub struct DTOG_TX_W<'a> {
45 w: &'a mut W,
46}
47impl<'a> DTOG_TX_W<'a> {
48 #[doc = r"Sets the field bit"]
49 #[inline(always)]
50 pub fn set_bit(self) -> &'a mut W {
51 self.bit(true)
52 }
53 #[doc = r"Clears the field bit"]
54 #[inline(always)]
55 pub fn clear_bit(self) -> &'a mut W {
56 self.bit(false)
57 }
58 #[doc = r"Writes raw bits to the field"]
59 #[inline(always)]
60 pub fn bit(self, value: bool) -> &'a mut W {
61 self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u16) & 0x01) << 6);
62 self.w
63 }
64}
65#[doc = "Reader of field `CTR_TX`"]
66pub type CTR_TX_R = crate::R<bool, bool>;
67#[doc = "Write proxy for field `CTR_TX`"]
68pub struct CTR_TX_W<'a> {
69 w: &'a mut W,
70}
71impl<'a> CTR_TX_W<'a> {
72 #[doc = r"Sets the field bit"]
73 #[inline(always)]
74 pub fn set_bit(self) -> &'a mut W {
75 self.bit(true)
76 }
77 #[doc = r"Clears the field bit"]
78 #[inline(always)]
79 pub fn clear_bit(self) -> &'a mut W {
80 self.bit(false)
81 }
82 #[doc = r"Writes raw bits to the field"]
83 #[inline(always)]
84 pub fn bit(self, value: bool) -> &'a mut W {
85 self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u16) & 0x01) << 7);
86 self.w
87 }
88}
89#[doc = "Reader of field `EP_KIND`"]
90pub type EP_KIND_R = crate::R<bool, bool>;
91#[doc = "Write proxy for field `EP_KIND`"]
92pub struct EP_KIND_W<'a> {
93 w: &'a mut W,
94}
95impl<'a> EP_KIND_W<'a> {
96 #[doc = r"Sets the field bit"]
97 #[inline(always)]
98 pub fn set_bit(self) -> &'a mut W {
99 self.bit(true)
100 }
101 #[doc = r"Clears the field bit"]
102 #[inline(always)]
103 pub fn clear_bit(self) -> &'a mut W {
104 self.bit(false)
105 }
106 #[doc = r"Writes raw bits to the field"]
107 #[inline(always)]
108 pub fn bit(self, value: bool) -> &'a mut W {
109 self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u16) & 0x01) << 8);
110 self.w
111 }
112}
113#[doc = "Reader of field `EP_TYPE`"]
114pub type EP_TYPE_R = crate::R<u8, u8>;
115#[doc = "Write proxy for field `EP_TYPE`"]
116pub struct EP_TYPE_W<'a> {
117 w: &'a mut W,
118}
119impl<'a> EP_TYPE_W<'a> {
120 #[doc = r"Writes raw bits to the field"]
121 #[inline(always)]
122 pub unsafe fn bits(self, value: u8) -> &'a mut W {
123 self.w.bits = (self.w.bits & !(0x03 << 9)) | (((value as u16) & 0x03) << 9);
124 self.w
125 }
126}
127#[doc = "Reader of field `SETUP`"]
128pub type SETUP_R = crate::R<bool, bool>;
129#[doc = "Write proxy for field `SETUP`"]
130pub struct SETUP_W<'a> {
131 w: &'a mut W,
132}
133impl<'a> SETUP_W<'a> {
134 #[doc = r"Sets the field bit"]
135 #[inline(always)]
136 pub fn set_bit(self) -> &'a mut W {
137 self.bit(true)
138 }
139 #[doc = r"Clears the field bit"]
140 #[inline(always)]
141 pub fn clear_bit(self) -> &'a mut W {
142 self.bit(false)
143 }
144 #[doc = r"Writes raw bits to the field"]
145 #[inline(always)]
146 pub fn bit(self, value: bool) -> &'a mut W {
147 self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u16) & 0x01) << 11);
148 self.w
149 }
150}
151#[doc = "Reader of field `STAT_RX`"]
152pub type STAT_RX_R = crate::R<u8, u8>;
153#[doc = "Write proxy for field `STAT_RX`"]
154pub struct STAT_RX_W<'a> {
155 w: &'a mut W,
156}
157impl<'a> STAT_RX_W<'a> {
158 #[doc = r"Writes raw bits to the field"]
159 #[inline(always)]
160 pub unsafe fn bits(self, value: u8) -> &'a mut W {
161 self.w.bits = (self.w.bits & !(0x03 << 12)) | (((value as u16) & 0x03) << 12);
162 self.w
163 }
164}
165#[doc = "Reader of field `DTOG_RX`"]
166pub type DTOG_RX_R = crate::R<bool, bool>;
167#[doc = "Write proxy for field `DTOG_RX`"]
168pub struct DTOG_RX_W<'a> {
169 w: &'a mut W,
170}
171impl<'a> DTOG_RX_W<'a> {
172 #[doc = r"Sets the field bit"]
173 #[inline(always)]
174 pub fn set_bit(self) -> &'a mut W {
175 self.bit(true)
176 }
177 #[doc = r"Clears the field bit"]
178 #[inline(always)]
179 pub fn clear_bit(self) -> &'a mut W {
180 self.bit(false)
181 }
182 #[doc = r"Writes raw bits to the field"]
183 #[inline(always)]
184 pub fn bit(self, value: bool) -> &'a mut W {
185 self.w.bits = (self.w.bits & !(0x01 << 14)) | (((value as u16) & 0x01) << 14);
186 self.w
187 }
188}
189#[doc = "Reader of field `CTR_RX`"]
190pub type CTR_RX_R = crate::R<bool, bool>;
191#[doc = "Write proxy for field `CTR_RX`"]
192pub struct CTR_RX_W<'a> {
193 w: &'a mut W,
194}
195impl<'a> CTR_RX_W<'a> {
196 #[doc = r"Sets the field bit"]
197 #[inline(always)]
198 pub fn set_bit(self) -> &'a mut W {
199 self.bit(true)
200 }
201 #[doc = r"Clears the field bit"]
202 #[inline(always)]
203 pub fn clear_bit(self) -> &'a mut W {
204 self.bit(false)
205 }
206 #[doc = r"Writes raw bits to the field"]
207 #[inline(always)]
208 pub fn bit(self, value: bool) -> &'a mut W {
209 self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u16) & 0x01) << 15);
210 self.w
211 }
212}
213impl R {
214 #[doc = "Bits 0:3 - Endpoint address"]
215 #[inline(always)]
216 pub fn ea(&self) -> EA_R {
217 EA_R::new((self.bits & 0x0f) as u8)
218 }
219 #[doc = "Bits 4:5 - Status bits, for transmission transfers"]
220 #[inline(always)]
221 pub fn stat_tx(&self) -> STAT_TX_R {
222 STAT_TX_R::new(((self.bits >> 4) & 0x03) as u8)
223 }
224 #[doc = "Bit 6 - Data Toggle, for transmission transfers"]
225 #[inline(always)]
226 pub fn dtog_tx(&self) -> DTOG_TX_R {
227 DTOG_TX_R::new(((self.bits >> 6) & 0x01) != 0)
228 }
229 #[doc = "Bit 7 - Correct Transfer for transmission"]
230 #[inline(always)]
231 pub fn ctr_tx(&self) -> CTR_TX_R {
232 CTR_TX_R::new(((self.bits >> 7) & 0x01) != 0)
233 }
234 #[doc = "Bit 8 - Endpoint kind"]
235 #[inline(always)]
236 pub fn ep_kind(&self) -> EP_KIND_R {
237 EP_KIND_R::new(((self.bits >> 8) & 0x01) != 0)
238 }
239 #[doc = "Bits 9:10 - Endpoint type"]
240 #[inline(always)]
241 pub fn ep_type(&self) -> EP_TYPE_R {
242 EP_TYPE_R::new(((self.bits >> 9) & 0x03) as u8)
243 }
244 #[doc = "Bit 11 - Setup transaction completed"]
245 #[inline(always)]
246 pub fn setup(&self) -> SETUP_R {
247 SETUP_R::new(((self.bits >> 11) & 0x01) != 0)
248 }
249 #[doc = "Bits 12:13 - Status bits, for reception transfers"]
250 #[inline(always)]
251 pub fn stat_rx(&self) -> STAT_RX_R {
252 STAT_RX_R::new(((self.bits >> 12) & 0x03) as u8)
253 }
254 #[doc = "Bit 14 - Data Toggle, for reception transfers"]
255 #[inline(always)]
256 pub fn dtog_rx(&self) -> DTOG_RX_R {
257 DTOG_RX_R::new(((self.bits >> 14) & 0x01) != 0)
258 }
259 #[doc = "Bit 15 - Correct transfer for reception"]
260 #[inline(always)]
261 pub fn ctr_rx(&self) -> CTR_RX_R {
262 CTR_RX_R::new(((self.bits >> 15) & 0x01) != 0)
263 }
264}
265impl W {
266 #[doc = "Bits 0:3 - Endpoint address"]
267 #[inline(always)]
268 pub fn ea(&mut self) -> EA_W {
269 EA_W { w: self }
270 }
271 #[doc = "Bits 4:5 - Status bits, for transmission transfers"]
272 #[inline(always)]
273 pub fn stat_tx(&mut self) -> STAT_TX_W {
274 STAT_TX_W { w: self }
275 }
276 #[doc = "Bit 6 - Data Toggle, for transmission transfers"]
277 #[inline(always)]
278 pub fn dtog_tx(&mut self) -> DTOG_TX_W {
279 DTOG_TX_W { w: self }
280 }
281 #[doc = "Bit 7 - Correct Transfer for transmission"]
282 #[inline(always)]
283 pub fn ctr_tx(&mut self) -> CTR_TX_W {
284 CTR_TX_W { w: self }
285 }
286 #[doc = "Bit 8 - Endpoint kind"]
287 #[inline(always)]
288 pub fn ep_kind(&mut self) -> EP_KIND_W {
289 EP_KIND_W { w: self }
290 }
291 #[doc = "Bits 9:10 - Endpoint type"]
292 #[inline(always)]
293 pub fn ep_type(&mut self) -> EP_TYPE_W {
294 EP_TYPE_W { w: self }
295 }
296 #[doc = "Bit 11 - Setup transaction completed"]
297 #[inline(always)]
298 pub fn setup(&mut self) -> SETUP_W {
299 SETUP_W { w: self }
300 }
301 #[doc = "Bits 12:13 - Status bits, for reception transfers"]
302 #[inline(always)]
303 pub fn stat_rx(&mut self) -> STAT_RX_W {
304 STAT_RX_W { w: self }
305 }
306 #[doc = "Bit 14 - Data Toggle, for reception transfers"]
307 #[inline(always)]
308 pub fn dtog_rx(&mut self) -> DTOG_RX_W {
309 DTOG_RX_W { w: self }
310 }
311 #[doc = "Bit 15 - Correct transfer for reception"]
312 #[inline(always)]
313 pub fn ctr_rx(&mut self) -> CTR_RX_W {
314 CTR_RX_W { w: self }
315 }
316}