stm32f30x/usb_fs/usb_ep1r/
mod.rs1#[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::USB_EP1R {
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 EAR {
47 bits: u8,
48}
49impl EAR {
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 = r" Value of the field"]
57pub struct STAT_TXR {
58 bits: u8,
59}
60impl STAT_TXR {
61 #[doc = r" Value of the field as raw bits"]
62 #[inline]
63 pub fn bits(&self) -> u8 {
64 self.bits
65 }
66}
67#[doc = r" Value of the field"]
68pub struct DTOG_TXR {
69 bits: bool,
70}
71impl DTOG_TXR {
72 #[doc = r" Value of the field as raw bits"]
73 #[inline]
74 pub fn bit(&self) -> bool {
75 self.bits
76 }
77 #[doc = r" Returns `true` if the bit is clear (0)"]
78 #[inline]
79 pub fn bit_is_clear(&self) -> bool {
80 !self.bit()
81 }
82 #[doc = r" Returns `true` if the bit is set (1)"]
83 #[inline]
84 pub fn bit_is_set(&self) -> bool {
85 self.bit()
86 }
87}
88#[doc = r" Value of the field"]
89pub struct CTR_TXR {
90 bits: bool,
91}
92impl CTR_TXR {
93 #[doc = r" Value of the field as raw bits"]
94 #[inline]
95 pub fn bit(&self) -> bool {
96 self.bits
97 }
98 #[doc = r" Returns `true` if the bit is clear (0)"]
99 #[inline]
100 pub fn bit_is_clear(&self) -> bool {
101 !self.bit()
102 }
103 #[doc = r" Returns `true` if the bit is set (1)"]
104 #[inline]
105 pub fn bit_is_set(&self) -> bool {
106 self.bit()
107 }
108}
109#[doc = r" Value of the field"]
110pub struct EP_KINDR {
111 bits: bool,
112}
113impl EP_KINDR {
114 #[doc = r" Value of the field as raw bits"]
115 #[inline]
116 pub fn bit(&self) -> bool {
117 self.bits
118 }
119 #[doc = r" Returns `true` if the bit is clear (0)"]
120 #[inline]
121 pub fn bit_is_clear(&self) -> bool {
122 !self.bit()
123 }
124 #[doc = r" Returns `true` if the bit is set (1)"]
125 #[inline]
126 pub fn bit_is_set(&self) -> bool {
127 self.bit()
128 }
129}
130#[doc = r" Value of the field"]
131pub struct EP_TYPER {
132 bits: u8,
133}
134impl EP_TYPER {
135 #[doc = r" Value of the field as raw bits"]
136 #[inline]
137 pub fn bits(&self) -> u8 {
138 self.bits
139 }
140}
141#[doc = r" Value of the field"]
142pub struct SETUPR {
143 bits: bool,
144}
145impl SETUPR {
146 #[doc = r" Value of the field as raw bits"]
147 #[inline]
148 pub fn bit(&self) -> bool {
149 self.bits
150 }
151 #[doc = r" Returns `true` if the bit is clear (0)"]
152 #[inline]
153 pub fn bit_is_clear(&self) -> bool {
154 !self.bit()
155 }
156 #[doc = r" Returns `true` if the bit is set (1)"]
157 #[inline]
158 pub fn bit_is_set(&self) -> bool {
159 self.bit()
160 }
161}
162#[doc = r" Value of the field"]
163pub struct STAT_RXR {
164 bits: u8,
165}
166impl STAT_RXR {
167 #[doc = r" Value of the field as raw bits"]
168 #[inline]
169 pub fn bits(&self) -> u8 {
170 self.bits
171 }
172}
173#[doc = r" Value of the field"]
174pub struct DTOG_RXR {
175 bits: bool,
176}
177impl DTOG_RXR {
178 #[doc = r" Value of the field as raw bits"]
179 #[inline]
180 pub fn bit(&self) -> bool {
181 self.bits
182 }
183 #[doc = r" Returns `true` if the bit is clear (0)"]
184 #[inline]
185 pub fn bit_is_clear(&self) -> bool {
186 !self.bit()
187 }
188 #[doc = r" Returns `true` if the bit is set (1)"]
189 #[inline]
190 pub fn bit_is_set(&self) -> bool {
191 self.bit()
192 }
193}
194#[doc = r" Value of the field"]
195pub struct CTR_RXR {
196 bits: bool,
197}
198impl CTR_RXR {
199 #[doc = r" Value of the field as raw bits"]
200 #[inline]
201 pub fn bit(&self) -> bool {
202 self.bits
203 }
204 #[doc = r" Returns `true` if the bit is clear (0)"]
205 #[inline]
206 pub fn bit_is_clear(&self) -> bool {
207 !self.bit()
208 }
209 #[doc = r" Returns `true` if the bit is set (1)"]
210 #[inline]
211 pub fn bit_is_set(&self) -> bool {
212 self.bit()
213 }
214}
215#[doc = r" Proxy"]
216pub struct _EAW<'a> {
217 w: &'a mut W,
218}
219impl<'a> _EAW<'a> {
220 #[doc = r" Writes raw bits to the field"]
221 #[inline]
222 pub unsafe fn bits(self, value: u8) -> &'a mut W {
223 const MASK: u8 = 15;
224 const OFFSET: u8 = 0;
225 self.w.bits &= !((MASK as u32) << OFFSET);
226 self.w.bits |= ((value & MASK) as u32) << OFFSET;
227 self.w
228 }
229}
230#[doc = r" Proxy"]
231pub struct _STAT_TXW<'a> {
232 w: &'a mut W,
233}
234impl<'a> _STAT_TXW<'a> {
235 #[doc = r" Writes raw bits to the field"]
236 #[inline]
237 pub unsafe fn bits(self, value: u8) -> &'a mut W {
238 const MASK: u8 = 3;
239 const OFFSET: u8 = 4;
240 self.w.bits &= !((MASK as u32) << OFFSET);
241 self.w.bits |= ((value & MASK) as u32) << OFFSET;
242 self.w
243 }
244}
245#[doc = r" Proxy"]
246pub struct _DTOG_TXW<'a> {
247 w: &'a mut W,
248}
249impl<'a> _DTOG_TXW<'a> {
250 #[doc = r" Sets the field bit"]
251 pub fn set_bit(self) -> &'a mut W {
252 self.bit(true)
253 }
254 #[doc = r" Clears the field bit"]
255 pub fn clear_bit(self) -> &'a mut W {
256 self.bit(false)
257 }
258 #[doc = r" Writes raw bits to the field"]
259 #[inline]
260 pub fn bit(self, value: bool) -> &'a mut W {
261 const MASK: bool = true;
262 const OFFSET: u8 = 6;
263 self.w.bits &= !((MASK as u32) << OFFSET);
264 self.w.bits |= ((value & MASK) as u32) << OFFSET;
265 self.w
266 }
267}
268#[doc = r" Proxy"]
269pub struct _CTR_TXW<'a> {
270 w: &'a mut W,
271}
272impl<'a> _CTR_TXW<'a> {
273 #[doc = r" Sets the field bit"]
274 pub fn set_bit(self) -> &'a mut W {
275 self.bit(true)
276 }
277 #[doc = r" Clears the field bit"]
278 pub fn clear_bit(self) -> &'a mut W {
279 self.bit(false)
280 }
281 #[doc = r" Writes raw bits to the field"]
282 #[inline]
283 pub fn bit(self, value: bool) -> &'a mut W {
284 const MASK: bool = true;
285 const OFFSET: u8 = 7;
286 self.w.bits &= !((MASK as u32) << OFFSET);
287 self.w.bits |= ((value & MASK) as u32) << OFFSET;
288 self.w
289 }
290}
291#[doc = r" Proxy"]
292pub struct _EP_KINDW<'a> {
293 w: &'a mut W,
294}
295impl<'a> _EP_KINDW<'a> {
296 #[doc = r" Sets the field bit"]
297 pub fn set_bit(self) -> &'a mut W {
298 self.bit(true)
299 }
300 #[doc = r" Clears the field bit"]
301 pub fn clear_bit(self) -> &'a mut W {
302 self.bit(false)
303 }
304 #[doc = r" Writes raw bits to the field"]
305 #[inline]
306 pub fn bit(self, value: bool) -> &'a mut W {
307 const MASK: bool = true;
308 const OFFSET: u8 = 8;
309 self.w.bits &= !((MASK as u32) << OFFSET);
310 self.w.bits |= ((value & MASK) as u32) << OFFSET;
311 self.w
312 }
313}
314#[doc = r" Proxy"]
315pub struct _EP_TYPEW<'a> {
316 w: &'a mut W,
317}
318impl<'a> _EP_TYPEW<'a> {
319 #[doc = r" Writes raw bits to the field"]
320 #[inline]
321 pub unsafe fn bits(self, value: u8) -> &'a mut W {
322 const MASK: u8 = 3;
323 const OFFSET: u8 = 9;
324 self.w.bits &= !((MASK as u32) << OFFSET);
325 self.w.bits |= ((value & MASK) as u32) << OFFSET;
326 self.w
327 }
328}
329#[doc = r" Proxy"]
330pub struct _STAT_RXW<'a> {
331 w: &'a mut W,
332}
333impl<'a> _STAT_RXW<'a> {
334 #[doc = r" Writes raw bits to the field"]
335 #[inline]
336 pub unsafe fn bits(self, value: u8) -> &'a mut W {
337 const MASK: u8 = 3;
338 const OFFSET: u8 = 12;
339 self.w.bits &= !((MASK as u32) << OFFSET);
340 self.w.bits |= ((value & MASK) as u32) << OFFSET;
341 self.w
342 }
343}
344#[doc = r" Proxy"]
345pub struct _DTOG_RXW<'a> {
346 w: &'a mut W,
347}
348impl<'a> _DTOG_RXW<'a> {
349 #[doc = r" Sets the field bit"]
350 pub fn set_bit(self) -> &'a mut W {
351 self.bit(true)
352 }
353 #[doc = r" Clears the field bit"]
354 pub fn clear_bit(self) -> &'a mut W {
355 self.bit(false)
356 }
357 #[doc = r" Writes raw bits to the field"]
358 #[inline]
359 pub fn bit(self, value: bool) -> &'a mut W {
360 const MASK: bool = true;
361 const OFFSET: u8 = 14;
362 self.w.bits &= !((MASK as u32) << OFFSET);
363 self.w.bits |= ((value & MASK) as u32) << OFFSET;
364 self.w
365 }
366}
367#[doc = r" Proxy"]
368pub struct _CTR_RXW<'a> {
369 w: &'a mut W,
370}
371impl<'a> _CTR_RXW<'a> {
372 #[doc = r" Sets the field bit"]
373 pub fn set_bit(self) -> &'a mut W {
374 self.bit(true)
375 }
376 #[doc = r" Clears the field bit"]
377 pub fn clear_bit(self) -> &'a mut W {
378 self.bit(false)
379 }
380 #[doc = r" Writes raw bits to the field"]
381 #[inline]
382 pub fn bit(self, value: bool) -> &'a mut W {
383 const MASK: bool = true;
384 const OFFSET: u8 = 15;
385 self.w.bits &= !((MASK as u32) << OFFSET);
386 self.w.bits |= ((value & MASK) as u32) << OFFSET;
387 self.w
388 }
389}
390impl R {
391 #[doc = r" Value of the register as raw bits"]
392 #[inline]
393 pub fn bits(&self) -> u32 {
394 self.bits
395 }
396 #[doc = "Bits 0:3 - Endpoint address"]
397 #[inline]
398 pub fn ea(&self) -> EAR {
399 let bits = {
400 const MASK: u8 = 15;
401 const OFFSET: u8 = 0;
402 ((self.bits >> OFFSET) & MASK as u32) as u8
403 };
404 EAR { bits }
405 }
406 #[doc = "Bits 4:5 - Status bits, for transmission transfers"]
407 #[inline]
408 pub fn stat_tx(&self) -> STAT_TXR {
409 let bits = {
410 const MASK: u8 = 3;
411 const OFFSET: u8 = 4;
412 ((self.bits >> OFFSET) & MASK as u32) as u8
413 };
414 STAT_TXR { bits }
415 }
416 #[doc = "Bit 6 - Data Toggle, for transmission transfers"]
417 #[inline]
418 pub fn dtog_tx(&self) -> DTOG_TXR {
419 let bits = {
420 const MASK: bool = true;
421 const OFFSET: u8 = 6;
422 ((self.bits >> OFFSET) & MASK as u32) != 0
423 };
424 DTOG_TXR { bits }
425 }
426 #[doc = "Bit 7 - Correct Transfer for transmission"]
427 #[inline]
428 pub fn ctr_tx(&self) -> CTR_TXR {
429 let bits = {
430 const MASK: bool = true;
431 const OFFSET: u8 = 7;
432 ((self.bits >> OFFSET) & MASK as u32) != 0
433 };
434 CTR_TXR { bits }
435 }
436 #[doc = "Bit 8 - Endpoint kind"]
437 #[inline]
438 pub fn ep_kind(&self) -> EP_KINDR {
439 let bits = {
440 const MASK: bool = true;
441 const OFFSET: u8 = 8;
442 ((self.bits >> OFFSET) & MASK as u32) != 0
443 };
444 EP_KINDR { bits }
445 }
446 #[doc = "Bits 9:10 - Endpoint type"]
447 #[inline]
448 pub fn ep_type(&self) -> EP_TYPER {
449 let bits = {
450 const MASK: u8 = 3;
451 const OFFSET: u8 = 9;
452 ((self.bits >> OFFSET) & MASK as u32) as u8
453 };
454 EP_TYPER { bits }
455 }
456 #[doc = "Bit 11 - Setup transaction completed"]
457 #[inline]
458 pub fn setup(&self) -> SETUPR {
459 let bits = {
460 const MASK: bool = true;
461 const OFFSET: u8 = 11;
462 ((self.bits >> OFFSET) & MASK as u32) != 0
463 };
464 SETUPR { bits }
465 }
466 #[doc = "Bits 12:13 - Status bits, for reception transfers"]
467 #[inline]
468 pub fn stat_rx(&self) -> STAT_RXR {
469 let bits = {
470 const MASK: u8 = 3;
471 const OFFSET: u8 = 12;
472 ((self.bits >> OFFSET) & MASK as u32) as u8
473 };
474 STAT_RXR { bits }
475 }
476 #[doc = "Bit 14 - Data Toggle, for reception transfers"]
477 #[inline]
478 pub fn dtog_rx(&self) -> DTOG_RXR {
479 let bits = {
480 const MASK: bool = true;
481 const OFFSET: u8 = 14;
482 ((self.bits >> OFFSET) & MASK as u32) != 0
483 };
484 DTOG_RXR { bits }
485 }
486 #[doc = "Bit 15 - Correct transfer for reception"]
487 #[inline]
488 pub fn ctr_rx(&self) -> CTR_RXR {
489 let bits = {
490 const MASK: bool = true;
491 const OFFSET: u8 = 15;
492 ((self.bits >> OFFSET) & MASK as u32) != 0
493 };
494 CTR_RXR { bits }
495 }
496}
497impl W {
498 #[doc = r" Reset value of the register"]
499 #[inline]
500 pub fn reset_value() -> W {
501 W { bits: 0 }
502 }
503 #[doc = r" Writes raw bits to the register"]
504 #[inline]
505 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
506 self.bits = bits;
507 self
508 }
509 #[doc = "Bits 0:3 - Endpoint address"]
510 #[inline]
511 pub fn ea(&mut self) -> _EAW {
512 _EAW { w: self }
513 }
514 #[doc = "Bits 4:5 - Status bits, for transmission transfers"]
515 #[inline]
516 pub fn stat_tx(&mut self) -> _STAT_TXW {
517 _STAT_TXW { w: self }
518 }
519 #[doc = "Bit 6 - Data Toggle, for transmission transfers"]
520 #[inline]
521 pub fn dtog_tx(&mut self) -> _DTOG_TXW {
522 _DTOG_TXW { w: self }
523 }
524 #[doc = "Bit 7 - Correct Transfer for transmission"]
525 #[inline]
526 pub fn ctr_tx(&mut self) -> _CTR_TXW {
527 _CTR_TXW { w: self }
528 }
529 #[doc = "Bit 8 - Endpoint kind"]
530 #[inline]
531 pub fn ep_kind(&mut self) -> _EP_KINDW {
532 _EP_KINDW { w: self }
533 }
534 #[doc = "Bits 9:10 - Endpoint type"]
535 #[inline]
536 pub fn ep_type(&mut self) -> _EP_TYPEW {
537 _EP_TYPEW { w: self }
538 }
539 #[doc = "Bits 12:13 - Status bits, for reception transfers"]
540 #[inline]
541 pub fn stat_rx(&mut self) -> _STAT_RXW {
542 _STAT_RXW { w: self }
543 }
544 #[doc = "Bit 14 - Data Toggle, for reception transfers"]
545 #[inline]
546 pub fn dtog_rx(&mut self) -> _DTOG_RXW {
547 _DTOG_RXW { w: self }
548 }
549 #[doc = "Bit 15 - Correct transfer for reception"]
550 #[inline]
551 pub fn ctr_rx(&mut self) -> _CTR_RXW {
552 _CTR_RXW { w: self }
553 }
554}