1#[doc = "Register `ISTR` reader"]
2pub struct R(crate::R<ISTR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<ISTR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<ISTR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<ISTR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `ISTR` writer"]
17pub struct W(crate::W<ISTR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<ISTR_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::W<ISTR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<ISTR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `EP_ID` reader - Endpoint Identifier"]
38pub type EP_ID_R = crate::FieldReader<u8, u8>;
39#[doc = "Direction of transaction\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum DIR_A {
42 #[doc = "0: data transmitted by the USB peripheral to the host PC"]
43 To = 0,
44 #[doc = "1: data received by the USB peripheral from the host PC"]
45 From = 1,
46}
47impl From<DIR_A> for bool {
48 #[inline(always)]
49 fn from(variant: DIR_A) -> Self {
50 variant as u8 != 0
51 }
52}
53#[doc = "Field `DIR` reader - Direction of transaction"]
54pub type DIR_R = crate::BitReader<DIR_A>;
55impl DIR_R {
56 #[doc = "Get enumerated values variant"]
57 #[inline(always)]
58 pub fn variant(&self) -> DIR_A {
59 match self.bits {
60 false => DIR_A::To,
61 true => DIR_A::From,
62 }
63 }
64 #[doc = "Checks if the value of the field is `To`"]
65 #[inline(always)]
66 pub fn is_to(&self) -> bool {
67 *self == DIR_A::To
68 }
69 #[doc = "Checks if the value of the field is `From`"]
70 #[inline(always)]
71 pub fn is_from(&self) -> bool {
72 *self == DIR_A::From
73 }
74}
75#[doc = "LPM L1 state request\n\nValue on reset: 0"]
76#[derive(Clone, Copy, Debug, PartialEq)]
77pub enum L1REQ_A {
78 #[doc = "1: LPM command to enter the L1 state is successfully received and acknowledged"]
79 Received = 1,
80}
81impl From<L1REQ_A> for bool {
82 #[inline(always)]
83 fn from(variant: L1REQ_A) -> Self {
84 variant as u8 != 0
85 }
86}
87#[doc = "Field `L1REQ` reader - LPM L1 state request"]
88pub type L1REQ_R = crate::BitReader<L1REQ_A>;
89impl L1REQ_R {
90 #[doc = "Get enumerated values variant"]
91 #[inline(always)]
92 pub fn variant(&self) -> Option<L1REQ_A> {
93 match self.bits {
94 true => Some(L1REQ_A::Received),
95 _ => None,
96 }
97 }
98 #[doc = "Checks if the value of the field is `Received`"]
99 #[inline(always)]
100 pub fn is_received(&self) -> bool {
101 *self == L1REQ_A::Received
102 }
103}
104#[doc = "Field `L1REQ` writer - LPM L1 state request"]
105pub type L1REQ_W<'a, const O: u8> = crate::BitWriter<'a, u32, ISTR_SPEC, L1REQ_A, O>;
106impl<'a, const O: u8> L1REQ_W<'a, O> {
107 #[doc = "LPM command to enter the L1 state is successfully received and acknowledged"]
108 #[inline(always)]
109 pub fn received(self) -> &'a mut W {
110 self.variant(L1REQ_A::Received)
111 }
112}
113#[doc = "Expected start frame\n\nValue on reset: 0"]
114#[derive(Clone, Copy, Debug, PartialEq)]
115pub enum ESOF_A {
116 #[doc = "1: an SOF packet is expected but not received"]
117 ExpectedStartOfFrame = 1,
118}
119impl From<ESOF_A> for bool {
120 #[inline(always)]
121 fn from(variant: ESOF_A) -> Self {
122 variant as u8 != 0
123 }
124}
125#[doc = "Field `ESOF` reader - Expected start frame"]
126pub type ESOF_R = crate::BitReader<ESOF_A>;
127impl ESOF_R {
128 #[doc = "Get enumerated values variant"]
129 #[inline(always)]
130 pub fn variant(&self) -> Option<ESOF_A> {
131 match self.bits {
132 true => Some(ESOF_A::ExpectedStartOfFrame),
133 _ => None,
134 }
135 }
136 #[doc = "Checks if the value of the field is `ExpectedStartOfFrame`"]
137 #[inline(always)]
138 pub fn is_expected_start_of_frame(&self) -> bool {
139 *self == ESOF_A::ExpectedStartOfFrame
140 }
141}
142#[doc = "Field `ESOF` writer - Expected start frame"]
143pub type ESOF_W<'a, const O: u8> = crate::BitWriter<'a, u32, ISTR_SPEC, ESOF_A, O>;
144impl<'a, const O: u8> ESOF_W<'a, O> {
145 #[doc = "an SOF packet is expected but not received"]
146 #[inline(always)]
147 pub fn expected_start_of_frame(self) -> &'a mut W {
148 self.variant(ESOF_A::ExpectedStartOfFrame)
149 }
150}
151#[doc = "start of frame\n\nValue on reset: 0"]
152#[derive(Clone, Copy, Debug, PartialEq)]
153pub enum SOF_A {
154 #[doc = "1: beginning of a new USB frame and it is set when a SOF packet arrives through the USB bus"]
155 StartOfFrame = 1,
156}
157impl From<SOF_A> for bool {
158 #[inline(always)]
159 fn from(variant: SOF_A) -> Self {
160 variant as u8 != 0
161 }
162}
163#[doc = "Field `SOF` reader - start of frame"]
164pub type SOF_R = crate::BitReader<SOF_A>;
165impl SOF_R {
166 #[doc = "Get enumerated values variant"]
167 #[inline(always)]
168 pub fn variant(&self) -> Option<SOF_A> {
169 match self.bits {
170 true => Some(SOF_A::StartOfFrame),
171 _ => None,
172 }
173 }
174 #[doc = "Checks if the value of the field is `StartOfFrame`"]
175 #[inline(always)]
176 pub fn is_start_of_frame(&self) -> bool {
177 *self == SOF_A::StartOfFrame
178 }
179}
180#[doc = "Field `SOF` writer - start of frame"]
181pub type SOF_W<'a, const O: u8> = crate::BitWriter<'a, u32, ISTR_SPEC, SOF_A, O>;
182impl<'a, const O: u8> SOF_W<'a, O> {
183 #[doc = "beginning of a new USB frame and it is set when a SOF packet arrives through the USB bus"]
184 #[inline(always)]
185 pub fn start_of_frame(self) -> &'a mut W {
186 self.variant(SOF_A::StartOfFrame)
187 }
188}
189#[doc = "reset request\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq)]
191pub enum RESET_A {
192 #[doc = "1: peripheral detects an active USB RESET signal at its inputs"]
193 Reset = 1,
194}
195impl From<RESET_A> for bool {
196 #[inline(always)]
197 fn from(variant: RESET_A) -> Self {
198 variant as u8 != 0
199 }
200}
201#[doc = "Field `RESET` reader - reset request"]
202pub type RESET_R = crate::BitReader<RESET_A>;
203impl RESET_R {
204 #[doc = "Get enumerated values variant"]
205 #[inline(always)]
206 pub fn variant(&self) -> Option<RESET_A> {
207 match self.bits {
208 true => Some(RESET_A::Reset),
209 _ => None,
210 }
211 }
212 #[doc = "Checks if the value of the field is `Reset`"]
213 #[inline(always)]
214 pub fn is_reset(&self) -> bool {
215 *self == RESET_A::Reset
216 }
217}
218#[doc = "Field `RESET` writer - reset request"]
219pub type RESET_W<'a, const O: u8> = crate::BitWriter<'a, u32, ISTR_SPEC, RESET_A, O>;
220impl<'a, const O: u8> RESET_W<'a, O> {
221 #[doc = "peripheral detects an active USB RESET signal at its inputs"]
222 #[inline(always)]
223 pub fn reset(self) -> &'a mut W {
224 self.variant(RESET_A::Reset)
225 }
226}
227#[doc = "Suspend mode request\n\nValue on reset: 0"]
228#[derive(Clone, Copy, Debug, PartialEq)]
229pub enum SUSP_A {
230 #[doc = "1: no traffic has been received for 3 ms, indicating a suspend mode request from the USB bus"]
231 Suspend = 1,
232}
233impl From<SUSP_A> for bool {
234 #[inline(always)]
235 fn from(variant: SUSP_A) -> Self {
236 variant as u8 != 0
237 }
238}
239#[doc = "Field `SUSP` reader - Suspend mode request"]
240pub type SUSP_R = crate::BitReader<SUSP_A>;
241impl SUSP_R {
242 #[doc = "Get enumerated values variant"]
243 #[inline(always)]
244 pub fn variant(&self) -> Option<SUSP_A> {
245 match self.bits {
246 true => Some(SUSP_A::Suspend),
247 _ => None,
248 }
249 }
250 #[doc = "Checks if the value of the field is `Suspend`"]
251 #[inline(always)]
252 pub fn is_suspend(&self) -> bool {
253 *self == SUSP_A::Suspend
254 }
255}
256#[doc = "Field `SUSP` writer - Suspend mode request"]
257pub type SUSP_W<'a, const O: u8> = crate::BitWriter<'a, u32, ISTR_SPEC, SUSP_A, O>;
258impl<'a, const O: u8> SUSP_W<'a, O> {
259 #[doc = "no traffic has been received for 3 ms, indicating a suspend mode request from the USB bus"]
260 #[inline(always)]
261 pub fn suspend(self) -> &'a mut W {
262 self.variant(SUSP_A::Suspend)
263 }
264}
265#[doc = "Wakeup\n\nValue on reset: 0"]
266#[derive(Clone, Copy, Debug, PartialEq)]
267pub enum WKUP_A {
268 #[doc = "1: activity is detected that wakes up the USB peripheral"]
269 Wakeup = 1,
270}
271impl From<WKUP_A> for bool {
272 #[inline(always)]
273 fn from(variant: WKUP_A) -> Self {
274 variant as u8 != 0
275 }
276}
277#[doc = "Field `WKUP` reader - Wakeup"]
278pub type WKUP_R = crate::BitReader<WKUP_A>;
279impl WKUP_R {
280 #[doc = "Get enumerated values variant"]
281 #[inline(always)]
282 pub fn variant(&self) -> Option<WKUP_A> {
283 match self.bits {
284 true => Some(WKUP_A::Wakeup),
285 _ => None,
286 }
287 }
288 #[doc = "Checks if the value of the field is `Wakeup`"]
289 #[inline(always)]
290 pub fn is_wakeup(&self) -> bool {
291 *self == WKUP_A::Wakeup
292 }
293}
294#[doc = "Field `WKUP` writer - Wakeup"]
295pub type WKUP_W<'a, const O: u8> = crate::BitWriter<'a, u32, ISTR_SPEC, WKUP_A, O>;
296impl<'a, const O: u8> WKUP_W<'a, O> {
297 #[doc = "activity is detected that wakes up the USB peripheral"]
298 #[inline(always)]
299 pub fn wakeup(self) -> &'a mut W {
300 self.variant(WKUP_A::Wakeup)
301 }
302}
303#[doc = "Error\n\nValue on reset: 0"]
304#[derive(Clone, Copy, Debug, PartialEq)]
305pub enum ERR_A {
306 #[doc = "1: One of No ANSwer, Cyclic Redundancy Check, Bit Stuffing or Framing format Violation error occurred"]
307 Error = 1,
308}
309impl From<ERR_A> for bool {
310 #[inline(always)]
311 fn from(variant: ERR_A) -> Self {
312 variant as u8 != 0
313 }
314}
315#[doc = "Field `ERR` reader - Error"]
316pub type ERR_R = crate::BitReader<ERR_A>;
317impl ERR_R {
318 #[doc = "Get enumerated values variant"]
319 #[inline(always)]
320 pub fn variant(&self) -> Option<ERR_A> {
321 match self.bits {
322 true => Some(ERR_A::Error),
323 _ => None,
324 }
325 }
326 #[doc = "Checks if the value of the field is `Error`"]
327 #[inline(always)]
328 pub fn is_error(&self) -> bool {
329 *self == ERR_A::Error
330 }
331}
332#[doc = "Field `ERR` writer - Error"]
333pub type ERR_W<'a, const O: u8> = crate::BitWriter<'a, u32, ISTR_SPEC, ERR_A, O>;
334impl<'a, const O: u8> ERR_W<'a, O> {
335 #[doc = "One of No ANSwer, Cyclic Redundancy Check, Bit Stuffing or Framing format Violation error occurred"]
336 #[inline(always)]
337 pub fn error(self) -> &'a mut W {
338 self.variant(ERR_A::Error)
339 }
340}
341#[doc = "Packet memory area over / underrun\n\nValue on reset: 0"]
342#[derive(Clone, Copy, Debug, PartialEq)]
343pub enum PMAOVR_A {
344 #[doc = "1: microcontroller has not been able to respond in time to an USB memory request"]
345 Overrun = 1,
346}
347impl From<PMAOVR_A> for bool {
348 #[inline(always)]
349 fn from(variant: PMAOVR_A) -> Self {
350 variant as u8 != 0
351 }
352}
353#[doc = "Field `PMAOVR` reader - Packet memory area over / underrun"]
354pub type PMAOVR_R = crate::BitReader<PMAOVR_A>;
355impl PMAOVR_R {
356 #[doc = "Get enumerated values variant"]
357 #[inline(always)]
358 pub fn variant(&self) -> Option<PMAOVR_A> {
359 match self.bits {
360 true => Some(PMAOVR_A::Overrun),
361 _ => None,
362 }
363 }
364 #[doc = "Checks if the value of the field is `Overrun`"]
365 #[inline(always)]
366 pub fn is_overrun(&self) -> bool {
367 *self == PMAOVR_A::Overrun
368 }
369}
370#[doc = "Field `PMAOVR` writer - Packet memory area over / underrun"]
371pub type PMAOVR_W<'a, const O: u8> = crate::BitWriter<'a, u32, ISTR_SPEC, PMAOVR_A, O>;
372impl<'a, const O: u8> PMAOVR_W<'a, O> {
373 #[doc = "microcontroller has not been able to respond in time to an USB memory request"]
374 #[inline(always)]
375 pub fn overrun(self) -> &'a mut W {
376 self.variant(PMAOVR_A::Overrun)
377 }
378}
379#[doc = "Correct transfer\n\nValue on reset: 0"]
380#[derive(Clone, Copy, Debug, PartialEq)]
381pub enum CTR_A {
382 #[doc = "1: endpoint has successfully completed a transaction"]
383 Completed = 1,
384}
385impl From<CTR_A> for bool {
386 #[inline(always)]
387 fn from(variant: CTR_A) -> Self {
388 variant as u8 != 0
389 }
390}
391#[doc = "Field `CTR` reader - Correct transfer"]
392pub type CTR_R = crate::BitReader<CTR_A>;
393impl CTR_R {
394 #[doc = "Get enumerated values variant"]
395 #[inline(always)]
396 pub fn variant(&self) -> Option<CTR_A> {
397 match self.bits {
398 true => Some(CTR_A::Completed),
399 _ => None,
400 }
401 }
402 #[doc = "Checks if the value of the field is `Completed`"]
403 #[inline(always)]
404 pub fn is_completed(&self) -> bool {
405 *self == CTR_A::Completed
406 }
407}
408impl R {
409 #[doc = "Bits 0:3 - Endpoint Identifier"]
410 #[inline(always)]
411 pub fn ep_id(&self) -> EP_ID_R {
412 EP_ID_R::new((self.bits & 0x0f) as u8)
413 }
414 #[doc = "Bit 4 - Direction of transaction"]
415 #[inline(always)]
416 pub fn dir(&self) -> DIR_R {
417 DIR_R::new(((self.bits >> 4) & 1) != 0)
418 }
419 #[doc = "Bit 7 - LPM L1 state request"]
420 #[inline(always)]
421 pub fn l1req(&self) -> L1REQ_R {
422 L1REQ_R::new(((self.bits >> 7) & 1) != 0)
423 }
424 #[doc = "Bit 8 - Expected start frame"]
425 #[inline(always)]
426 pub fn esof(&self) -> ESOF_R {
427 ESOF_R::new(((self.bits >> 8) & 1) != 0)
428 }
429 #[doc = "Bit 9 - start of frame"]
430 #[inline(always)]
431 pub fn sof(&self) -> SOF_R {
432 SOF_R::new(((self.bits >> 9) & 1) != 0)
433 }
434 #[doc = "Bit 10 - reset request"]
435 #[inline(always)]
436 pub fn reset(&self) -> RESET_R {
437 RESET_R::new(((self.bits >> 10) & 1) != 0)
438 }
439 #[doc = "Bit 11 - Suspend mode request"]
440 #[inline(always)]
441 pub fn susp(&self) -> SUSP_R {
442 SUSP_R::new(((self.bits >> 11) & 1) != 0)
443 }
444 #[doc = "Bit 12 - Wakeup"]
445 #[inline(always)]
446 pub fn wkup(&self) -> WKUP_R {
447 WKUP_R::new(((self.bits >> 12) & 1) != 0)
448 }
449 #[doc = "Bit 13 - Error"]
450 #[inline(always)]
451 pub fn err(&self) -> ERR_R {
452 ERR_R::new(((self.bits >> 13) & 1) != 0)
453 }
454 #[doc = "Bit 14 - Packet memory area over / underrun"]
455 #[inline(always)]
456 pub fn pmaovr(&self) -> PMAOVR_R {
457 PMAOVR_R::new(((self.bits >> 14) & 1) != 0)
458 }
459 #[doc = "Bit 15 - Correct transfer"]
460 #[inline(always)]
461 pub fn ctr(&self) -> CTR_R {
462 CTR_R::new(((self.bits >> 15) & 1) != 0)
463 }
464}
465impl W {
466 #[doc = "Bit 7 - LPM L1 state request"]
467 #[inline(always)]
468 pub fn l1req(&mut self) -> L1REQ_W<7> {
469 L1REQ_W::new(self)
470 }
471 #[doc = "Bit 8 - Expected start frame"]
472 #[inline(always)]
473 pub fn esof(&mut self) -> ESOF_W<8> {
474 ESOF_W::new(self)
475 }
476 #[doc = "Bit 9 - start of frame"]
477 #[inline(always)]
478 pub fn sof(&mut self) -> SOF_W<9> {
479 SOF_W::new(self)
480 }
481 #[doc = "Bit 10 - reset request"]
482 #[inline(always)]
483 pub fn reset(&mut self) -> RESET_W<10> {
484 RESET_W::new(self)
485 }
486 #[doc = "Bit 11 - Suspend mode request"]
487 #[inline(always)]
488 pub fn susp(&mut self) -> SUSP_W<11> {
489 SUSP_W::new(self)
490 }
491 #[doc = "Bit 12 - Wakeup"]
492 #[inline(always)]
493 pub fn wkup(&mut self) -> WKUP_W<12> {
494 WKUP_W::new(self)
495 }
496 #[doc = "Bit 13 - Error"]
497 #[inline(always)]
498 pub fn err(&mut self) -> ERR_W<13> {
499 ERR_W::new(self)
500 }
501 #[doc = "Bit 14 - Packet memory area over / underrun"]
502 #[inline(always)]
503 pub fn pmaovr(&mut self) -> PMAOVR_W<14> {
504 PMAOVR_W::new(self)
505 }
506 #[doc = "Writes raw bits to the register."]
507 #[inline(always)]
508 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
509 self.0.bits(bits);
510 self
511 }
512}
513#[doc = "interrupt status register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [istr](index.html) module"]
514pub struct ISTR_SPEC;
515impl crate::RegisterSpec for ISTR_SPEC {
516 type Ux = u32;
517}
518#[doc = "`read()` method returns [istr::R](R) reader structure"]
519impl crate::Readable for ISTR_SPEC {
520 type Reader = R;
521}
522#[doc = "`write(|w| ..)` method takes [istr::W](W) writer structure"]
523impl crate::Writable for ISTR_SPEC {
524 type Writer = W;
525}
526#[doc = "`reset()` method sets ISTR to value 0"]
527impl crate::Resettable for ISTR_SPEC {
528 #[inline(always)]
529 fn reset_value() -> Self::Ux {
530 0
531 }
532}