atsamd11c/dsu/
did.rs

1#[doc = "Register `DID` reader"]
2pub type R = crate::R<DidSpec>;
3#[doc = "Field `DEVSEL` reader - Device Select"]
4pub type DevselR = crate::FieldReader;
5#[doc = "Field `REVISION` reader - Revision Number"]
6pub type RevisionR = crate::FieldReader;
7#[doc = "Field `DIE` reader - Die Number"]
8pub type DieR = crate::FieldReader;
9#[doc = "Series\n\nValue on reset: 3"]
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11#[repr(u8)]
12pub enum Seriesselect {
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<Seriesselect> for u8 {
19    #[inline(always)]
20    fn from(variant: Seriesselect) -> Self {
21        variant as _
22    }
23}
24impl crate::FieldSpec for Seriesselect {
25    type Ux = u8;
26}
27impl crate::IsEnum for Seriesselect {}
28#[doc = "Field `SERIES` reader - Series"]
29pub type SeriesR = crate::FieldReader<Seriesselect>;
30impl SeriesR {
31    #[doc = "Get enumerated values variant"]
32    #[inline(always)]
33    pub const fn variant(&self) -> Option<Seriesselect> {
34        match self.bits {
35            0 => Some(Seriesselect::_0),
36            1 => Some(Seriesselect::_1),
37            _ => None,
38        }
39    }
40    #[doc = "Cortex-M0+ processor, basic feature set"]
41    #[inline(always)]
42    pub fn is_0(&self) -> bool {
43        *self == Seriesselect::_0
44    }
45    #[doc = "Cortex-M0+ processor, USB"]
46    #[inline(always)]
47    pub fn is_1(&self) -> bool {
48        *self == Seriesselect::_1
49    }
50}
51#[doc = "Family\n\nValue on reset: 0"]
52#[derive(Clone, Copy, Debug, PartialEq, Eq)]
53#[repr(u8)]
54pub enum Familyselect {
55    #[doc = "0: General purpose microcontroller"]
56    _0 = 0,
57    #[doc = "1: PicoPower"]
58    _1 = 1,
59}
60impl From<Familyselect> for u8 {
61    #[inline(always)]
62    fn from(variant: Familyselect) -> Self {
63        variant as _
64    }
65}
66impl crate::FieldSpec for Familyselect {
67    type Ux = u8;
68}
69impl crate::IsEnum for Familyselect {}
70#[doc = "Field `FAMILY` reader - Family"]
71pub type FamilyR = crate::FieldReader<Familyselect>;
72impl FamilyR {
73    #[doc = "Get enumerated values variant"]
74    #[inline(always)]
75    pub const fn variant(&self) -> Option<Familyselect> {
76        match self.bits {
77            0 => Some(Familyselect::_0),
78            1 => Some(Familyselect::_1),
79            _ => None,
80        }
81    }
82    #[doc = "General purpose microcontroller"]
83    #[inline(always)]
84    pub fn is_0(&self) -> bool {
85        *self == Familyselect::_0
86    }
87    #[doc = "PicoPower"]
88    #[inline(always)]
89    pub fn is_1(&self) -> bool {
90        *self == Familyselect::_1
91    }
92}
93#[doc = "Processor\n\nValue on reset: 1"]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95#[repr(u8)]
96pub enum Processorselect {
97    #[doc = "0: Cortex-M0"]
98    _0 = 0,
99    #[doc = "1: Cortex-M0+"]
100    _1 = 1,
101    #[doc = "2: Cortex-M3"]
102    _2 = 2,
103    #[doc = "3: Cortex-M4"]
104    _3 = 3,
105}
106impl From<Processorselect> for u8 {
107    #[inline(always)]
108    fn from(variant: Processorselect) -> Self {
109        variant as _
110    }
111}
112impl crate::FieldSpec for Processorselect {
113    type Ux = u8;
114}
115impl crate::IsEnum for Processorselect {}
116#[doc = "Field `PROCESSOR` reader - Processor"]
117pub type ProcessorR = crate::FieldReader<Processorselect>;
118impl ProcessorR {
119    #[doc = "Get enumerated values variant"]
120    #[inline(always)]
121    pub const fn variant(&self) -> Option<Processorselect> {
122        match self.bits {
123            0 => Some(Processorselect::_0),
124            1 => Some(Processorselect::_1),
125            2 => Some(Processorselect::_2),
126            3 => Some(Processorselect::_3),
127            _ => None,
128        }
129    }
130    #[doc = "Cortex-M0"]
131    #[inline(always)]
132    pub fn is_0(&self) -> bool {
133        *self == Processorselect::_0
134    }
135    #[doc = "Cortex-M0+"]
136    #[inline(always)]
137    pub fn is_1(&self) -> bool {
138        *self == Processorselect::_1
139    }
140    #[doc = "Cortex-M3"]
141    #[inline(always)]
142    pub fn is_2(&self) -> bool {
143        *self == Processorselect::_2
144    }
145    #[doc = "Cortex-M4"]
146    #[inline(always)]
147    pub fn is_3(&self) -> bool {
148        *self == Processorselect::_3
149    }
150}
151impl R {
152    #[doc = "Bits 0:7 - Device Select"]
153    #[inline(always)]
154    pub fn devsel(&self) -> DevselR {
155        DevselR::new((self.bits & 0xff) as u8)
156    }
157    #[doc = "Bits 8:11 - Revision Number"]
158    #[inline(always)]
159    pub fn revision(&self) -> RevisionR {
160        RevisionR::new(((self.bits >> 8) & 0x0f) as u8)
161    }
162    #[doc = "Bits 12:15 - Die Number"]
163    #[inline(always)]
164    pub fn die(&self) -> DieR {
165        DieR::new(((self.bits >> 12) & 0x0f) as u8)
166    }
167    #[doc = "Bits 16:21 - Series"]
168    #[inline(always)]
169    pub fn series(&self) -> SeriesR {
170        SeriesR::new(((self.bits >> 16) & 0x3f) as u8)
171    }
172    #[doc = "Bits 23:27 - Family"]
173    #[inline(always)]
174    pub fn family(&self) -> FamilyR {
175        FamilyR::new(((self.bits >> 23) & 0x1f) as u8)
176    }
177    #[doc = "Bits 28:31 - Processor"]
178    #[inline(always)]
179    pub fn processor(&self) -> ProcessorR {
180        ProcessorR::new(((self.bits >> 28) & 0x0f) as u8)
181    }
182}
183#[doc = "Device Identification\n\nYou can [`read`](crate::Reg::read) this register and get [`did::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
184pub struct DidSpec;
185impl crate::RegisterSpec for DidSpec {
186    type Ux = u32;
187}
188#[doc = "`read()` method returns [`did::R`](R) reader structure"]
189impl crate::Readable for DidSpec {}
190#[doc = "`reset()` method sets DID to value 0x1003_0106"]
191impl crate::Resettable for DidSpec {
192    const RESET_VALUE: u32 = 0x1003_0106;
193}