Skip to main content

atsamd51p20a/dsu/
did.rs

1#[doc = "Reader of register DID"]
2pub type R = crate::R<u32, super::DID>;
3#[doc = "Reader of field `DEVSEL`"]
4pub type DEVSEL_R = crate::R<u8, u8>;
5#[doc = "Reader of field `REVISION`"]
6pub type REVISION_R = crate::R<u8, u8>;
7#[doc = "Reader of field `DIE`"]
8pub type DIE_R = crate::R<u8, u8>;
9#[doc = "Series\n\nValue on reset: 6"]
10#[derive(Clone, Copy, Debug, PartialEq)]
11#[repr(u8)]
12pub enum SERIES_A {
13    #[doc = "0: Cortex-M0+ processor, basic feature set"]
14    _0 = 0,
15    #[doc = "1: Cortex-M0+ processor, USB"]
16    _1 = 1,
17}
18impl From<SERIES_A> for u8 {
19    #[inline(always)]
20    fn from(variant: SERIES_A) -> Self {
21        variant as _
22    }
23}
24#[doc = "Reader of field `SERIES`"]
25pub type SERIES_R = crate::R<u8, SERIES_A>;
26impl SERIES_R {
27    #[doc = r"Get enumerated values variant"]
28    #[inline(always)]
29    pub fn variant(&self) -> crate::Variant<u8, SERIES_A> {
30        use crate::Variant::*;
31        match self.bits {
32            0 => Val(SERIES_A::_0),
33            1 => Val(SERIES_A::_1),
34            i => Res(i),
35        }
36    }
37    #[doc = "Checks if the value of the field is `_0`"]
38    #[inline(always)]
39    pub fn is_0(&self) -> bool {
40        *self == SERIES_A::_0
41    }
42    #[doc = "Checks if the value of the field is `_1`"]
43    #[inline(always)]
44    pub fn is_1(&self) -> bool {
45        *self == SERIES_A::_1
46    }
47}
48#[doc = "Family\n\nValue on reset: 0"]
49#[derive(Clone, Copy, Debug, PartialEq)]
50#[repr(u8)]
51pub enum FAMILY_A {
52    #[doc = "0: General purpose microcontroller"]
53    _0 = 0,
54    #[doc = "1: PicoPower"]
55    _1 = 1,
56}
57impl From<FAMILY_A> for u8 {
58    #[inline(always)]
59    fn from(variant: FAMILY_A) -> Self {
60        variant as _
61    }
62}
63#[doc = "Reader of field `FAMILY`"]
64pub type FAMILY_R = crate::R<u8, FAMILY_A>;
65impl FAMILY_R {
66    #[doc = r"Get enumerated values variant"]
67    #[inline(always)]
68    pub fn variant(&self) -> crate::Variant<u8, FAMILY_A> {
69        use crate::Variant::*;
70        match self.bits {
71            0 => Val(FAMILY_A::_0),
72            1 => Val(FAMILY_A::_1),
73            i => Res(i),
74        }
75    }
76    #[doc = "Checks if the value of the field is `_0`"]
77    #[inline(always)]
78    pub fn is_0(&self) -> bool {
79        *self == FAMILY_A::_0
80    }
81    #[doc = "Checks if the value of the field is `_1`"]
82    #[inline(always)]
83    pub fn is_1(&self) -> bool {
84        *self == FAMILY_A::_1
85    }
86}
87#[doc = "Processor\n\nValue on reset: 6"]
88#[derive(Clone, Copy, Debug, PartialEq)]
89#[repr(u8)]
90pub enum PROCESSOR_A {
91    #[doc = "1: Cortex-M0+"]
92    CM0P = 1,
93    #[doc = "2: Cortex-M23"]
94    CM23 = 2,
95    #[doc = "3: Cortex-M3"]
96    CM3 = 3,
97    #[doc = "5: Cortex-M4"]
98    CM4 = 5,
99    #[doc = "6: Cortex-M4 with FPU"]
100    CM4F = 6,
101    #[doc = "7: Cortex-M33"]
102    CM33 = 7,
103}
104impl From<PROCESSOR_A> for u8 {
105    #[inline(always)]
106    fn from(variant: PROCESSOR_A) -> Self {
107        variant as _
108    }
109}
110#[doc = "Reader of field `PROCESSOR`"]
111pub type PROCESSOR_R = crate::R<u8, PROCESSOR_A>;
112impl PROCESSOR_R {
113    #[doc = r"Get enumerated values variant"]
114    #[inline(always)]
115    pub fn variant(&self) -> crate::Variant<u8, PROCESSOR_A> {
116        use crate::Variant::*;
117        match self.bits {
118            1 => Val(PROCESSOR_A::CM0P),
119            2 => Val(PROCESSOR_A::CM23),
120            3 => Val(PROCESSOR_A::CM3),
121            5 => Val(PROCESSOR_A::CM4),
122            6 => Val(PROCESSOR_A::CM4F),
123            7 => Val(PROCESSOR_A::CM33),
124            i => Res(i),
125        }
126    }
127    #[doc = "Checks if the value of the field is `CM0P`"]
128    #[inline(always)]
129    pub fn is_cm0p(&self) -> bool {
130        *self == PROCESSOR_A::CM0P
131    }
132    #[doc = "Checks if the value of the field is `CM23`"]
133    #[inline(always)]
134    pub fn is_cm23(&self) -> bool {
135        *self == PROCESSOR_A::CM23
136    }
137    #[doc = "Checks if the value of the field is `CM3`"]
138    #[inline(always)]
139    pub fn is_cm3(&self) -> bool {
140        *self == PROCESSOR_A::CM3
141    }
142    #[doc = "Checks if the value of the field is `CM4`"]
143    #[inline(always)]
144    pub fn is_cm4(&self) -> bool {
145        *self == PROCESSOR_A::CM4
146    }
147    #[doc = "Checks if the value of the field is `CM4F`"]
148    #[inline(always)]
149    pub fn is_cm4f(&self) -> bool {
150        *self == PROCESSOR_A::CM4F
151    }
152    #[doc = "Checks if the value of the field is `CM33`"]
153    #[inline(always)]
154    pub fn is_cm33(&self) -> bool {
155        *self == PROCESSOR_A::CM33
156    }
157}
158impl R {
159    #[doc = "Bits 0:7 - Device Select"]
160    #[inline(always)]
161    pub fn devsel(&self) -> DEVSEL_R {
162        DEVSEL_R::new((self.bits & 0xff) as u8)
163    }
164    #[doc = "Bits 8:11 - Revision Number"]
165    #[inline(always)]
166    pub fn revision(&self) -> REVISION_R {
167        REVISION_R::new(((self.bits >> 8) & 0x0f) as u8)
168    }
169    #[doc = "Bits 12:15 - Die Number"]
170    #[inline(always)]
171    pub fn die(&self) -> DIE_R {
172        DIE_R::new(((self.bits >> 12) & 0x0f) as u8)
173    }
174    #[doc = "Bits 16:21 - Series"]
175    #[inline(always)]
176    pub fn series(&self) -> SERIES_R {
177        SERIES_R::new(((self.bits >> 16) & 0x3f) as u8)
178    }
179    #[doc = "Bits 23:27 - Family"]
180    #[inline(always)]
181    pub fn family(&self) -> FAMILY_R {
182        FAMILY_R::new(((self.bits >> 23) & 0x1f) as u8)
183    }
184    #[doc = "Bits 28:31 - Processor"]
185    #[inline(always)]
186    pub fn processor(&self) -> PROCESSOR_R {
187        PROCESSOR_R::new(((self.bits >> 28) & 0x0f) as u8)
188    }
189}