1#[doc = "Register `DEVCMDSTAT` reader"]
2pub struct R(crate::pac::generic::R<DEVCMDSTAT_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::pac::generic::R<DEVCMDSTAT_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::pac::generic::R<DEVCMDSTAT_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::pac::generic::R<DEVCMDSTAT_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `DEVCMDSTAT` writer"]
17pub struct W(crate::pac::generic::W<DEVCMDSTAT_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::pac::generic::W<DEVCMDSTAT_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::pac::generic::W<DEVCMDSTAT_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::pac::generic::W<DEVCMDSTAT_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `DEV_ADDR` reader - USB device address. After bus reset, the address is reset to 0x00. If the enable bit is set, the device will respond on packets for function address DEV_ADDR. When receiving a SetAddress Control Request from the USB host, software must program the new address before completing the status phase of the SetAddress Control Request."]
38pub struct DEV_ADDR_R(crate::pac::generic::FieldReader<u8, u8>);
39impl DEV_ADDR_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: u8) -> Self {
42 DEV_ADDR_R(crate::pac::generic::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for DEV_ADDR_R {
46 type Target = crate::pac::generic::FieldReader<u8, u8>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `DEV_ADDR` writer - USB device address. After bus reset, the address is reset to 0x00. If the enable bit is set, the device will respond on packets for function address DEV_ADDR. When receiving a SetAddress Control Request from the USB host, software must program the new address before completing the status phase of the SetAddress Control Request."]
53pub struct DEV_ADDR_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> DEV_ADDR_W<'a> {
57 #[doc = r"Writes raw bits to the field"]
58 #[inline(always)]
59 pub unsafe fn bits(self, value: u8) -> &'a mut W {
60 self.w.bits = (self.w.bits & !0x7f) | (value as u32 & 0x7f);
61 self.w
62 }
63}
64#[doc = "Field `DEV_EN` reader - USB device enable. If this bit is set, the HW will start responding on packets for function address DEV_ADDR."]
65pub struct DEV_EN_R(crate::pac::generic::FieldReader<bool, bool>);
66impl DEV_EN_R {
67 #[inline(always)]
68 pub(crate) fn new(bits: bool) -> Self {
69 DEV_EN_R(crate::pac::generic::FieldReader::new(bits))
70 }
71}
72impl core::ops::Deref for DEV_EN_R {
73 type Target = crate::pac::generic::FieldReader<bool, bool>;
74 #[inline(always)]
75 fn deref(&self) -> &Self::Target {
76 &self.0
77 }
78}
79#[doc = "Field `DEV_EN` writer - USB device enable. If this bit is set, the HW will start responding on packets for function address DEV_ADDR."]
80pub struct DEV_EN_W<'a> {
81 w: &'a mut W,
82}
83impl<'a> DEV_EN_W<'a> {
84 #[doc = r"Sets the field bit"]
85 #[inline(always)]
86 pub fn set_bit(self) -> &'a mut W {
87 self.bit(true)
88 }
89 #[doc = r"Clears the field bit"]
90 #[inline(always)]
91 pub fn clear_bit(self) -> &'a mut W {
92 self.bit(false)
93 }
94 #[doc = r"Writes raw bits to the field"]
95 #[inline(always)]
96 pub fn bit(self, value: bool) -> &'a mut W {
97 self.w.bits = (self.w.bits & !(0x01 << 7)) | ((value as u32 & 0x01) << 7);
98 self.w
99 }
100}
101#[doc = "Field `SETUP` reader - SETUP token received. If a SETUP token is received and acknowledged by the device, this bit is set. As long as this bit is set all received IN and OUT tokens will be NAKed by HW. SW must clear this bit by writing a one. If this bit is zero, HW will handle the tokens to the CTRL EP0 as indicated by the CTRL EP0 IN and OUT data information programmed by SW."]
102pub struct SETUP_R(crate::pac::generic::FieldReader<bool, bool>);
103impl SETUP_R {
104 #[inline(always)]
105 pub(crate) fn new(bits: bool) -> Self {
106 SETUP_R(crate::pac::generic::FieldReader::new(bits))
107 }
108}
109impl core::ops::Deref for SETUP_R {
110 type Target = crate::pac::generic::FieldReader<bool, bool>;
111 #[inline(always)]
112 fn deref(&self) -> &Self::Target {
113 &self.0
114 }
115}
116#[doc = "Field `SETUP` writer - SETUP token received. If a SETUP token is received and acknowledged by the device, this bit is set. As long as this bit is set all received IN and OUT tokens will be NAKed by HW. SW must clear this bit by writing a one. If this bit is zero, HW will handle the tokens to the CTRL EP0 as indicated by the CTRL EP0 IN and OUT data information programmed by SW."]
117pub struct SETUP_W<'a> {
118 w: &'a mut W,
119}
120impl<'a> SETUP_W<'a> {
121 #[doc = r"Sets the field bit"]
122 #[inline(always)]
123 pub fn set_bit(self) -> &'a mut W {
124 self.bit(true)
125 }
126 #[doc = r"Clears the field bit"]
127 #[inline(always)]
128 pub fn clear_bit(self) -> &'a mut W {
129 self.bit(false)
130 }
131 #[doc = r"Writes raw bits to the field"]
132 #[inline(always)]
133 pub fn bit(self, value: bool) -> &'a mut W {
134 self.w.bits = (self.w.bits & !(0x01 << 8)) | ((value as u32 & 0x01) << 8);
135 self.w
136 }
137}
138#[doc = "Forces the NEEDCLK output to always be on:\n\nValue on reset: 0"]
139#[derive(Clone, Copy, Debug, PartialEq)]
140pub enum FORCE_NEEDCLK_A {
141 #[doc = "0: USB_NEEDCLK has normal function."]
142 NORMAL = 0,
143 #[doc = "1: USB_NEEDCLK always 1. Clock will not be stopped in case of suspend."]
144 ALWAYS_ON = 1,
145}
146impl From<FORCE_NEEDCLK_A> for bool {
147 #[inline(always)]
148 fn from(variant: FORCE_NEEDCLK_A) -> Self {
149 variant as u8 != 0
150 }
151}
152#[doc = "Field `FORCE_NEEDCLK` reader - Forces the NEEDCLK output to always be on:"]
153pub struct FORCE_NEEDCLK_R(crate::pac::generic::FieldReader<bool, FORCE_NEEDCLK_A>);
154impl FORCE_NEEDCLK_R {
155 #[inline(always)]
156 pub(crate) fn new(bits: bool) -> Self {
157 FORCE_NEEDCLK_R(crate::pac::generic::FieldReader::new(bits))
158 }
159 #[doc = r"Get enumerated values variant"]
160 #[inline(always)]
161 pub fn variant(&self) -> FORCE_NEEDCLK_A {
162 match self.bits {
163 false => FORCE_NEEDCLK_A::NORMAL,
164 true => FORCE_NEEDCLK_A::ALWAYS_ON,
165 }
166 }
167 #[doc = "Checks if the value of the field is `NORMAL`"]
168 #[inline(always)]
169 pub fn is_normal(&self) -> bool {
170 **self == FORCE_NEEDCLK_A::NORMAL
171 }
172 #[doc = "Checks if the value of the field is `ALWAYS_ON`"]
173 #[inline(always)]
174 pub fn is_always_on(&self) -> bool {
175 **self == FORCE_NEEDCLK_A::ALWAYS_ON
176 }
177}
178impl core::ops::Deref for FORCE_NEEDCLK_R {
179 type Target = crate::pac::generic::FieldReader<bool, FORCE_NEEDCLK_A>;
180 #[inline(always)]
181 fn deref(&self) -> &Self::Target {
182 &self.0
183 }
184}
185#[doc = "Field `FORCE_NEEDCLK` writer - Forces the NEEDCLK output to always be on:"]
186pub struct FORCE_NEEDCLK_W<'a> {
187 w: &'a mut W,
188}
189impl<'a> FORCE_NEEDCLK_W<'a> {
190 #[doc = r"Writes `variant` to the field"]
191 #[inline(always)]
192 pub fn variant(self, variant: FORCE_NEEDCLK_A) -> &'a mut W {
193 self.bit(variant.into())
194 }
195 #[doc = "USB_NEEDCLK has normal function."]
196 #[inline(always)]
197 pub fn normal(self) -> &'a mut W {
198 self.variant(FORCE_NEEDCLK_A::NORMAL)
199 }
200 #[doc = "USB_NEEDCLK always 1. Clock will not be stopped in case of suspend."]
201 #[inline(always)]
202 pub fn always_on(self) -> &'a mut W {
203 self.variant(FORCE_NEEDCLK_A::ALWAYS_ON)
204 }
205 #[doc = r"Sets the field bit"]
206 #[inline(always)]
207 pub fn set_bit(self) -> &'a mut W {
208 self.bit(true)
209 }
210 #[doc = r"Clears the field bit"]
211 #[inline(always)]
212 pub fn clear_bit(self) -> &'a mut W {
213 self.bit(false)
214 }
215 #[doc = r"Writes raw bits to the field"]
216 #[inline(always)]
217 pub fn bit(self, value: bool) -> &'a mut W {
218 self.w.bits = (self.w.bits & !(0x01 << 9)) | ((value as u32 & 0x01) << 9);
219 self.w
220 }
221}
222#[doc = "LPM Supported:\n\nValue on reset: 1"]
223#[derive(Clone, Copy, Debug, PartialEq)]
224pub enum LPM_SUP_A {
225 #[doc = "0: LPM not supported."]
226 NO = 0,
227 #[doc = "1: LPM supported."]
228 YES = 1,
229}
230impl From<LPM_SUP_A> for bool {
231 #[inline(always)]
232 fn from(variant: LPM_SUP_A) -> Self {
233 variant as u8 != 0
234 }
235}
236#[doc = "Field `LPM_SUP` reader - LPM Supported:"]
237pub struct LPM_SUP_R(crate::pac::generic::FieldReader<bool, LPM_SUP_A>);
238impl LPM_SUP_R {
239 #[inline(always)]
240 pub(crate) fn new(bits: bool) -> Self {
241 LPM_SUP_R(crate::pac::generic::FieldReader::new(bits))
242 }
243 #[doc = r"Get enumerated values variant"]
244 #[inline(always)]
245 pub fn variant(&self) -> LPM_SUP_A {
246 match self.bits {
247 false => LPM_SUP_A::NO,
248 true => LPM_SUP_A::YES,
249 }
250 }
251 #[doc = "Checks if the value of the field is `NO`"]
252 #[inline(always)]
253 pub fn is_no(&self) -> bool {
254 **self == LPM_SUP_A::NO
255 }
256 #[doc = "Checks if the value of the field is `YES`"]
257 #[inline(always)]
258 pub fn is_yes(&self) -> bool {
259 **self == LPM_SUP_A::YES
260 }
261}
262impl core::ops::Deref for LPM_SUP_R {
263 type Target = crate::pac::generic::FieldReader<bool, LPM_SUP_A>;
264 #[inline(always)]
265 fn deref(&self) -> &Self::Target {
266 &self.0
267 }
268}
269#[doc = "Field `LPM_SUP` writer - LPM Supported:"]
270pub struct LPM_SUP_W<'a> {
271 w: &'a mut W,
272}
273impl<'a> LPM_SUP_W<'a> {
274 #[doc = r"Writes `variant` to the field"]
275 #[inline(always)]
276 pub fn variant(self, variant: LPM_SUP_A) -> &'a mut W {
277 self.bit(variant.into())
278 }
279 #[doc = "LPM not supported."]
280 #[inline(always)]
281 pub fn no(self) -> &'a mut W {
282 self.variant(LPM_SUP_A::NO)
283 }
284 #[doc = "LPM supported."]
285 #[inline(always)]
286 pub fn yes(self) -> &'a mut W {
287 self.variant(LPM_SUP_A::YES)
288 }
289 #[doc = r"Sets the field bit"]
290 #[inline(always)]
291 pub fn set_bit(self) -> &'a mut W {
292 self.bit(true)
293 }
294 #[doc = r"Clears the field bit"]
295 #[inline(always)]
296 pub fn clear_bit(self) -> &'a mut W {
297 self.bit(false)
298 }
299 #[doc = r"Writes raw bits to the field"]
300 #[inline(always)]
301 pub fn bit(self, value: bool) -> &'a mut W {
302 self.w.bits = (self.w.bits & !(0x01 << 11)) | ((value as u32 & 0x01) << 11);
303 self.w
304 }
305}
306#[doc = "Interrupt on NAK for interrupt and bulk OUT EP\n\nValue on reset: 0"]
307#[derive(Clone, Copy, Debug, PartialEq)]
308pub enum INTONNAK_AO_A {
309 #[doc = "0: Only acknowledged packets generate an interrupt"]
310 DISABLED = 0,
311 #[doc = "1: Both acknowledged and NAKed packets generate interrupts."]
312 ENABLED = 1,
313}
314impl From<INTONNAK_AO_A> for bool {
315 #[inline(always)]
316 fn from(variant: INTONNAK_AO_A) -> Self {
317 variant as u8 != 0
318 }
319}
320#[doc = "Field `INTONNAK_AO` reader - Interrupt on NAK for interrupt and bulk OUT EP"]
321pub struct INTONNAK_AO_R(crate::pac::generic::FieldReader<bool, INTONNAK_AO_A>);
322impl INTONNAK_AO_R {
323 #[inline(always)]
324 pub(crate) fn new(bits: bool) -> Self {
325 INTONNAK_AO_R(crate::pac::generic::FieldReader::new(bits))
326 }
327 #[doc = r"Get enumerated values variant"]
328 #[inline(always)]
329 pub fn variant(&self) -> INTONNAK_AO_A {
330 match self.bits {
331 false => INTONNAK_AO_A::DISABLED,
332 true => INTONNAK_AO_A::ENABLED,
333 }
334 }
335 #[doc = "Checks if the value of the field is `DISABLED`"]
336 #[inline(always)]
337 pub fn is_disabled(&self) -> bool {
338 **self == INTONNAK_AO_A::DISABLED
339 }
340 #[doc = "Checks if the value of the field is `ENABLED`"]
341 #[inline(always)]
342 pub fn is_enabled(&self) -> bool {
343 **self == INTONNAK_AO_A::ENABLED
344 }
345}
346impl core::ops::Deref for INTONNAK_AO_R {
347 type Target = crate::pac::generic::FieldReader<bool, INTONNAK_AO_A>;
348 #[inline(always)]
349 fn deref(&self) -> &Self::Target {
350 &self.0
351 }
352}
353#[doc = "Field `INTONNAK_AO` writer - Interrupt on NAK for interrupt and bulk OUT EP"]
354pub struct INTONNAK_AO_W<'a> {
355 w: &'a mut W,
356}
357impl<'a> INTONNAK_AO_W<'a> {
358 #[doc = r"Writes `variant` to the field"]
359 #[inline(always)]
360 pub fn variant(self, variant: INTONNAK_AO_A) -> &'a mut W {
361 self.bit(variant.into())
362 }
363 #[doc = "Only acknowledged packets generate an interrupt"]
364 #[inline(always)]
365 pub fn disabled(self) -> &'a mut W {
366 self.variant(INTONNAK_AO_A::DISABLED)
367 }
368 #[doc = "Both acknowledged and NAKed packets generate interrupts."]
369 #[inline(always)]
370 pub fn enabled(self) -> &'a mut W {
371 self.variant(INTONNAK_AO_A::ENABLED)
372 }
373 #[doc = r"Sets the field bit"]
374 #[inline(always)]
375 pub fn set_bit(self) -> &'a mut W {
376 self.bit(true)
377 }
378 #[doc = r"Clears the field bit"]
379 #[inline(always)]
380 pub fn clear_bit(self) -> &'a mut W {
381 self.bit(false)
382 }
383 #[doc = r"Writes raw bits to the field"]
384 #[inline(always)]
385 pub fn bit(self, value: bool) -> &'a mut W {
386 self.w.bits = (self.w.bits & !(0x01 << 12)) | ((value as u32 & 0x01) << 12);
387 self.w
388 }
389}
390#[doc = "Interrupt on NAK for interrupt and bulk IN EP\n\nValue on reset: 0"]
391#[derive(Clone, Copy, Debug, PartialEq)]
392pub enum INTONNAK_AI_A {
393 #[doc = "0: Only acknowledged packets generate an interrupt"]
394 DISABLED = 0,
395 #[doc = "1: Both acknowledged and NAKed packets generate interrupts."]
396 ENABLED = 1,
397}
398impl From<INTONNAK_AI_A> for bool {
399 #[inline(always)]
400 fn from(variant: INTONNAK_AI_A) -> Self {
401 variant as u8 != 0
402 }
403}
404#[doc = "Field `INTONNAK_AI` reader - Interrupt on NAK for interrupt and bulk IN EP"]
405pub struct INTONNAK_AI_R(crate::pac::generic::FieldReader<bool, INTONNAK_AI_A>);
406impl INTONNAK_AI_R {
407 #[inline(always)]
408 pub(crate) fn new(bits: bool) -> Self {
409 INTONNAK_AI_R(crate::pac::generic::FieldReader::new(bits))
410 }
411 #[doc = r"Get enumerated values variant"]
412 #[inline(always)]
413 pub fn variant(&self) -> INTONNAK_AI_A {
414 match self.bits {
415 false => INTONNAK_AI_A::DISABLED,
416 true => INTONNAK_AI_A::ENABLED,
417 }
418 }
419 #[doc = "Checks if the value of the field is `DISABLED`"]
420 #[inline(always)]
421 pub fn is_disabled(&self) -> bool {
422 **self == INTONNAK_AI_A::DISABLED
423 }
424 #[doc = "Checks if the value of the field is `ENABLED`"]
425 #[inline(always)]
426 pub fn is_enabled(&self) -> bool {
427 **self == INTONNAK_AI_A::ENABLED
428 }
429}
430impl core::ops::Deref for INTONNAK_AI_R {
431 type Target = crate::pac::generic::FieldReader<bool, INTONNAK_AI_A>;
432 #[inline(always)]
433 fn deref(&self) -> &Self::Target {
434 &self.0
435 }
436}
437#[doc = "Field `INTONNAK_AI` writer - Interrupt on NAK for interrupt and bulk IN EP"]
438pub struct INTONNAK_AI_W<'a> {
439 w: &'a mut W,
440}
441impl<'a> INTONNAK_AI_W<'a> {
442 #[doc = r"Writes `variant` to the field"]
443 #[inline(always)]
444 pub fn variant(self, variant: INTONNAK_AI_A) -> &'a mut W {
445 self.bit(variant.into())
446 }
447 #[doc = "Only acknowledged packets generate an interrupt"]
448 #[inline(always)]
449 pub fn disabled(self) -> &'a mut W {
450 self.variant(INTONNAK_AI_A::DISABLED)
451 }
452 #[doc = "Both acknowledged and NAKed packets generate interrupts."]
453 #[inline(always)]
454 pub fn enabled(self) -> &'a mut W {
455 self.variant(INTONNAK_AI_A::ENABLED)
456 }
457 #[doc = r"Sets the field bit"]
458 #[inline(always)]
459 pub fn set_bit(self) -> &'a mut W {
460 self.bit(true)
461 }
462 #[doc = r"Clears the field bit"]
463 #[inline(always)]
464 pub fn clear_bit(self) -> &'a mut W {
465 self.bit(false)
466 }
467 #[doc = r"Writes raw bits to the field"]
468 #[inline(always)]
469 pub fn bit(self, value: bool) -> &'a mut W {
470 self.w.bits = (self.w.bits & !(0x01 << 13)) | ((value as u32 & 0x01) << 13);
471 self.w
472 }
473}
474#[doc = "Interrupt on NAK for control OUT EP\n\nValue on reset: 0"]
475#[derive(Clone, Copy, Debug, PartialEq)]
476pub enum INTONNAK_CO_A {
477 #[doc = "0: Only acknowledged packets generate an interrupt"]
478 DISABLED = 0,
479 #[doc = "1: Both acknowledged and NAKed packets generate interrupts."]
480 ENABLED = 1,
481}
482impl From<INTONNAK_CO_A> for bool {
483 #[inline(always)]
484 fn from(variant: INTONNAK_CO_A) -> Self {
485 variant as u8 != 0
486 }
487}
488#[doc = "Field `INTONNAK_CO` reader - Interrupt on NAK for control OUT EP"]
489pub struct INTONNAK_CO_R(crate::pac::generic::FieldReader<bool, INTONNAK_CO_A>);
490impl INTONNAK_CO_R {
491 #[inline(always)]
492 pub(crate) fn new(bits: bool) -> Self {
493 INTONNAK_CO_R(crate::pac::generic::FieldReader::new(bits))
494 }
495 #[doc = r"Get enumerated values variant"]
496 #[inline(always)]
497 pub fn variant(&self) -> INTONNAK_CO_A {
498 match self.bits {
499 false => INTONNAK_CO_A::DISABLED,
500 true => INTONNAK_CO_A::ENABLED,
501 }
502 }
503 #[doc = "Checks if the value of the field is `DISABLED`"]
504 #[inline(always)]
505 pub fn is_disabled(&self) -> bool {
506 **self == INTONNAK_CO_A::DISABLED
507 }
508 #[doc = "Checks if the value of the field is `ENABLED`"]
509 #[inline(always)]
510 pub fn is_enabled(&self) -> bool {
511 **self == INTONNAK_CO_A::ENABLED
512 }
513}
514impl core::ops::Deref for INTONNAK_CO_R {
515 type Target = crate::pac::generic::FieldReader<bool, INTONNAK_CO_A>;
516 #[inline(always)]
517 fn deref(&self) -> &Self::Target {
518 &self.0
519 }
520}
521#[doc = "Field `INTONNAK_CO` writer - Interrupt on NAK for control OUT EP"]
522pub struct INTONNAK_CO_W<'a> {
523 w: &'a mut W,
524}
525impl<'a> INTONNAK_CO_W<'a> {
526 #[doc = r"Writes `variant` to the field"]
527 #[inline(always)]
528 pub fn variant(self, variant: INTONNAK_CO_A) -> &'a mut W {
529 self.bit(variant.into())
530 }
531 #[doc = "Only acknowledged packets generate an interrupt"]
532 #[inline(always)]
533 pub fn disabled(self) -> &'a mut W {
534 self.variant(INTONNAK_CO_A::DISABLED)
535 }
536 #[doc = "Both acknowledged and NAKed packets generate interrupts."]
537 #[inline(always)]
538 pub fn enabled(self) -> &'a mut W {
539 self.variant(INTONNAK_CO_A::ENABLED)
540 }
541 #[doc = r"Sets the field bit"]
542 #[inline(always)]
543 pub fn set_bit(self) -> &'a mut W {
544 self.bit(true)
545 }
546 #[doc = r"Clears the field bit"]
547 #[inline(always)]
548 pub fn clear_bit(self) -> &'a mut W {
549 self.bit(false)
550 }
551 #[doc = r"Writes raw bits to the field"]
552 #[inline(always)]
553 pub fn bit(self, value: bool) -> &'a mut W {
554 self.w.bits = (self.w.bits & !(0x01 << 14)) | ((value as u32 & 0x01) << 14);
555 self.w
556 }
557}
558#[doc = "Interrupt on NAK for control IN EP\n\nValue on reset: 0"]
559#[derive(Clone, Copy, Debug, PartialEq)]
560pub enum INTONNAK_CI_A {
561 #[doc = "0: Only acknowledged packets generate an interrupt"]
562 DISABLED = 0,
563 #[doc = "1: Both acknowledged and NAKed packets generate interrupts."]
564 ENABLED = 1,
565}
566impl From<INTONNAK_CI_A> for bool {
567 #[inline(always)]
568 fn from(variant: INTONNAK_CI_A) -> Self {
569 variant as u8 != 0
570 }
571}
572#[doc = "Field `INTONNAK_CI` reader - Interrupt on NAK for control IN EP"]
573pub struct INTONNAK_CI_R(crate::pac::generic::FieldReader<bool, INTONNAK_CI_A>);
574impl INTONNAK_CI_R {
575 #[inline(always)]
576 pub(crate) fn new(bits: bool) -> Self {
577 INTONNAK_CI_R(crate::pac::generic::FieldReader::new(bits))
578 }
579 #[doc = r"Get enumerated values variant"]
580 #[inline(always)]
581 pub fn variant(&self) -> INTONNAK_CI_A {
582 match self.bits {
583 false => INTONNAK_CI_A::DISABLED,
584 true => INTONNAK_CI_A::ENABLED,
585 }
586 }
587 #[doc = "Checks if the value of the field is `DISABLED`"]
588 #[inline(always)]
589 pub fn is_disabled(&self) -> bool {
590 **self == INTONNAK_CI_A::DISABLED
591 }
592 #[doc = "Checks if the value of the field is `ENABLED`"]
593 #[inline(always)]
594 pub fn is_enabled(&self) -> bool {
595 **self == INTONNAK_CI_A::ENABLED
596 }
597}
598impl core::ops::Deref for INTONNAK_CI_R {
599 type Target = crate::pac::generic::FieldReader<bool, INTONNAK_CI_A>;
600 #[inline(always)]
601 fn deref(&self) -> &Self::Target {
602 &self.0
603 }
604}
605#[doc = "Field `INTONNAK_CI` writer - Interrupt on NAK for control IN EP"]
606pub struct INTONNAK_CI_W<'a> {
607 w: &'a mut W,
608}
609impl<'a> INTONNAK_CI_W<'a> {
610 #[doc = r"Writes `variant` to the field"]
611 #[inline(always)]
612 pub fn variant(self, variant: INTONNAK_CI_A) -> &'a mut W {
613 self.bit(variant.into())
614 }
615 #[doc = "Only acknowledged packets generate an interrupt"]
616 #[inline(always)]
617 pub fn disabled(self) -> &'a mut W {
618 self.variant(INTONNAK_CI_A::DISABLED)
619 }
620 #[doc = "Both acknowledged and NAKed packets generate interrupts."]
621 #[inline(always)]
622 pub fn enabled(self) -> &'a mut W {
623 self.variant(INTONNAK_CI_A::ENABLED)
624 }
625 #[doc = r"Sets the field bit"]
626 #[inline(always)]
627 pub fn set_bit(self) -> &'a mut W {
628 self.bit(true)
629 }
630 #[doc = r"Clears the field bit"]
631 #[inline(always)]
632 pub fn clear_bit(self) -> &'a mut W {
633 self.bit(false)
634 }
635 #[doc = r"Writes raw bits to the field"]
636 #[inline(always)]
637 pub fn bit(self, value: bool) -> &'a mut W {
638 self.w.bits = (self.w.bits & !(0x01 << 15)) | ((value as u32 & 0x01) << 15);
639 self.w
640 }
641}
642#[doc = "Field `DCON` reader - Device status - connect. The connect bit must be set by SW to indicate that the device must signal a connect. The pull-up resistor on USB_DP will be enabled when this bit is set and the VBUSDEBOUNCED bit is one."]
643pub struct DCON_R(crate::pac::generic::FieldReader<bool, bool>);
644impl DCON_R {
645 #[inline(always)]
646 pub(crate) fn new(bits: bool) -> Self {
647 DCON_R(crate::pac::generic::FieldReader::new(bits))
648 }
649}
650impl core::ops::Deref for DCON_R {
651 type Target = crate::pac::generic::FieldReader<bool, bool>;
652 #[inline(always)]
653 fn deref(&self) -> &Self::Target {
654 &self.0
655 }
656}
657#[doc = "Field `DCON` writer - Device status - connect. The connect bit must be set by SW to indicate that the device must signal a connect. The pull-up resistor on USB_DP will be enabled when this bit is set and the VBUSDEBOUNCED bit is one."]
658pub struct DCON_W<'a> {
659 w: &'a mut W,
660}
661impl<'a> DCON_W<'a> {
662 #[doc = r"Sets the field bit"]
663 #[inline(always)]
664 pub fn set_bit(self) -> &'a mut W {
665 self.bit(true)
666 }
667 #[doc = r"Clears the field bit"]
668 #[inline(always)]
669 pub fn clear_bit(self) -> &'a mut W {
670 self.bit(false)
671 }
672 #[doc = r"Writes raw bits to the field"]
673 #[inline(always)]
674 pub fn bit(self, value: bool) -> &'a mut W {
675 self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
676 self.w
677 }
678}
679#[doc = "Field `DSUS` reader - Device status - suspend. The suspend bit indicates the current suspend state. It is set to 1 when the device hasn't seen any activity on its upstream port for more than 3 milliseconds. It is reset to 0 on any activity. When the device is suspended (Suspend bit DSUS = 1) and the software writes a 0 to it, the device will generate a remote wake-up. This will only happen when the device is connected (Connect bit = 1). When the device is not connected or not suspended, a writing a 0 has no effect. Writing a 1 never has an effect."]
680pub struct DSUS_R(crate::pac::generic::FieldReader<bool, bool>);
681impl DSUS_R {
682 #[inline(always)]
683 pub(crate) fn new(bits: bool) -> Self {
684 DSUS_R(crate::pac::generic::FieldReader::new(bits))
685 }
686}
687impl core::ops::Deref for DSUS_R {
688 type Target = crate::pac::generic::FieldReader<bool, bool>;
689 #[inline(always)]
690 fn deref(&self) -> &Self::Target {
691 &self.0
692 }
693}
694#[doc = "Field `DSUS` writer - Device status - suspend. The suspend bit indicates the current suspend state. It is set to 1 when the device hasn't seen any activity on its upstream port for more than 3 milliseconds. It is reset to 0 on any activity. When the device is suspended (Suspend bit DSUS = 1) and the software writes a 0 to it, the device will generate a remote wake-up. This will only happen when the device is connected (Connect bit = 1). When the device is not connected or not suspended, a writing a 0 has no effect. Writing a 1 never has an effect."]
695pub struct DSUS_W<'a> {
696 w: &'a mut W,
697}
698impl<'a> DSUS_W<'a> {
699 #[doc = r"Sets the field bit"]
700 #[inline(always)]
701 pub fn set_bit(self) -> &'a mut W {
702 self.bit(true)
703 }
704 #[doc = r"Clears the field bit"]
705 #[inline(always)]
706 pub fn clear_bit(self) -> &'a mut W {
707 self.bit(false)
708 }
709 #[doc = r"Writes raw bits to the field"]
710 #[inline(always)]
711 pub fn bit(self, value: bool) -> &'a mut W {
712 self.w.bits = (self.w.bits & !(0x01 << 17)) | ((value as u32 & 0x01) << 17);
713 self.w
714 }
715}
716#[doc = "Field `LPM_SUS` reader - Device status - LPM Suspend. This bit represents the current LPM suspend state. It is set to 1 by HW when the device has acknowledged the LPM request from the USB host and the Token Retry Time of 10 ms has elapsed. When the device is in the LPM suspended state (LPM suspend bit = 1) and the software writes a zero to this bit, the device will generate a remote walk-up. Software can only write a zero to this bit when the LPM_REWP bit is set to 1. HW resets this bit when it receives a host initiated resume. HW only updates the LPM_SUS bit when the LPM_SUPP bit is equal to one."]
717pub struct LPM_SUS_R(crate::pac::generic::FieldReader<bool, bool>);
718impl LPM_SUS_R {
719 #[inline(always)]
720 pub(crate) fn new(bits: bool) -> Self {
721 LPM_SUS_R(crate::pac::generic::FieldReader::new(bits))
722 }
723}
724impl core::ops::Deref for LPM_SUS_R {
725 type Target = crate::pac::generic::FieldReader<bool, bool>;
726 #[inline(always)]
727 fn deref(&self) -> &Self::Target {
728 &self.0
729 }
730}
731#[doc = "Field `LPM_SUS` writer - Device status - LPM Suspend. This bit represents the current LPM suspend state. It is set to 1 by HW when the device has acknowledged the LPM request from the USB host and the Token Retry Time of 10 ms has elapsed. When the device is in the LPM suspended state (LPM suspend bit = 1) and the software writes a zero to this bit, the device will generate a remote walk-up. Software can only write a zero to this bit when the LPM_REWP bit is set to 1. HW resets this bit when it receives a host initiated resume. HW only updates the LPM_SUS bit when the LPM_SUPP bit is equal to one."]
732pub struct LPM_SUS_W<'a> {
733 w: &'a mut W,
734}
735impl<'a> LPM_SUS_W<'a> {
736 #[doc = r"Sets the field bit"]
737 #[inline(always)]
738 pub fn set_bit(self) -> &'a mut W {
739 self.bit(true)
740 }
741 #[doc = r"Clears the field bit"]
742 #[inline(always)]
743 pub fn clear_bit(self) -> &'a mut W {
744 self.bit(false)
745 }
746 #[doc = r"Writes raw bits to the field"]
747 #[inline(always)]
748 pub fn bit(self, value: bool) -> &'a mut W {
749 self.w.bits = (self.w.bits & !(0x01 << 19)) | ((value as u32 & 0x01) << 19);
750 self.w
751 }
752}
753#[doc = "Field `LPM_REWP` reader - LPM Remote Wake-up Enabled by USB host. HW sets this bit to one when the bRemoteWake bit in the LPM extended token is set to 1. HW will reset this bit to 0 when it receives the host initiated LPM resume, when a remote wake-up is sent by the device or when a USB bus reset is received. Software can use this bit to check if the remote wake-up feature is enabled by the host for the LPM transaction."]
754pub struct LPM_REWP_R(crate::pac::generic::FieldReader<bool, bool>);
755impl LPM_REWP_R {
756 #[inline(always)]
757 pub(crate) fn new(bits: bool) -> Self {
758 LPM_REWP_R(crate::pac::generic::FieldReader::new(bits))
759 }
760}
761impl core::ops::Deref for LPM_REWP_R {
762 type Target = crate::pac::generic::FieldReader<bool, bool>;
763 #[inline(always)]
764 fn deref(&self) -> &Self::Target {
765 &self.0
766 }
767}
768#[doc = "Field `DCON_C` reader - Device status - connect change. The Connect Change bit is set when the device's pull-up resistor is disconnected because VBus disappeared. The bit is reset by writing a one to it."]
769pub struct DCON_C_R(crate::pac::generic::FieldReader<bool, bool>);
770impl DCON_C_R {
771 #[inline(always)]
772 pub(crate) fn new(bits: bool) -> Self {
773 DCON_C_R(crate::pac::generic::FieldReader::new(bits))
774 }
775}
776impl core::ops::Deref for DCON_C_R {
777 type Target = crate::pac::generic::FieldReader<bool, bool>;
778 #[inline(always)]
779 fn deref(&self) -> &Self::Target {
780 &self.0
781 }
782}
783#[doc = "Field `DCON_C` writer - Device status - connect change. The Connect Change bit is set when the device's pull-up resistor is disconnected because VBus disappeared. The bit is reset by writing a one to it."]
784pub struct DCON_C_W<'a> {
785 w: &'a mut W,
786}
787impl<'a> DCON_C_W<'a> {
788 #[doc = r"Sets the field bit"]
789 #[inline(always)]
790 pub fn set_bit(self) -> &'a mut W {
791 self.bit(true)
792 }
793 #[doc = r"Clears the field bit"]
794 #[inline(always)]
795 pub fn clear_bit(self) -> &'a mut W {
796 self.bit(false)
797 }
798 #[doc = r"Writes raw bits to the field"]
799 #[inline(always)]
800 pub fn bit(self, value: bool) -> &'a mut W {
801 self.w.bits = (self.w.bits & !(0x01 << 24)) | ((value as u32 & 0x01) << 24);
802 self.w
803 }
804}
805#[doc = "Field `DSUS_C` reader - Device status - suspend change. The suspend change bit is set to 1 when the suspend bit toggles. The suspend bit can toggle because: - The device goes in the suspended state - The device is disconnected - The device receives resume signaling on its upstream port. The bit is reset by writing a one to it."]
806pub struct DSUS_C_R(crate::pac::generic::FieldReader<bool, bool>);
807impl DSUS_C_R {
808 #[inline(always)]
809 pub(crate) fn new(bits: bool) -> Self {
810 DSUS_C_R(crate::pac::generic::FieldReader::new(bits))
811 }
812}
813impl core::ops::Deref for DSUS_C_R {
814 type Target = crate::pac::generic::FieldReader<bool, bool>;
815 #[inline(always)]
816 fn deref(&self) -> &Self::Target {
817 &self.0
818 }
819}
820#[doc = "Field `DSUS_C` writer - Device status - suspend change. The suspend change bit is set to 1 when the suspend bit toggles. The suspend bit can toggle because: - The device goes in the suspended state - The device is disconnected - The device receives resume signaling on its upstream port. The bit is reset by writing a one to it."]
821pub struct DSUS_C_W<'a> {
822 w: &'a mut W,
823}
824impl<'a> DSUS_C_W<'a> {
825 #[doc = r"Sets the field bit"]
826 #[inline(always)]
827 pub fn set_bit(self) -> &'a mut W {
828 self.bit(true)
829 }
830 #[doc = r"Clears the field bit"]
831 #[inline(always)]
832 pub fn clear_bit(self) -> &'a mut W {
833 self.bit(false)
834 }
835 #[doc = r"Writes raw bits to the field"]
836 #[inline(always)]
837 pub fn bit(self, value: bool) -> &'a mut W {
838 self.w.bits = (self.w.bits & !(0x01 << 25)) | ((value as u32 & 0x01) << 25);
839 self.w
840 }
841}
842#[doc = "Field `DRES_C` reader - Device status - reset change. This bit is set when the device received a bus reset. On a bus reset the device will automatically go to the default state (unconfigured and responding to address 0). The bit is reset by writing a one to it."]
843pub struct DRES_C_R(crate::pac::generic::FieldReader<bool, bool>);
844impl DRES_C_R {
845 #[inline(always)]
846 pub(crate) fn new(bits: bool) -> Self {
847 DRES_C_R(crate::pac::generic::FieldReader::new(bits))
848 }
849}
850impl core::ops::Deref for DRES_C_R {
851 type Target = crate::pac::generic::FieldReader<bool, bool>;
852 #[inline(always)]
853 fn deref(&self) -> &Self::Target {
854 &self.0
855 }
856}
857#[doc = "Field `DRES_C` writer - Device status - reset change. This bit is set when the device received a bus reset. On a bus reset the device will automatically go to the default state (unconfigured and responding to address 0). The bit is reset by writing a one to it."]
858pub struct DRES_C_W<'a> {
859 w: &'a mut W,
860}
861impl<'a> DRES_C_W<'a> {
862 #[doc = r"Sets the field bit"]
863 #[inline(always)]
864 pub fn set_bit(self) -> &'a mut W {
865 self.bit(true)
866 }
867 #[doc = r"Clears the field bit"]
868 #[inline(always)]
869 pub fn clear_bit(self) -> &'a mut W {
870 self.bit(false)
871 }
872 #[doc = r"Writes raw bits to the field"]
873 #[inline(always)]
874 pub fn bit(self, value: bool) -> &'a mut W {
875 self.w.bits = (self.w.bits & !(0x01 << 26)) | ((value as u32 & 0x01) << 26);
876 self.w
877 }
878}
879#[doc = "Field `VBUSDEBOUNCED` reader - This bit indicates if Vbus is detected or not. The bit raises immediately when Vbus becomes high. It drops to zero if Vbus is low for at least 3 ms. If this bit is high and the DCon bit is set, the HW will enable the pull-up resistor to signal a connect."]
880pub struct VBUSDEBOUNCED_R(crate::pac::generic::FieldReader<bool, bool>);
881impl VBUSDEBOUNCED_R {
882 #[inline(always)]
883 pub(crate) fn new(bits: bool) -> Self {
884 VBUSDEBOUNCED_R(crate::pac::generic::FieldReader::new(bits))
885 }
886}
887impl core::ops::Deref for VBUSDEBOUNCED_R {
888 type Target = crate::pac::generic::FieldReader<bool, bool>;
889 #[inline(always)]
890 fn deref(&self) -> &Self::Target {
891 &self.0
892 }
893}
894impl R {
895 #[doc = "Bits 0:6 - USB device address. After bus reset, the address is reset to 0x00. If the enable bit is set, the device will respond on packets for function address DEV_ADDR. When receiving a SetAddress Control Request from the USB host, software must program the new address before completing the status phase of the SetAddress Control Request."]
896 #[inline(always)]
897 pub fn dev_addr(&self) -> DEV_ADDR_R {
898 DEV_ADDR_R::new((self.bits & 0x7f) as u8)
899 }
900 #[doc = "Bit 7 - USB device enable. If this bit is set, the HW will start responding on packets for function address DEV_ADDR."]
901 #[inline(always)]
902 pub fn dev_en(&self) -> DEV_EN_R {
903 DEV_EN_R::new(((self.bits >> 7) & 0x01) != 0)
904 }
905 #[doc = "Bit 8 - SETUP token received. If a SETUP token is received and acknowledged by the device, this bit is set. As long as this bit is set all received IN and OUT tokens will be NAKed by HW. SW must clear this bit by writing a one. If this bit is zero, HW will handle the tokens to the CTRL EP0 as indicated by the CTRL EP0 IN and OUT data information programmed by SW."]
906 #[inline(always)]
907 pub fn setup(&self) -> SETUP_R {
908 SETUP_R::new(((self.bits >> 8) & 0x01) != 0)
909 }
910 #[doc = "Bit 9 - Forces the NEEDCLK output to always be on:"]
911 #[inline(always)]
912 pub fn force_needclk(&self) -> FORCE_NEEDCLK_R {
913 FORCE_NEEDCLK_R::new(((self.bits >> 9) & 0x01) != 0)
914 }
915 #[doc = "Bit 11 - LPM Supported:"]
916 #[inline(always)]
917 pub fn lpm_sup(&self) -> LPM_SUP_R {
918 LPM_SUP_R::new(((self.bits >> 11) & 0x01) != 0)
919 }
920 #[doc = "Bit 12 - Interrupt on NAK for interrupt and bulk OUT EP"]
921 #[inline(always)]
922 pub fn intonnak_ao(&self) -> INTONNAK_AO_R {
923 INTONNAK_AO_R::new(((self.bits >> 12) & 0x01) != 0)
924 }
925 #[doc = "Bit 13 - Interrupt on NAK for interrupt and bulk IN EP"]
926 #[inline(always)]
927 pub fn intonnak_ai(&self) -> INTONNAK_AI_R {
928 INTONNAK_AI_R::new(((self.bits >> 13) & 0x01) != 0)
929 }
930 #[doc = "Bit 14 - Interrupt on NAK for control OUT EP"]
931 #[inline(always)]
932 pub fn intonnak_co(&self) -> INTONNAK_CO_R {
933 INTONNAK_CO_R::new(((self.bits >> 14) & 0x01) != 0)
934 }
935 #[doc = "Bit 15 - Interrupt on NAK for control IN EP"]
936 #[inline(always)]
937 pub fn intonnak_ci(&self) -> INTONNAK_CI_R {
938 INTONNAK_CI_R::new(((self.bits >> 15) & 0x01) != 0)
939 }
940 #[doc = "Bit 16 - Device status - connect. The connect bit must be set by SW to indicate that the device must signal a connect. The pull-up resistor on USB_DP will be enabled when this bit is set and the VBUSDEBOUNCED bit is one."]
941 #[inline(always)]
942 pub fn dcon(&self) -> DCON_R {
943 DCON_R::new(((self.bits >> 16) & 0x01) != 0)
944 }
945 #[doc = "Bit 17 - Device status - suspend. The suspend bit indicates the current suspend state. It is set to 1 when the device hasn't seen any activity on its upstream port for more than 3 milliseconds. It is reset to 0 on any activity. When the device is suspended (Suspend bit DSUS = 1) and the software writes a 0 to it, the device will generate a remote wake-up. This will only happen when the device is connected (Connect bit = 1). When the device is not connected or not suspended, a writing a 0 has no effect. Writing a 1 never has an effect."]
946 #[inline(always)]
947 pub fn dsus(&self) -> DSUS_R {
948 DSUS_R::new(((self.bits >> 17) & 0x01) != 0)
949 }
950 #[doc = "Bit 19 - Device status - LPM Suspend. This bit represents the current LPM suspend state. It is set to 1 by HW when the device has acknowledged the LPM request from the USB host and the Token Retry Time of 10 ms has elapsed. When the device is in the LPM suspended state (LPM suspend bit = 1) and the software writes a zero to this bit, the device will generate a remote walk-up. Software can only write a zero to this bit when the LPM_REWP bit is set to 1. HW resets this bit when it receives a host initiated resume. HW only updates the LPM_SUS bit when the LPM_SUPP bit is equal to one."]
951 #[inline(always)]
952 pub fn lpm_sus(&self) -> LPM_SUS_R {
953 LPM_SUS_R::new(((self.bits >> 19) & 0x01) != 0)
954 }
955 #[doc = "Bit 20 - LPM Remote Wake-up Enabled by USB host. HW sets this bit to one when the bRemoteWake bit in the LPM extended token is set to 1. HW will reset this bit to 0 when it receives the host initiated LPM resume, when a remote wake-up is sent by the device or when a USB bus reset is received. Software can use this bit to check if the remote wake-up feature is enabled by the host for the LPM transaction."]
956 #[inline(always)]
957 pub fn lpm_rewp(&self) -> LPM_REWP_R {
958 LPM_REWP_R::new(((self.bits >> 20) & 0x01) != 0)
959 }
960 #[doc = "Bit 24 - Device status - connect change. The Connect Change bit is set when the device's pull-up resistor is disconnected because VBus disappeared. The bit is reset by writing a one to it."]
961 #[inline(always)]
962 pub fn dcon_c(&self) -> DCON_C_R {
963 DCON_C_R::new(((self.bits >> 24) & 0x01) != 0)
964 }
965 #[doc = "Bit 25 - Device status - suspend change. The suspend change bit is set to 1 when the suspend bit toggles. The suspend bit can toggle because: - The device goes in the suspended state - The device is disconnected - The device receives resume signaling on its upstream port. The bit is reset by writing a one to it."]
966 #[inline(always)]
967 pub fn dsus_c(&self) -> DSUS_C_R {
968 DSUS_C_R::new(((self.bits >> 25) & 0x01) != 0)
969 }
970 #[doc = "Bit 26 - Device status - reset change. This bit is set when the device received a bus reset. On a bus reset the device will automatically go to the default state (unconfigured and responding to address 0). The bit is reset by writing a one to it."]
971 #[inline(always)]
972 pub fn dres_c(&self) -> DRES_C_R {
973 DRES_C_R::new(((self.bits >> 26) & 0x01) != 0)
974 }
975 #[doc = "Bit 28 - This bit indicates if Vbus is detected or not. The bit raises immediately when Vbus becomes high. It drops to zero if Vbus is low for at least 3 ms. If this bit is high and the DCon bit is set, the HW will enable the pull-up resistor to signal a connect."]
976 #[inline(always)]
977 pub fn vbusdebounced(&self) -> VBUSDEBOUNCED_R {
978 VBUSDEBOUNCED_R::new(((self.bits >> 28) & 0x01) != 0)
979 }
980}
981impl W {
982 #[doc = "Bits 0:6 - USB device address. After bus reset, the address is reset to 0x00. If the enable bit is set, the device will respond on packets for function address DEV_ADDR. When receiving a SetAddress Control Request from the USB host, software must program the new address before completing the status phase of the SetAddress Control Request."]
983 #[inline(always)]
984 pub fn dev_addr(&mut self) -> DEV_ADDR_W {
985 DEV_ADDR_W { w: self }
986 }
987 #[doc = "Bit 7 - USB device enable. If this bit is set, the HW will start responding on packets for function address DEV_ADDR."]
988 #[inline(always)]
989 pub fn dev_en(&mut self) -> DEV_EN_W {
990 DEV_EN_W { w: self }
991 }
992 #[doc = "Bit 8 - SETUP token received. If a SETUP token is received and acknowledged by the device, this bit is set. As long as this bit is set all received IN and OUT tokens will be NAKed by HW. SW must clear this bit by writing a one. If this bit is zero, HW will handle the tokens to the CTRL EP0 as indicated by the CTRL EP0 IN and OUT data information programmed by SW."]
993 #[inline(always)]
994 pub fn setup(&mut self) -> SETUP_W {
995 SETUP_W { w: self }
996 }
997 #[doc = "Bit 9 - Forces the NEEDCLK output to always be on:"]
998 #[inline(always)]
999 pub fn force_needclk(&mut self) -> FORCE_NEEDCLK_W {
1000 FORCE_NEEDCLK_W { w: self }
1001 }
1002 #[doc = "Bit 11 - LPM Supported:"]
1003 #[inline(always)]
1004 pub fn lpm_sup(&mut self) -> LPM_SUP_W {
1005 LPM_SUP_W { w: self }
1006 }
1007 #[doc = "Bit 12 - Interrupt on NAK for interrupt and bulk OUT EP"]
1008 #[inline(always)]
1009 pub fn intonnak_ao(&mut self) -> INTONNAK_AO_W {
1010 INTONNAK_AO_W { w: self }
1011 }
1012 #[doc = "Bit 13 - Interrupt on NAK for interrupt and bulk IN EP"]
1013 #[inline(always)]
1014 pub fn intonnak_ai(&mut self) -> INTONNAK_AI_W {
1015 INTONNAK_AI_W { w: self }
1016 }
1017 #[doc = "Bit 14 - Interrupt on NAK for control OUT EP"]
1018 #[inline(always)]
1019 pub fn intonnak_co(&mut self) -> INTONNAK_CO_W {
1020 INTONNAK_CO_W { w: self }
1021 }
1022 #[doc = "Bit 15 - Interrupt on NAK for control IN EP"]
1023 #[inline(always)]
1024 pub fn intonnak_ci(&mut self) -> INTONNAK_CI_W {
1025 INTONNAK_CI_W { w: self }
1026 }
1027 #[doc = "Bit 16 - Device status - connect. The connect bit must be set by SW to indicate that the device must signal a connect. The pull-up resistor on USB_DP will be enabled when this bit is set and the VBUSDEBOUNCED bit is one."]
1028 #[inline(always)]
1029 pub fn dcon(&mut self) -> DCON_W {
1030 DCON_W { w: self }
1031 }
1032 #[doc = "Bit 17 - Device status - suspend. The suspend bit indicates the current suspend state. It is set to 1 when the device hasn't seen any activity on its upstream port for more than 3 milliseconds. It is reset to 0 on any activity. When the device is suspended (Suspend bit DSUS = 1) and the software writes a 0 to it, the device will generate a remote wake-up. This will only happen when the device is connected (Connect bit = 1). When the device is not connected or not suspended, a writing a 0 has no effect. Writing a 1 never has an effect."]
1033 #[inline(always)]
1034 pub fn dsus(&mut self) -> DSUS_W {
1035 DSUS_W { w: self }
1036 }
1037 #[doc = "Bit 19 - Device status - LPM Suspend. This bit represents the current LPM suspend state. It is set to 1 by HW when the device has acknowledged the LPM request from the USB host and the Token Retry Time of 10 ms has elapsed. When the device is in the LPM suspended state (LPM suspend bit = 1) and the software writes a zero to this bit, the device will generate a remote walk-up. Software can only write a zero to this bit when the LPM_REWP bit is set to 1. HW resets this bit when it receives a host initiated resume. HW only updates the LPM_SUS bit when the LPM_SUPP bit is equal to one."]
1038 #[inline(always)]
1039 pub fn lpm_sus(&mut self) -> LPM_SUS_W {
1040 LPM_SUS_W { w: self }
1041 }
1042 #[doc = "Bit 24 - Device status - connect change. The Connect Change bit is set when the device's pull-up resistor is disconnected because VBus disappeared. The bit is reset by writing a one to it."]
1043 #[inline(always)]
1044 pub fn dcon_c(&mut self) -> DCON_C_W {
1045 DCON_C_W { w: self }
1046 }
1047 #[doc = "Bit 25 - Device status - suspend change. The suspend change bit is set to 1 when the suspend bit toggles. The suspend bit can toggle because: - The device goes in the suspended state - The device is disconnected - The device receives resume signaling on its upstream port. The bit is reset by writing a one to it."]
1048 #[inline(always)]
1049 pub fn dsus_c(&mut self) -> DSUS_C_W {
1050 DSUS_C_W { w: self }
1051 }
1052 #[doc = "Bit 26 - Device status - reset change. This bit is set when the device received a bus reset. On a bus reset the device will automatically go to the default state (unconfigured and responding to address 0). The bit is reset by writing a one to it."]
1053 #[inline(always)]
1054 pub fn dres_c(&mut self) -> DRES_C_W {
1055 DRES_C_W { w: self }
1056 }
1057 #[doc = "Writes raw bits to the register."]
1058 #[inline(always)]
1059 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
1060 self.0.bits(bits);
1061 self
1062 }
1063}
1064#[doc = "USB Device Command/Status register\n\nThis register you can [`read`](crate::pac::generic::generic::Reg::read), [`write_with_zero`](crate::pac::generic::generic::Reg::write_with_zero), [`reset`](crate::pac::generic::generic::Reg::reset), [`write`](crate::pac::generic::generic::Reg::write), [`modify`](crate::pac::generic::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [devcmdstat](index.html) module"]
1065pub struct DEVCMDSTAT_SPEC;
1066impl crate::pac::generic::RegisterSpec for DEVCMDSTAT_SPEC {
1067 type Ux = u32;
1068}
1069#[doc = "`read()` method returns [devcmdstat::R](R) reader structure"]
1070impl crate::pac::generic::Readable for DEVCMDSTAT_SPEC {
1071 type Reader = R;
1072}
1073#[doc = "`write(|w| ..)` method takes [devcmdstat::W](W) writer structure"]
1074impl crate::pac::generic::Writable for DEVCMDSTAT_SPEC {
1075 type Writer = W;
1076}
1077#[doc = "`reset()` method sets DEVCMDSTAT to value 0x0800"]
1078impl crate::pac::generic::Resettable for DEVCMDSTAT_SPEC {
1079 #[inline(always)]
1080 fn reset_value() -> Self::Ux {
1081 0x0800
1082 }
1083}