xmc4400/vadc/
globrcr.rs

1#[doc = "Register `GLOBRCR` reader"]
2pub type R = crate::R<GLOBRCR_SPEC>;
3#[doc = "Register `GLOBRCR` writer"]
4pub type W = crate::W<GLOBRCR_SPEC>;
5#[doc = "Data Reduction Control\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum DRCTR_A {
9    #[doc = "0: Data reduction disabled"]
10    VALUE1 = 0,
11}
12impl From<DRCTR_A> for u8 {
13    #[inline(always)]
14    fn from(variant: DRCTR_A) -> Self {
15        variant as _
16    }
17}
18impl crate::FieldSpec for DRCTR_A {
19    type Ux = u8;
20}
21impl crate::IsEnum for DRCTR_A {}
22#[doc = "Field `DRCTR` reader - Data Reduction Control"]
23pub type DRCTR_R = crate::FieldReader<DRCTR_A>;
24impl DRCTR_R {
25    #[doc = "Get enumerated values variant"]
26    #[inline(always)]
27    pub const fn variant(&self) -> Option<DRCTR_A> {
28        match self.bits {
29            0 => Some(DRCTR_A::VALUE1),
30            _ => None,
31        }
32    }
33    #[doc = "Data reduction disabled"]
34    #[inline(always)]
35    pub fn is_value1(&self) -> bool {
36        *self == DRCTR_A::VALUE1
37    }
38}
39#[doc = "Field `DRCTR` writer - Data Reduction Control"]
40pub type DRCTR_W<'a, REG> = crate::FieldWriter<'a, REG, 4, DRCTR_A>;
41impl<'a, REG> DRCTR_W<'a, REG>
42where
43    REG: crate::Writable + crate::RegisterSpec,
44    REG::Ux: From<u8>,
45{
46    #[doc = "Data reduction disabled"]
47    #[inline(always)]
48    pub fn value1(self) -> &'a mut crate::W<REG> {
49        self.variant(DRCTR_A::VALUE1)
50    }
51}
52#[doc = "Wait-for-Read Mode Enable\n\nValue on reset: 0"]
53#[derive(Clone, Copy, Debug, PartialEq, Eq)]
54pub enum WFR_A {
55    #[doc = "0: Overwrite mode"]
56    VALUE1 = 0,
57    #[doc = "1: Wait-for-read mode enabled for this register"]
58    VALUE2 = 1,
59}
60impl From<WFR_A> for bool {
61    #[inline(always)]
62    fn from(variant: WFR_A) -> Self {
63        variant as u8 != 0
64    }
65}
66#[doc = "Field `WFR` reader - Wait-for-Read Mode Enable"]
67pub type WFR_R = crate::BitReader<WFR_A>;
68impl WFR_R {
69    #[doc = "Get enumerated values variant"]
70    #[inline(always)]
71    pub const fn variant(&self) -> WFR_A {
72        match self.bits {
73            false => WFR_A::VALUE1,
74            true => WFR_A::VALUE2,
75        }
76    }
77    #[doc = "Overwrite mode"]
78    #[inline(always)]
79    pub fn is_value1(&self) -> bool {
80        *self == WFR_A::VALUE1
81    }
82    #[doc = "Wait-for-read mode enabled for this register"]
83    #[inline(always)]
84    pub fn is_value2(&self) -> bool {
85        *self == WFR_A::VALUE2
86    }
87}
88#[doc = "Field `WFR` writer - Wait-for-Read Mode Enable"]
89pub type WFR_W<'a, REG> = crate::BitWriter<'a, REG, WFR_A>;
90impl<'a, REG> WFR_W<'a, REG>
91where
92    REG: crate::Writable + crate::RegisterSpec,
93{
94    #[doc = "Overwrite mode"]
95    #[inline(always)]
96    pub fn value1(self) -> &'a mut crate::W<REG> {
97        self.variant(WFR_A::VALUE1)
98    }
99    #[doc = "Wait-for-read mode enabled for this register"]
100    #[inline(always)]
101    pub fn value2(self) -> &'a mut crate::W<REG> {
102        self.variant(WFR_A::VALUE2)
103    }
104}
105#[doc = "Service Request Generation Enable\n\nValue on reset: 0"]
106#[derive(Clone, Copy, Debug, PartialEq, Eq)]
107pub enum SRGEN_A {
108    #[doc = "0: No service request"]
109    VALUE1 = 0,
110    #[doc = "1: Service request after a result event"]
111    VALUE2 = 1,
112}
113impl From<SRGEN_A> for bool {
114    #[inline(always)]
115    fn from(variant: SRGEN_A) -> Self {
116        variant as u8 != 0
117    }
118}
119#[doc = "Field `SRGEN` reader - Service Request Generation Enable"]
120pub type SRGEN_R = crate::BitReader<SRGEN_A>;
121impl SRGEN_R {
122    #[doc = "Get enumerated values variant"]
123    #[inline(always)]
124    pub const fn variant(&self) -> SRGEN_A {
125        match self.bits {
126            false => SRGEN_A::VALUE1,
127            true => SRGEN_A::VALUE2,
128        }
129    }
130    #[doc = "No service request"]
131    #[inline(always)]
132    pub fn is_value1(&self) -> bool {
133        *self == SRGEN_A::VALUE1
134    }
135    #[doc = "Service request after a result event"]
136    #[inline(always)]
137    pub fn is_value2(&self) -> bool {
138        *self == SRGEN_A::VALUE2
139    }
140}
141#[doc = "Field `SRGEN` writer - Service Request Generation Enable"]
142pub type SRGEN_W<'a, REG> = crate::BitWriter<'a, REG, SRGEN_A>;
143impl<'a, REG> SRGEN_W<'a, REG>
144where
145    REG: crate::Writable + crate::RegisterSpec,
146{
147    #[doc = "No service request"]
148    #[inline(always)]
149    pub fn value1(self) -> &'a mut crate::W<REG> {
150        self.variant(SRGEN_A::VALUE1)
151    }
152    #[doc = "Service request after a result event"]
153    #[inline(always)]
154    pub fn value2(self) -> &'a mut crate::W<REG> {
155        self.variant(SRGEN_A::VALUE2)
156    }
157}
158impl R {
159    #[doc = "Bits 16:19 - Data Reduction Control"]
160    #[inline(always)]
161    pub fn drctr(&self) -> DRCTR_R {
162        DRCTR_R::new(((self.bits >> 16) & 0x0f) as u8)
163    }
164    #[doc = "Bit 24 - Wait-for-Read Mode Enable"]
165    #[inline(always)]
166    pub fn wfr(&self) -> WFR_R {
167        WFR_R::new(((self.bits >> 24) & 1) != 0)
168    }
169    #[doc = "Bit 31 - Service Request Generation Enable"]
170    #[inline(always)]
171    pub fn srgen(&self) -> SRGEN_R {
172        SRGEN_R::new(((self.bits >> 31) & 1) != 0)
173    }
174}
175impl W {
176    #[doc = "Bits 16:19 - Data Reduction Control"]
177    #[inline(always)]
178    pub fn drctr(&mut self) -> DRCTR_W<GLOBRCR_SPEC> {
179        DRCTR_W::new(self, 16)
180    }
181    #[doc = "Bit 24 - Wait-for-Read Mode Enable"]
182    #[inline(always)]
183    pub fn wfr(&mut self) -> WFR_W<GLOBRCR_SPEC> {
184        WFR_W::new(self, 24)
185    }
186    #[doc = "Bit 31 - Service Request Generation Enable"]
187    #[inline(always)]
188    pub fn srgen(&mut self) -> SRGEN_W<GLOBRCR_SPEC> {
189        SRGEN_W::new(self, 31)
190    }
191}
192#[doc = "Global Result Control Register\n\nYou can [`read`](crate::Reg::read) this register and get [`globrcr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`globrcr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
193pub struct GLOBRCR_SPEC;
194impl crate::RegisterSpec for GLOBRCR_SPEC {
195    type Ux = u32;
196}
197#[doc = "`read()` method returns [`globrcr::R`](R) reader structure"]
198impl crate::Readable for GLOBRCR_SPEC {}
199#[doc = "`write(|w| ..)` method takes [`globrcr::W`](W) writer structure"]
200impl crate::Writable for GLOBRCR_SPEC {
201    type Safety = crate::Unsafe;
202    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
203    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
204}
205#[doc = "`reset()` method sets GLOBRCR to value 0"]
206impl crate::Resettable for GLOBRCR_SPEC {
207    const RESET_VALUE: u32 = 0;
208}