xmc4200/vadc/
globtf.rs

1#[doc = "Register `GLOBTF` reader"]
2pub type R = crate::R<GLOBTF_SPEC>;
3#[doc = "Register `GLOBTF` writer"]
4pub type W = crate::W<GLOBTF_SPEC>;
5#[doc = "Field `CDGR` reader - Converter Diagnostics Group"]
6pub type CDGR_R = crate::FieldReader;
7#[doc = "Field `CDGR` writer - Converter Diagnostics Group"]
8pub type CDGR_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
9#[doc = "Converter Diagnostics Enable\n\nValue on reset: 0"]
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11pub enum CDEN_A {
12    #[doc = "0: All diagnostic pull devices are disconnected"]
13    VALUE1 = 0,
14    #[doc = "1: Diagnostic pull devices connected as selected by bitfield CDSEL"]
15    VALUE2 = 1,
16}
17impl From<CDEN_A> for bool {
18    #[inline(always)]
19    fn from(variant: CDEN_A) -> Self {
20        variant as u8 != 0
21    }
22}
23#[doc = "Field `CDEN` reader - Converter Diagnostics Enable"]
24pub type CDEN_R = crate::BitReader<CDEN_A>;
25impl CDEN_R {
26    #[doc = "Get enumerated values variant"]
27    #[inline(always)]
28    pub const fn variant(&self) -> CDEN_A {
29        match self.bits {
30            false => CDEN_A::VALUE1,
31            true => CDEN_A::VALUE2,
32        }
33    }
34    #[doc = "All diagnostic pull devices are disconnected"]
35    #[inline(always)]
36    pub fn is_value1(&self) -> bool {
37        *self == CDEN_A::VALUE1
38    }
39    #[doc = "Diagnostic pull devices connected as selected by bitfield CDSEL"]
40    #[inline(always)]
41    pub fn is_value2(&self) -> bool {
42        *self == CDEN_A::VALUE2
43    }
44}
45#[doc = "Field `CDEN` writer - Converter Diagnostics Enable"]
46pub type CDEN_W<'a, REG> = crate::BitWriter<'a, REG, CDEN_A>;
47impl<'a, REG> CDEN_W<'a, REG>
48where
49    REG: crate::Writable + crate::RegisterSpec,
50{
51    #[doc = "All diagnostic pull devices are disconnected"]
52    #[inline(always)]
53    pub fn value1(self) -> &'a mut crate::W<REG> {
54        self.variant(CDEN_A::VALUE1)
55    }
56    #[doc = "Diagnostic pull devices connected as selected by bitfield CDSEL"]
57    #[inline(always)]
58    pub fn value2(self) -> &'a mut crate::W<REG> {
59        self.variant(CDEN_A::VALUE2)
60    }
61}
62#[doc = "Converter Diagnostics Pull-Devices Select\n\nValue on reset: 0"]
63#[derive(Clone, Copy, Debug, PartialEq, Eq)]
64#[repr(u8)]
65pub enum CDSEL_A {
66    #[doc = "0: Connected to VAREF"]
67    VALUE1 = 0,
68    #[doc = "1: Connected to VAGND"]
69    VALUE2 = 1,
70    #[doc = "2: Connected to 1/3rd VAREF"]
71    VALUE3 = 2,
72    #[doc = "3: Connected to 2/3rd VAREF"]
73    VALUE4 = 3,
74}
75impl From<CDSEL_A> for u8 {
76    #[inline(always)]
77    fn from(variant: CDSEL_A) -> Self {
78        variant as _
79    }
80}
81impl crate::FieldSpec for CDSEL_A {
82    type Ux = u8;
83}
84impl crate::IsEnum for CDSEL_A {}
85#[doc = "Field `CDSEL` reader - Converter Diagnostics Pull-Devices Select"]
86pub type CDSEL_R = crate::FieldReader<CDSEL_A>;
87impl CDSEL_R {
88    #[doc = "Get enumerated values variant"]
89    #[inline(always)]
90    pub const fn variant(&self) -> CDSEL_A {
91        match self.bits {
92            0 => CDSEL_A::VALUE1,
93            1 => CDSEL_A::VALUE2,
94            2 => CDSEL_A::VALUE3,
95            3 => CDSEL_A::VALUE4,
96            _ => unreachable!(),
97        }
98    }
99    #[doc = "Connected to VAREF"]
100    #[inline(always)]
101    pub fn is_value1(&self) -> bool {
102        *self == CDSEL_A::VALUE1
103    }
104    #[doc = "Connected to VAGND"]
105    #[inline(always)]
106    pub fn is_value2(&self) -> bool {
107        *self == CDSEL_A::VALUE2
108    }
109    #[doc = "Connected to 1/3rd VAREF"]
110    #[inline(always)]
111    pub fn is_value3(&self) -> bool {
112        *self == CDSEL_A::VALUE3
113    }
114    #[doc = "Connected to 2/3rd VAREF"]
115    #[inline(always)]
116    pub fn is_value4(&self) -> bool {
117        *self == CDSEL_A::VALUE4
118    }
119}
120#[doc = "Field `CDSEL` writer - Converter Diagnostics Pull-Devices Select"]
121pub type CDSEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CDSEL_A, crate::Safe>;
122impl<'a, REG> CDSEL_W<'a, REG>
123where
124    REG: crate::Writable + crate::RegisterSpec,
125    REG::Ux: From<u8>,
126{
127    #[doc = "Connected to VAREF"]
128    #[inline(always)]
129    pub fn value1(self) -> &'a mut crate::W<REG> {
130        self.variant(CDSEL_A::VALUE1)
131    }
132    #[doc = "Connected to VAGND"]
133    #[inline(always)]
134    pub fn value2(self) -> &'a mut crate::W<REG> {
135        self.variant(CDSEL_A::VALUE2)
136    }
137    #[doc = "Connected to 1/3rd VAREF"]
138    #[inline(always)]
139    pub fn value3(self) -> &'a mut crate::W<REG> {
140        self.variant(CDSEL_A::VALUE3)
141    }
142    #[doc = "Connected to 2/3rd VAREF"]
143    #[inline(always)]
144    pub fn value4(self) -> &'a mut crate::W<REG> {
145        self.variant(CDSEL_A::VALUE4)
146    }
147}
148#[doc = "Write Control for Conversion Diagnostics\n\nValue on reset: 0"]
149#[derive(Clone, Copy, Debug, PartialEq, Eq)]
150pub enum CDWC_A {
151    #[doc = "0: No write access to parameters"]
152    VALUE1 = 0,
153    #[doc = "1: Bitfields CDSEL, CDEN, CDGR can be written"]
154    VALUE2 = 1,
155}
156impl From<CDWC_A> for bool {
157    #[inline(always)]
158    fn from(variant: CDWC_A) -> Self {
159        variant as u8 != 0
160    }
161}
162#[doc = "Field `CDWC` writer - Write Control for Conversion Diagnostics"]
163pub type CDWC_W<'a, REG> = crate::BitWriter<'a, REG, CDWC_A>;
164impl<'a, REG> CDWC_W<'a, REG>
165where
166    REG: crate::Writable + crate::RegisterSpec,
167{
168    #[doc = "No write access to parameters"]
169    #[inline(always)]
170    pub fn value1(self) -> &'a mut crate::W<REG> {
171        self.variant(CDWC_A::VALUE1)
172    }
173    #[doc = "Bitfields CDSEL, CDEN, CDGR can be written"]
174    #[inline(always)]
175    pub fn value2(self) -> &'a mut crate::W<REG> {
176        self.variant(CDWC_A::VALUE2)
177    }
178}
179#[doc = "Pull-Down Diagnostics Enable\n\nValue on reset: 0"]
180#[derive(Clone, Copy, Debug, PartialEq, Eq)]
181pub enum PDD_A {
182    #[doc = "0: Disconnected"]
183    VALUE1 = 0,
184    #[doc = "1: The pull-down diagnostics device is active"]
185    VALUE2 = 1,
186}
187impl From<PDD_A> for bool {
188    #[inline(always)]
189    fn from(variant: PDD_A) -> Self {
190        variant as u8 != 0
191    }
192}
193#[doc = "Field `PDD` reader - Pull-Down Diagnostics Enable"]
194pub type PDD_R = crate::BitReader<PDD_A>;
195impl PDD_R {
196    #[doc = "Get enumerated values variant"]
197    #[inline(always)]
198    pub const fn variant(&self) -> PDD_A {
199        match self.bits {
200            false => PDD_A::VALUE1,
201            true => PDD_A::VALUE2,
202        }
203    }
204    #[doc = "Disconnected"]
205    #[inline(always)]
206    pub fn is_value1(&self) -> bool {
207        *self == PDD_A::VALUE1
208    }
209    #[doc = "The pull-down diagnostics device is active"]
210    #[inline(always)]
211    pub fn is_value2(&self) -> bool {
212        *self == PDD_A::VALUE2
213    }
214}
215#[doc = "Field `PDD` writer - Pull-Down Diagnostics Enable"]
216pub type PDD_W<'a, REG> = crate::BitWriter<'a, REG, PDD_A>;
217impl<'a, REG> PDD_W<'a, REG>
218where
219    REG: crate::Writable + crate::RegisterSpec,
220{
221    #[doc = "Disconnected"]
222    #[inline(always)]
223    pub fn value1(self) -> &'a mut crate::W<REG> {
224        self.variant(PDD_A::VALUE1)
225    }
226    #[doc = "The pull-down diagnostics device is active"]
227    #[inline(always)]
228    pub fn value2(self) -> &'a mut crate::W<REG> {
229        self.variant(PDD_A::VALUE2)
230    }
231}
232#[doc = "Write Control for Multiplexer Diagnostics\n\nValue on reset: 0"]
233#[derive(Clone, Copy, Debug, PartialEq, Eq)]
234pub enum MDWC_A {
235    #[doc = "0: No write access to parameters"]
236    VALUE1 = 0,
237    #[doc = "1: Bitfield PDD can be written"]
238    VALUE2 = 1,
239}
240impl From<MDWC_A> for bool {
241    #[inline(always)]
242    fn from(variant: MDWC_A) -> Self {
243        variant as u8 != 0
244    }
245}
246#[doc = "Field `MDWC` writer - Write Control for Multiplexer Diagnostics"]
247pub type MDWC_W<'a, REG> = crate::BitWriter<'a, REG, MDWC_A>;
248impl<'a, REG> MDWC_W<'a, REG>
249where
250    REG: crate::Writable + crate::RegisterSpec,
251{
252    #[doc = "No write access to parameters"]
253    #[inline(always)]
254    pub fn value1(self) -> &'a mut crate::W<REG> {
255        self.variant(MDWC_A::VALUE1)
256    }
257    #[doc = "Bitfield PDD can be written"]
258    #[inline(always)]
259    pub fn value2(self) -> &'a mut crate::W<REG> {
260        self.variant(MDWC_A::VALUE2)
261    }
262}
263impl R {
264    #[doc = "Bits 4:7 - Converter Diagnostics Group"]
265    #[inline(always)]
266    pub fn cdgr(&self) -> CDGR_R {
267        CDGR_R::new(((self.bits >> 4) & 0x0f) as u8)
268    }
269    #[doc = "Bit 8 - Converter Diagnostics Enable"]
270    #[inline(always)]
271    pub fn cden(&self) -> CDEN_R {
272        CDEN_R::new(((self.bits >> 8) & 1) != 0)
273    }
274    #[doc = "Bits 9:10 - Converter Diagnostics Pull-Devices Select"]
275    #[inline(always)]
276    pub fn cdsel(&self) -> CDSEL_R {
277        CDSEL_R::new(((self.bits >> 9) & 3) as u8)
278    }
279    #[doc = "Bit 16 - Pull-Down Diagnostics Enable"]
280    #[inline(always)]
281    pub fn pdd(&self) -> PDD_R {
282        PDD_R::new(((self.bits >> 16) & 1) != 0)
283    }
284}
285impl W {
286    #[doc = "Bits 4:7 - Converter Diagnostics Group"]
287    #[inline(always)]
288    pub fn cdgr(&mut self) -> CDGR_W<GLOBTF_SPEC> {
289        CDGR_W::new(self, 4)
290    }
291    #[doc = "Bit 8 - Converter Diagnostics Enable"]
292    #[inline(always)]
293    pub fn cden(&mut self) -> CDEN_W<GLOBTF_SPEC> {
294        CDEN_W::new(self, 8)
295    }
296    #[doc = "Bits 9:10 - Converter Diagnostics Pull-Devices Select"]
297    #[inline(always)]
298    pub fn cdsel(&mut self) -> CDSEL_W<GLOBTF_SPEC> {
299        CDSEL_W::new(self, 9)
300    }
301    #[doc = "Bit 15 - Write Control for Conversion Diagnostics"]
302    #[inline(always)]
303    pub fn cdwc(&mut self) -> CDWC_W<GLOBTF_SPEC> {
304        CDWC_W::new(self, 15)
305    }
306    #[doc = "Bit 16 - Pull-Down Diagnostics Enable"]
307    #[inline(always)]
308    pub fn pdd(&mut self) -> PDD_W<GLOBTF_SPEC> {
309        PDD_W::new(self, 16)
310    }
311    #[doc = "Bit 23 - Write Control for Multiplexer Diagnostics"]
312    #[inline(always)]
313    pub fn mdwc(&mut self) -> MDWC_W<GLOBTF_SPEC> {
314        MDWC_W::new(self, 23)
315    }
316}
317#[doc = "Global Test Functions Register\n\nYou can [`read`](crate::Reg::read) this register and get [`globtf::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`globtf::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
318pub struct GLOBTF_SPEC;
319impl crate::RegisterSpec for GLOBTF_SPEC {
320    type Ux = u32;
321}
322#[doc = "`read()` method returns [`globtf::R`](R) reader structure"]
323impl crate::Readable for GLOBTF_SPEC {}
324#[doc = "`write(|w| ..)` method takes [`globtf::W`](W) writer structure"]
325impl crate::Writable for GLOBTF_SPEC {
326    type Safety = crate::Unsafe;
327    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
328    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
329}
330#[doc = "`reset()` method sets GLOBTF to value 0"]
331impl crate::Resettable for GLOBTF_SPEC {
332    const RESET_VALUE: u32 = 0;
333}