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