1#[doc = "Register `ISTAT` reader"]
2pub type R = crate::R<IstatSpec>;
3#[doc = "Register `ISTAT` writer"]
4pub type W = crate::W<IstatSpec>;
5#[doc = "USB Reset Flag\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Usbrst {
9 #[doc = "0: Not detected"]
10 IntNo = 0,
11 #[doc = "1: Detected"]
12 IntYes = 1,
13}
14impl From<Usbrst> for bool {
15 #[inline(always)]
16 fn from(variant: Usbrst) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `USBRST` reader - USB Reset Flag"]
21pub type UsbrstR = crate::BitReader<Usbrst>;
22impl UsbrstR {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> Usbrst {
26 match self.bits {
27 false => Usbrst::IntNo,
28 true => Usbrst::IntYes,
29 }
30 }
31 #[doc = "Not detected"]
32 #[inline(always)]
33 pub fn is_int_no(&self) -> bool {
34 *self == Usbrst::IntNo
35 }
36 #[doc = "Detected"]
37 #[inline(always)]
38 pub fn is_int_yes(&self) -> bool {
39 *self == Usbrst::IntYes
40 }
41}
42#[doc = "Field `USBRST` writer - USB Reset Flag"]
43pub type UsbrstW<'a, REG> = crate::BitWriter1C<'a, REG, Usbrst>;
44impl<'a, REG> UsbrstW<'a, REG>
45where
46 REG: crate::Writable + crate::RegisterSpec,
47{
48 #[doc = "Not detected"]
49 #[inline(always)]
50 pub fn int_no(self) -> &'a mut crate::W<REG> {
51 self.variant(Usbrst::IntNo)
52 }
53 #[doc = "Detected"]
54 #[inline(always)]
55 pub fn int_yes(self) -> &'a mut crate::W<REG> {
56 self.variant(Usbrst::IntYes)
57 }
58}
59#[doc = "Error Flag\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Error {
63 #[doc = "0: Error did not occur"]
64 IntNo = 0,
65 #[doc = "1: Error occurred"]
66 IntYes = 1,
67}
68impl From<Error> for bool {
69 #[inline(always)]
70 fn from(variant: Error) -> Self {
71 variant as u8 != 0
72 }
73}
74#[doc = "Field `ERROR` reader - Error Flag"]
75pub type ErrorR = crate::BitReader<Error>;
76impl ErrorR {
77 #[doc = "Get enumerated values variant"]
78 #[inline(always)]
79 pub const fn variant(&self) -> Error {
80 match self.bits {
81 false => Error::IntNo,
82 true => Error::IntYes,
83 }
84 }
85 #[doc = "Error did not occur"]
86 #[inline(always)]
87 pub fn is_int_no(&self) -> bool {
88 *self == Error::IntNo
89 }
90 #[doc = "Error occurred"]
91 #[inline(always)]
92 pub fn is_int_yes(&self) -> bool {
93 *self == Error::IntYes
94 }
95}
96#[doc = "Field `ERROR` writer - Error Flag"]
97pub type ErrorW<'a, REG> = crate::BitWriter1C<'a, REG, Error>;
98impl<'a, REG> ErrorW<'a, REG>
99where
100 REG: crate::Writable + crate::RegisterSpec,
101{
102 #[doc = "Error did not occur"]
103 #[inline(always)]
104 pub fn int_no(self) -> &'a mut crate::W<REG> {
105 self.variant(Error::IntNo)
106 }
107 #[doc = "Error occurred"]
108 #[inline(always)]
109 pub fn int_yes(self) -> &'a mut crate::W<REG> {
110 self.variant(Error::IntYes)
111 }
112}
113#[doc = "Start Of Frame (SOF) Token Flag\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum Softok {
117 #[doc = "0: Did not receive"]
118 IntNo = 0,
119 #[doc = "1: Received"]
120 IntYes = 1,
121}
122impl From<Softok> for bool {
123 #[inline(always)]
124 fn from(variant: Softok) -> Self {
125 variant as u8 != 0
126 }
127}
128#[doc = "Field `SOFTOK` reader - Start Of Frame (SOF) Token Flag"]
129pub type SoftokR = crate::BitReader<Softok>;
130impl SoftokR {
131 #[doc = "Get enumerated values variant"]
132 #[inline(always)]
133 pub const fn variant(&self) -> Softok {
134 match self.bits {
135 false => Softok::IntNo,
136 true => Softok::IntYes,
137 }
138 }
139 #[doc = "Did not receive"]
140 #[inline(always)]
141 pub fn is_int_no(&self) -> bool {
142 *self == Softok::IntNo
143 }
144 #[doc = "Received"]
145 #[inline(always)]
146 pub fn is_int_yes(&self) -> bool {
147 *self == Softok::IntYes
148 }
149}
150#[doc = "Field `SOFTOK` writer - Start Of Frame (SOF) Token Flag"]
151pub type SoftokW<'a, REG> = crate::BitWriter1C<'a, REG, Softok>;
152impl<'a, REG> SoftokW<'a, REG>
153where
154 REG: crate::Writable + crate::RegisterSpec,
155{
156 #[doc = "Did not receive"]
157 #[inline(always)]
158 pub fn int_no(self) -> &'a mut crate::W<REG> {
159 self.variant(Softok::IntNo)
160 }
161 #[doc = "Received"]
162 #[inline(always)]
163 pub fn int_yes(self) -> &'a mut crate::W<REG> {
164 self.variant(Softok::IntYes)
165 }
166}
167#[doc = "Current Token Processing Flag\n\nValue on reset: 0"]
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum Tokdne {
171 #[doc = "0: Not processed"]
172 IntNo = 0,
173 #[doc = "1: Processed"]
174 IntYes = 1,
175}
176impl From<Tokdne> for bool {
177 #[inline(always)]
178 fn from(variant: Tokdne) -> Self {
179 variant as u8 != 0
180 }
181}
182#[doc = "Field `TOKDNE` reader - Current Token Processing Flag"]
183pub type TokdneR = crate::BitReader<Tokdne>;
184impl TokdneR {
185 #[doc = "Get enumerated values variant"]
186 #[inline(always)]
187 pub const fn variant(&self) -> Tokdne {
188 match self.bits {
189 false => Tokdne::IntNo,
190 true => Tokdne::IntYes,
191 }
192 }
193 #[doc = "Not processed"]
194 #[inline(always)]
195 pub fn is_int_no(&self) -> bool {
196 *self == Tokdne::IntNo
197 }
198 #[doc = "Processed"]
199 #[inline(always)]
200 pub fn is_int_yes(&self) -> bool {
201 *self == Tokdne::IntYes
202 }
203}
204#[doc = "Field `TOKDNE` writer - Current Token Processing Flag"]
205pub type TokdneW<'a, REG> = crate::BitWriter1C<'a, REG, Tokdne>;
206impl<'a, REG> TokdneW<'a, REG>
207where
208 REG: crate::Writable + crate::RegisterSpec,
209{
210 #[doc = "Not processed"]
211 #[inline(always)]
212 pub fn int_no(self) -> &'a mut crate::W<REG> {
213 self.variant(Tokdne::IntNo)
214 }
215 #[doc = "Processed"]
216 #[inline(always)]
217 pub fn int_yes(self) -> &'a mut crate::W<REG> {
218 self.variant(Tokdne::IntYes)
219 }
220}
221#[doc = "Sleep Flag\n\nValue on reset: 0"]
222#[cfg_attr(feature = "defmt", derive(defmt::Format))]
223#[derive(Clone, Copy, Debug, PartialEq, Eq)]
224pub enum Sleep {
225 #[doc = "0: Interrupt did not occur"]
226 IntNo = 0,
227 #[doc = "1: Interrupt occurred"]
228 IntYes = 1,
229}
230impl From<Sleep> for bool {
231 #[inline(always)]
232 fn from(variant: Sleep) -> Self {
233 variant as u8 != 0
234 }
235}
236#[doc = "Field `SLEEP` reader - Sleep Flag"]
237pub type SleepR = crate::BitReader<Sleep>;
238impl SleepR {
239 #[doc = "Get enumerated values variant"]
240 #[inline(always)]
241 pub const fn variant(&self) -> Sleep {
242 match self.bits {
243 false => Sleep::IntNo,
244 true => Sleep::IntYes,
245 }
246 }
247 #[doc = "Interrupt did not occur"]
248 #[inline(always)]
249 pub fn is_int_no(&self) -> bool {
250 *self == Sleep::IntNo
251 }
252 #[doc = "Interrupt occurred"]
253 #[inline(always)]
254 pub fn is_int_yes(&self) -> bool {
255 *self == Sleep::IntYes
256 }
257}
258#[doc = "Field `SLEEP` writer - Sleep Flag"]
259pub type SleepW<'a, REG> = crate::BitWriter1C<'a, REG, Sleep>;
260impl<'a, REG> SleepW<'a, REG>
261where
262 REG: crate::Writable + crate::RegisterSpec,
263{
264 #[doc = "Interrupt did not occur"]
265 #[inline(always)]
266 pub fn int_no(self) -> &'a mut crate::W<REG> {
267 self.variant(Sleep::IntNo)
268 }
269 #[doc = "Interrupt occurred"]
270 #[inline(always)]
271 pub fn int_yes(self) -> &'a mut crate::W<REG> {
272 self.variant(Sleep::IntYes)
273 }
274}
275#[doc = "Resume Flag\n\nValue on reset: 0"]
276#[cfg_attr(feature = "defmt", derive(defmt::Format))]
277#[derive(Clone, Copy, Debug, PartialEq, Eq)]
278pub enum Resume {
279 #[doc = "0: Interrupt did not occur"]
280 IntNo = 0,
281 #[doc = "1: Interrupt occurred"]
282 IntYes = 1,
283}
284impl From<Resume> for bool {
285 #[inline(always)]
286 fn from(variant: Resume) -> Self {
287 variant as u8 != 0
288 }
289}
290#[doc = "Field `RESUME` reader - Resume Flag"]
291pub type ResumeR = crate::BitReader<Resume>;
292impl ResumeR {
293 #[doc = "Get enumerated values variant"]
294 #[inline(always)]
295 pub const fn variant(&self) -> Resume {
296 match self.bits {
297 false => Resume::IntNo,
298 true => Resume::IntYes,
299 }
300 }
301 #[doc = "Interrupt did not occur"]
302 #[inline(always)]
303 pub fn is_int_no(&self) -> bool {
304 *self == Resume::IntNo
305 }
306 #[doc = "Interrupt occurred"]
307 #[inline(always)]
308 pub fn is_int_yes(&self) -> bool {
309 *self == Resume::IntYes
310 }
311}
312#[doc = "Field `RESUME` writer - Resume Flag"]
313pub type ResumeW<'a, REG> = crate::BitWriter1C<'a, REG, Resume>;
314impl<'a, REG> ResumeW<'a, REG>
315where
316 REG: crate::Writable + crate::RegisterSpec,
317{
318 #[doc = "Interrupt did not occur"]
319 #[inline(always)]
320 pub fn int_no(self) -> &'a mut crate::W<REG> {
321 self.variant(Resume::IntNo)
322 }
323 #[doc = "Interrupt occurred"]
324 #[inline(always)]
325 pub fn int_yes(self) -> &'a mut crate::W<REG> {
326 self.variant(Resume::IntYes)
327 }
328}
329#[doc = "Attach Interrupt Flag\n\nValue on reset: 0"]
330#[cfg_attr(feature = "defmt", derive(defmt::Format))]
331#[derive(Clone, Copy, Debug, PartialEq, Eq)]
332pub enum Attach {
333 #[doc = "0: Not detected"]
334 IntNo = 0,
335 #[doc = "1: Detected"]
336 IntYes = 1,
337}
338impl From<Attach> for bool {
339 #[inline(always)]
340 fn from(variant: Attach) -> Self {
341 variant as u8 != 0
342 }
343}
344#[doc = "Field `ATTACH` reader - Attach Interrupt Flag"]
345pub type AttachR = crate::BitReader<Attach>;
346impl AttachR {
347 #[doc = "Get enumerated values variant"]
348 #[inline(always)]
349 pub const fn variant(&self) -> Attach {
350 match self.bits {
351 false => Attach::IntNo,
352 true => Attach::IntYes,
353 }
354 }
355 #[doc = "Not detected"]
356 #[inline(always)]
357 pub fn is_int_no(&self) -> bool {
358 *self == Attach::IntNo
359 }
360 #[doc = "Detected"]
361 #[inline(always)]
362 pub fn is_int_yes(&self) -> bool {
363 *self == Attach::IntYes
364 }
365}
366#[doc = "Field `ATTACH` writer - Attach Interrupt Flag"]
367pub type AttachW<'a, REG> = crate::BitWriter1C<'a, REG, Attach>;
368impl<'a, REG> AttachW<'a, REG>
369where
370 REG: crate::Writable + crate::RegisterSpec,
371{
372 #[doc = "Not detected"]
373 #[inline(always)]
374 pub fn int_no(self) -> &'a mut crate::W<REG> {
375 self.variant(Attach::IntNo)
376 }
377 #[doc = "Detected"]
378 #[inline(always)]
379 pub fn int_yes(self) -> &'a mut crate::W<REG> {
380 self.variant(Attach::IntYes)
381 }
382}
383#[doc = "Stall Interrupt Flag\n\nValue on reset: 0"]
384#[cfg_attr(feature = "defmt", derive(defmt::Format))]
385#[derive(Clone, Copy, Debug, PartialEq, Eq)]
386pub enum Stall {
387 #[doc = "0: Interrupt did not occur"]
388 IntNo = 0,
389 #[doc = "1: Interrupt occurred"]
390 IntYes = 1,
391}
392impl From<Stall> for bool {
393 #[inline(always)]
394 fn from(variant: Stall) -> Self {
395 variant as u8 != 0
396 }
397}
398#[doc = "Field `STALL` reader - Stall Interrupt Flag"]
399pub type StallR = crate::BitReader<Stall>;
400impl StallR {
401 #[doc = "Get enumerated values variant"]
402 #[inline(always)]
403 pub const fn variant(&self) -> Stall {
404 match self.bits {
405 false => Stall::IntNo,
406 true => Stall::IntYes,
407 }
408 }
409 #[doc = "Interrupt did not occur"]
410 #[inline(always)]
411 pub fn is_int_no(&self) -> bool {
412 *self == Stall::IntNo
413 }
414 #[doc = "Interrupt occurred"]
415 #[inline(always)]
416 pub fn is_int_yes(&self) -> bool {
417 *self == Stall::IntYes
418 }
419}
420#[doc = "Field `STALL` writer - Stall Interrupt Flag"]
421pub type StallW<'a, REG> = crate::BitWriter1C<'a, REG, Stall>;
422impl<'a, REG> StallW<'a, REG>
423where
424 REG: crate::Writable + crate::RegisterSpec,
425{
426 #[doc = "Interrupt did not occur"]
427 #[inline(always)]
428 pub fn int_no(self) -> &'a mut crate::W<REG> {
429 self.variant(Stall::IntNo)
430 }
431 #[doc = "Interrupt occurred"]
432 #[inline(always)]
433 pub fn int_yes(self) -> &'a mut crate::W<REG> {
434 self.variant(Stall::IntYes)
435 }
436}
437impl R {
438 #[doc = "Bit 0 - USB Reset Flag"]
439 #[inline(always)]
440 pub fn usbrst(&self) -> UsbrstR {
441 UsbrstR::new((self.bits & 1) != 0)
442 }
443 #[doc = "Bit 1 - Error Flag"]
444 #[inline(always)]
445 pub fn error(&self) -> ErrorR {
446 ErrorR::new(((self.bits >> 1) & 1) != 0)
447 }
448 #[doc = "Bit 2 - Start Of Frame (SOF) Token Flag"]
449 #[inline(always)]
450 pub fn softok(&self) -> SoftokR {
451 SoftokR::new(((self.bits >> 2) & 1) != 0)
452 }
453 #[doc = "Bit 3 - Current Token Processing Flag"]
454 #[inline(always)]
455 pub fn tokdne(&self) -> TokdneR {
456 TokdneR::new(((self.bits >> 3) & 1) != 0)
457 }
458 #[doc = "Bit 4 - Sleep Flag"]
459 #[inline(always)]
460 pub fn sleep(&self) -> SleepR {
461 SleepR::new(((self.bits >> 4) & 1) != 0)
462 }
463 #[doc = "Bit 5 - Resume Flag"]
464 #[inline(always)]
465 pub fn resume(&self) -> ResumeR {
466 ResumeR::new(((self.bits >> 5) & 1) != 0)
467 }
468 #[doc = "Bit 6 - Attach Interrupt Flag"]
469 #[inline(always)]
470 pub fn attach(&self) -> AttachR {
471 AttachR::new(((self.bits >> 6) & 1) != 0)
472 }
473 #[doc = "Bit 7 - Stall Interrupt Flag"]
474 #[inline(always)]
475 pub fn stall(&self) -> StallR {
476 StallR::new(((self.bits >> 7) & 1) != 0)
477 }
478}
479#[cfg(feature = "debug")]
480impl core::fmt::Debug for R {
481 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
482 f.debug_struct("ISTAT")
483 .field("usbrst", &self.usbrst())
484 .field("error", &self.error())
485 .field("softok", &self.softok())
486 .field("tokdne", &self.tokdne())
487 .field("sleep", &self.sleep())
488 .field("resume", &self.resume())
489 .field("attach", &self.attach())
490 .field("stall", &self.stall())
491 .finish()
492 }
493}
494impl W {
495 #[doc = "Bit 0 - USB Reset Flag"]
496 #[inline(always)]
497 pub fn usbrst(&mut self) -> UsbrstW<'_, IstatSpec> {
498 UsbrstW::new(self, 0)
499 }
500 #[doc = "Bit 1 - Error Flag"]
501 #[inline(always)]
502 pub fn error(&mut self) -> ErrorW<'_, IstatSpec> {
503 ErrorW::new(self, 1)
504 }
505 #[doc = "Bit 2 - Start Of Frame (SOF) Token Flag"]
506 #[inline(always)]
507 pub fn softok(&mut self) -> SoftokW<'_, IstatSpec> {
508 SoftokW::new(self, 2)
509 }
510 #[doc = "Bit 3 - Current Token Processing Flag"]
511 #[inline(always)]
512 pub fn tokdne(&mut self) -> TokdneW<'_, IstatSpec> {
513 TokdneW::new(self, 3)
514 }
515 #[doc = "Bit 4 - Sleep Flag"]
516 #[inline(always)]
517 pub fn sleep(&mut self) -> SleepW<'_, IstatSpec> {
518 SleepW::new(self, 4)
519 }
520 #[doc = "Bit 5 - Resume Flag"]
521 #[inline(always)]
522 pub fn resume(&mut self) -> ResumeW<'_, IstatSpec> {
523 ResumeW::new(self, 5)
524 }
525 #[doc = "Bit 6 - Attach Interrupt Flag"]
526 #[inline(always)]
527 pub fn attach(&mut self) -> AttachW<'_, IstatSpec> {
528 AttachW::new(self, 6)
529 }
530 #[doc = "Bit 7 - Stall Interrupt Flag"]
531 #[inline(always)]
532 pub fn stall(&mut self) -> StallW<'_, IstatSpec> {
533 StallW::new(self, 7)
534 }
535}
536#[doc = "Interrupt Status\n\nYou can [`read`](crate::Reg::read) this register and get [`istat::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`istat::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
537pub struct IstatSpec;
538impl crate::RegisterSpec for IstatSpec {
539 type Ux = u8;
540}
541#[doc = "`read()` method returns [`istat::R`](R) reader structure"]
542impl crate::Readable for IstatSpec {}
543#[doc = "`write(|w| ..)` method takes [`istat::W`](W) writer structure"]
544impl crate::Writable for IstatSpec {
545 type Safety = crate::Unsafe;
546 const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0xff;
547}
548#[doc = "`reset()` method sets ISTAT to value 0"]
549impl crate::Resettable for IstatSpec {}