xmc4500/vadc/
globiclass.rs

1#[doc = "Register `GLOBICLASS[%s]` reader"]
2pub type R = crate::R<GLOBICLASS_SPEC>;
3#[doc = "Register `GLOBICLASS[%s]` writer"]
4pub type W = crate::W<GLOBICLASS_SPEC>;
5#[doc = "Field `STCS` reader - Sample Time Control for Standard Conversions"]
6pub type STCS_R = crate::FieldReader;
7#[doc = "Field `STCS` writer - Sample Time Control for Standard Conversions"]
8pub type STCS_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
9#[doc = "Conversion Mode for Standard Conversions\n\nValue on reset: 0"]
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11#[repr(u8)]
12pub enum CMS_A {
13    #[doc = "0: 12-bit conversion"]
14    VALUE1 = 0,
15    #[doc = "1: 10-bit conversion"]
16    VALUE2 = 1,
17    #[doc = "2: 8-bit conversion"]
18    VALUE3 = 2,
19    #[doc = "5: 10-bit fast compare mode"]
20    VALUE6 = 5,
21}
22impl From<CMS_A> for u8 {
23    #[inline(always)]
24    fn from(variant: CMS_A) -> Self {
25        variant as _
26    }
27}
28impl crate::FieldSpec for CMS_A {
29    type Ux = u8;
30}
31impl crate::IsEnum for CMS_A {}
32#[doc = "Field `CMS` reader - Conversion Mode for Standard Conversions"]
33pub type CMS_R = crate::FieldReader<CMS_A>;
34impl CMS_R {
35    #[doc = "Get enumerated values variant"]
36    #[inline(always)]
37    pub const fn variant(&self) -> Option<CMS_A> {
38        match self.bits {
39            0 => Some(CMS_A::VALUE1),
40            1 => Some(CMS_A::VALUE2),
41            2 => Some(CMS_A::VALUE3),
42            5 => Some(CMS_A::VALUE6),
43            _ => None,
44        }
45    }
46    #[doc = "12-bit conversion"]
47    #[inline(always)]
48    pub fn is_value1(&self) -> bool {
49        *self == CMS_A::VALUE1
50    }
51    #[doc = "10-bit conversion"]
52    #[inline(always)]
53    pub fn is_value2(&self) -> bool {
54        *self == CMS_A::VALUE2
55    }
56    #[doc = "8-bit conversion"]
57    #[inline(always)]
58    pub fn is_value3(&self) -> bool {
59        *self == CMS_A::VALUE3
60    }
61    #[doc = "10-bit fast compare mode"]
62    #[inline(always)]
63    pub fn is_value6(&self) -> bool {
64        *self == CMS_A::VALUE6
65    }
66}
67#[doc = "Field `CMS` writer - Conversion Mode for Standard Conversions"]
68pub type CMS_W<'a, REG> = crate::FieldWriter<'a, REG, 3, CMS_A>;
69impl<'a, REG> CMS_W<'a, REG>
70where
71    REG: crate::Writable + crate::RegisterSpec,
72    REG::Ux: From<u8>,
73{
74    #[doc = "12-bit conversion"]
75    #[inline(always)]
76    pub fn value1(self) -> &'a mut crate::W<REG> {
77        self.variant(CMS_A::VALUE1)
78    }
79    #[doc = "10-bit conversion"]
80    #[inline(always)]
81    pub fn value2(self) -> &'a mut crate::W<REG> {
82        self.variant(CMS_A::VALUE2)
83    }
84    #[doc = "8-bit conversion"]
85    #[inline(always)]
86    pub fn value3(self) -> &'a mut crate::W<REG> {
87        self.variant(CMS_A::VALUE3)
88    }
89    #[doc = "10-bit fast compare mode"]
90    #[inline(always)]
91    pub fn value6(self) -> &'a mut crate::W<REG> {
92        self.variant(CMS_A::VALUE6)
93    }
94}
95#[doc = "Field `STCE` reader - Sample Time Control for EMUX Conversions"]
96pub type STCE_R = crate::FieldReader;
97#[doc = "Field `STCE` writer - Sample Time Control for EMUX Conversions"]
98pub type STCE_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
99#[doc = "Conversion Mode for EMUX Conversions\n\nValue on reset: 0"]
100#[derive(Clone, Copy, Debug, PartialEq, Eq)]
101#[repr(u8)]
102pub enum CME_A {
103    #[doc = "0: 12-bit conversion"]
104    VALUE1 = 0,
105    #[doc = "1: 10-bit conversion"]
106    VALUE2 = 1,
107    #[doc = "2: 8-bit conversion"]
108    VALUE3 = 2,
109    #[doc = "5: 10-bit fast compare mode"]
110    VALUE6 = 5,
111}
112impl From<CME_A> for u8 {
113    #[inline(always)]
114    fn from(variant: CME_A) -> Self {
115        variant as _
116    }
117}
118impl crate::FieldSpec for CME_A {
119    type Ux = u8;
120}
121impl crate::IsEnum for CME_A {}
122#[doc = "Field `CME` reader - Conversion Mode for EMUX Conversions"]
123pub type CME_R = crate::FieldReader<CME_A>;
124impl CME_R {
125    #[doc = "Get enumerated values variant"]
126    #[inline(always)]
127    pub const fn variant(&self) -> Option<CME_A> {
128        match self.bits {
129            0 => Some(CME_A::VALUE1),
130            1 => Some(CME_A::VALUE2),
131            2 => Some(CME_A::VALUE3),
132            5 => Some(CME_A::VALUE6),
133            _ => None,
134        }
135    }
136    #[doc = "12-bit conversion"]
137    #[inline(always)]
138    pub fn is_value1(&self) -> bool {
139        *self == CME_A::VALUE1
140    }
141    #[doc = "10-bit conversion"]
142    #[inline(always)]
143    pub fn is_value2(&self) -> bool {
144        *self == CME_A::VALUE2
145    }
146    #[doc = "8-bit conversion"]
147    #[inline(always)]
148    pub fn is_value3(&self) -> bool {
149        *self == CME_A::VALUE3
150    }
151    #[doc = "10-bit fast compare mode"]
152    #[inline(always)]
153    pub fn is_value6(&self) -> bool {
154        *self == CME_A::VALUE6
155    }
156}
157#[doc = "Field `CME` writer - Conversion Mode for EMUX Conversions"]
158pub type CME_W<'a, REG> = crate::FieldWriter<'a, REG, 3, CME_A>;
159impl<'a, REG> CME_W<'a, REG>
160where
161    REG: crate::Writable + crate::RegisterSpec,
162    REG::Ux: From<u8>,
163{
164    #[doc = "12-bit conversion"]
165    #[inline(always)]
166    pub fn value1(self) -> &'a mut crate::W<REG> {
167        self.variant(CME_A::VALUE1)
168    }
169    #[doc = "10-bit conversion"]
170    #[inline(always)]
171    pub fn value2(self) -> &'a mut crate::W<REG> {
172        self.variant(CME_A::VALUE2)
173    }
174    #[doc = "8-bit conversion"]
175    #[inline(always)]
176    pub fn value3(self) -> &'a mut crate::W<REG> {
177        self.variant(CME_A::VALUE3)
178    }
179    #[doc = "10-bit fast compare mode"]
180    #[inline(always)]
181    pub fn value6(self) -> &'a mut crate::W<REG> {
182        self.variant(CME_A::VALUE6)
183    }
184}
185impl R {
186    #[doc = "Bits 0:4 - Sample Time Control for Standard Conversions"]
187    #[inline(always)]
188    pub fn stcs(&self) -> STCS_R {
189        STCS_R::new((self.bits & 0x1f) as u8)
190    }
191    #[doc = "Bits 8:10 - Conversion Mode for Standard Conversions"]
192    #[inline(always)]
193    pub fn cms(&self) -> CMS_R {
194        CMS_R::new(((self.bits >> 8) & 7) as u8)
195    }
196    #[doc = "Bits 16:20 - Sample Time Control for EMUX Conversions"]
197    #[inline(always)]
198    pub fn stce(&self) -> STCE_R {
199        STCE_R::new(((self.bits >> 16) & 0x1f) as u8)
200    }
201    #[doc = "Bits 24:26 - Conversion Mode for EMUX Conversions"]
202    #[inline(always)]
203    pub fn cme(&self) -> CME_R {
204        CME_R::new(((self.bits >> 24) & 7) as u8)
205    }
206}
207impl W {
208    #[doc = "Bits 0:4 - Sample Time Control for Standard Conversions"]
209    #[inline(always)]
210    pub fn stcs(&mut self) -> STCS_W<GLOBICLASS_SPEC> {
211        STCS_W::new(self, 0)
212    }
213    #[doc = "Bits 8:10 - Conversion Mode for Standard Conversions"]
214    #[inline(always)]
215    pub fn cms(&mut self) -> CMS_W<GLOBICLASS_SPEC> {
216        CMS_W::new(self, 8)
217    }
218    #[doc = "Bits 16:20 - Sample Time Control for EMUX Conversions"]
219    #[inline(always)]
220    pub fn stce(&mut self) -> STCE_W<GLOBICLASS_SPEC> {
221        STCE_W::new(self, 16)
222    }
223    #[doc = "Bits 24:26 - Conversion Mode for EMUX Conversions"]
224    #[inline(always)]
225    pub fn cme(&mut self) -> CME_W<GLOBICLASS_SPEC> {
226        CME_W::new(self, 24)
227    }
228}
229#[doc = "Input Class Register, Global\n\nYou can [`read`](crate::Reg::read) this register and get [`globiclass::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`globiclass::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
230pub struct GLOBICLASS_SPEC;
231impl crate::RegisterSpec for GLOBICLASS_SPEC {
232    type Ux = u32;
233}
234#[doc = "`read()` method returns [`globiclass::R`](R) reader structure"]
235impl crate::Readable for GLOBICLASS_SPEC {}
236#[doc = "`write(|w| ..)` method takes [`globiclass::W`](W) writer structure"]
237impl crate::Writable for GLOBICLASS_SPEC {
238    type Safety = crate::Unsafe;
239    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
240    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
241}
242#[doc = "`reset()` method sets GLOBICLASS[%s]
243to value 0"]
244impl crate::Resettable for GLOBICLASS_SPEC {
245    const RESET_VALUE: u32 = 0;
246}