atsame70n21/usbhs/
usbhs_devfnum.rs1#[doc = "Register `USBHS_DEVFNUM` reader"]
2pub struct R(crate::R<USBHS_DEVFNUM_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<USBHS_DEVFNUM_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<USBHS_DEVFNUM_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<USBHS_DEVFNUM_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Field `MFNUM` reader - Micro Frame Number"]
17pub struct MFNUM_R(crate::FieldReader<u8, u8>);
18impl MFNUM_R {
19 #[inline(always)]
20 pub(crate) fn new(bits: u8) -> Self {
21 MFNUM_R(crate::FieldReader::new(bits))
22 }
23}
24impl core::ops::Deref for MFNUM_R {
25 type Target = crate::FieldReader<u8, u8>;
26 #[inline(always)]
27 fn deref(&self) -> &Self::Target {
28 &self.0
29 }
30}
31#[doc = "Field `FNUM` reader - Frame Number"]
32pub struct FNUM_R(crate::FieldReader<u16, u16>);
33impl FNUM_R {
34 #[inline(always)]
35 pub(crate) fn new(bits: u16) -> Self {
36 FNUM_R(crate::FieldReader::new(bits))
37 }
38}
39impl core::ops::Deref for FNUM_R {
40 type Target = crate::FieldReader<u16, u16>;
41 #[inline(always)]
42 fn deref(&self) -> &Self::Target {
43 &self.0
44 }
45}
46#[doc = "Field `FNCERR` reader - Frame Number CRC Error"]
47pub struct FNCERR_R(crate::FieldReader<bool, bool>);
48impl FNCERR_R {
49 #[inline(always)]
50 pub(crate) fn new(bits: bool) -> Self {
51 FNCERR_R(crate::FieldReader::new(bits))
52 }
53}
54impl core::ops::Deref for FNCERR_R {
55 type Target = crate::FieldReader<bool, bool>;
56 #[inline(always)]
57 fn deref(&self) -> &Self::Target {
58 &self.0
59 }
60}
61impl R {
62 #[doc = "Bits 0:2 - Micro Frame Number"]
63 #[inline(always)]
64 pub fn mfnum(&self) -> MFNUM_R {
65 MFNUM_R::new((self.bits & 0x07) as u8)
66 }
67 #[doc = "Bits 3:13 - Frame Number"]
68 #[inline(always)]
69 pub fn fnum(&self) -> FNUM_R {
70 FNUM_R::new(((self.bits >> 3) & 0x07ff) as u16)
71 }
72 #[doc = "Bit 15 - Frame Number CRC Error"]
73 #[inline(always)]
74 pub fn fncerr(&self) -> FNCERR_R {
75 FNCERR_R::new(((self.bits >> 15) & 0x01) != 0)
76 }
77}
78#[doc = "Device Frame Number Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [usbhs_devfnum](index.html) module"]
79pub struct USBHS_DEVFNUM_SPEC;
80impl crate::RegisterSpec for USBHS_DEVFNUM_SPEC {
81 type Ux = u32;
82}
83#[doc = "`read()` method returns [usbhs_devfnum::R](R) reader structure"]
84impl crate::Readable for USBHS_DEVFNUM_SPEC {
85 type Reader = R;
86}
87#[doc = "`reset()` method sets USBHS_DEVFNUM to value 0"]
88impl crate::Resettable for USBHS_DEVFNUM_SPEC {
89 #[inline(always)]
90 fn reset_value() -> Self::Ux {
91 0
92 }
93}