xmc4800/dsd/
globrc.rs

1#[doc = "Register `GLOBRC` reader"]
2pub type R = crate::R<GLOBRC_SPEC>;
3#[doc = "Register `GLOBRC` writer"]
4pub type W = crate::W<GLOBRC_SPEC>;
5#[doc = "Channel 0 Run Control\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum CH0RUN_A {
8    #[doc = "0: Stop channel x"]
9    VALUE1 = 0,
10    #[doc = "1: Demodulator channel x is enabled and runs"]
11    VALUE2 = 1,
12}
13impl From<CH0RUN_A> for bool {
14    #[inline(always)]
15    fn from(variant: CH0RUN_A) -> Self {
16        variant as u8 != 0
17    }
18}
19#[doc = "Field `CH0RUN` reader - Channel 0 Run Control"]
20pub type CH0RUN_R = crate::BitReader<CH0RUN_A>;
21impl CH0RUN_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> CH0RUN_A {
25        match self.bits {
26            false => CH0RUN_A::VALUE1,
27            true => CH0RUN_A::VALUE2,
28        }
29    }
30    #[doc = "Stop channel x"]
31    #[inline(always)]
32    pub fn is_value1(&self) -> bool {
33        *self == CH0RUN_A::VALUE1
34    }
35    #[doc = "Demodulator channel x is enabled and runs"]
36    #[inline(always)]
37    pub fn is_value2(&self) -> bool {
38        *self == CH0RUN_A::VALUE2
39    }
40}
41#[doc = "Field `CH0RUN` writer - Channel 0 Run Control"]
42pub type CH0RUN_W<'a, REG> = crate::BitWriter<'a, REG, CH0RUN_A>;
43impl<'a, REG> CH0RUN_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "Stop channel x"]
48    #[inline(always)]
49    pub fn value1(self) -> &'a mut crate::W<REG> {
50        self.variant(CH0RUN_A::VALUE1)
51    }
52    #[doc = "Demodulator channel x is enabled and runs"]
53    #[inline(always)]
54    pub fn value2(self) -> &'a mut crate::W<REG> {
55        self.variant(CH0RUN_A::VALUE2)
56    }
57}
58#[doc = "Channel 1 Run Control\n\nValue on reset: 0"]
59#[derive(Clone, Copy, Debug, PartialEq, Eq)]
60pub enum CH1RUN_A {
61    #[doc = "0: Stop channel x"]
62    VALUE1 = 0,
63    #[doc = "1: Demodulator channel x is enabled and runs"]
64    VALUE2 = 1,
65}
66impl From<CH1RUN_A> for bool {
67    #[inline(always)]
68    fn from(variant: CH1RUN_A) -> Self {
69        variant as u8 != 0
70    }
71}
72#[doc = "Field `CH1RUN` reader - Channel 1 Run Control"]
73pub type CH1RUN_R = crate::BitReader<CH1RUN_A>;
74impl CH1RUN_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub const fn variant(&self) -> CH1RUN_A {
78        match self.bits {
79            false => CH1RUN_A::VALUE1,
80            true => CH1RUN_A::VALUE2,
81        }
82    }
83    #[doc = "Stop channel x"]
84    #[inline(always)]
85    pub fn is_value1(&self) -> bool {
86        *self == CH1RUN_A::VALUE1
87    }
88    #[doc = "Demodulator channel x is enabled and runs"]
89    #[inline(always)]
90    pub fn is_value2(&self) -> bool {
91        *self == CH1RUN_A::VALUE2
92    }
93}
94#[doc = "Field `CH1RUN` writer - Channel 1 Run Control"]
95pub type CH1RUN_W<'a, REG> = crate::BitWriter<'a, REG, CH1RUN_A>;
96impl<'a, REG> CH1RUN_W<'a, REG>
97where
98    REG: crate::Writable + crate::RegisterSpec,
99{
100    #[doc = "Stop channel x"]
101    #[inline(always)]
102    pub fn value1(self) -> &'a mut crate::W<REG> {
103        self.variant(CH1RUN_A::VALUE1)
104    }
105    #[doc = "Demodulator channel x is enabled and runs"]
106    #[inline(always)]
107    pub fn value2(self) -> &'a mut crate::W<REG> {
108        self.variant(CH1RUN_A::VALUE2)
109    }
110}
111#[doc = "Channel 2 Run Control\n\nValue on reset: 0"]
112#[derive(Clone, Copy, Debug, PartialEq, Eq)]
113pub enum CH2RUN_A {
114    #[doc = "0: Stop channel x"]
115    VALUE1 = 0,
116    #[doc = "1: Demodulator channel x is enabled and runs"]
117    VALUE2 = 1,
118}
119impl From<CH2RUN_A> for bool {
120    #[inline(always)]
121    fn from(variant: CH2RUN_A) -> Self {
122        variant as u8 != 0
123    }
124}
125#[doc = "Field `CH2RUN` reader - Channel 2 Run Control"]
126pub type CH2RUN_R = crate::BitReader<CH2RUN_A>;
127impl CH2RUN_R {
128    #[doc = "Get enumerated values variant"]
129    #[inline(always)]
130    pub const fn variant(&self) -> CH2RUN_A {
131        match self.bits {
132            false => CH2RUN_A::VALUE1,
133            true => CH2RUN_A::VALUE2,
134        }
135    }
136    #[doc = "Stop channel x"]
137    #[inline(always)]
138    pub fn is_value1(&self) -> bool {
139        *self == CH2RUN_A::VALUE1
140    }
141    #[doc = "Demodulator channel x is enabled and runs"]
142    #[inline(always)]
143    pub fn is_value2(&self) -> bool {
144        *self == CH2RUN_A::VALUE2
145    }
146}
147#[doc = "Field `CH2RUN` writer - Channel 2 Run Control"]
148pub type CH2RUN_W<'a, REG> = crate::BitWriter<'a, REG, CH2RUN_A>;
149impl<'a, REG> CH2RUN_W<'a, REG>
150where
151    REG: crate::Writable + crate::RegisterSpec,
152{
153    #[doc = "Stop channel x"]
154    #[inline(always)]
155    pub fn value1(self) -> &'a mut crate::W<REG> {
156        self.variant(CH2RUN_A::VALUE1)
157    }
158    #[doc = "Demodulator channel x is enabled and runs"]
159    #[inline(always)]
160    pub fn value2(self) -> &'a mut crate::W<REG> {
161        self.variant(CH2RUN_A::VALUE2)
162    }
163}
164#[doc = "Channel 3 Run Control\n\nValue on reset: 0"]
165#[derive(Clone, Copy, Debug, PartialEq, Eq)]
166pub enum CH3RUN_A {
167    #[doc = "0: Stop channel x"]
168    VALUE1 = 0,
169    #[doc = "1: Demodulator channel x is enabled and runs"]
170    VALUE2 = 1,
171}
172impl From<CH3RUN_A> for bool {
173    #[inline(always)]
174    fn from(variant: CH3RUN_A) -> Self {
175        variant as u8 != 0
176    }
177}
178#[doc = "Field `CH3RUN` reader - Channel 3 Run Control"]
179pub type CH3RUN_R = crate::BitReader<CH3RUN_A>;
180impl CH3RUN_R {
181    #[doc = "Get enumerated values variant"]
182    #[inline(always)]
183    pub const fn variant(&self) -> CH3RUN_A {
184        match self.bits {
185            false => CH3RUN_A::VALUE1,
186            true => CH3RUN_A::VALUE2,
187        }
188    }
189    #[doc = "Stop channel x"]
190    #[inline(always)]
191    pub fn is_value1(&self) -> bool {
192        *self == CH3RUN_A::VALUE1
193    }
194    #[doc = "Demodulator channel x is enabled and runs"]
195    #[inline(always)]
196    pub fn is_value2(&self) -> bool {
197        *self == CH3RUN_A::VALUE2
198    }
199}
200#[doc = "Field `CH3RUN` writer - Channel 3 Run Control"]
201pub type CH3RUN_W<'a, REG> = crate::BitWriter<'a, REG, CH3RUN_A>;
202impl<'a, REG> CH3RUN_W<'a, REG>
203where
204    REG: crate::Writable + crate::RegisterSpec,
205{
206    #[doc = "Stop channel x"]
207    #[inline(always)]
208    pub fn value1(self) -> &'a mut crate::W<REG> {
209        self.variant(CH3RUN_A::VALUE1)
210    }
211    #[doc = "Demodulator channel x is enabled and runs"]
212    #[inline(always)]
213    pub fn value2(self) -> &'a mut crate::W<REG> {
214        self.variant(CH3RUN_A::VALUE2)
215    }
216}
217impl R {
218    #[doc = "Bit 0 - Channel 0 Run Control"]
219    #[inline(always)]
220    pub fn ch0run(&self) -> CH0RUN_R {
221        CH0RUN_R::new((self.bits & 1) != 0)
222    }
223    #[doc = "Bit 1 - Channel 1 Run Control"]
224    #[inline(always)]
225    pub fn ch1run(&self) -> CH1RUN_R {
226        CH1RUN_R::new(((self.bits >> 1) & 1) != 0)
227    }
228    #[doc = "Bit 2 - Channel 2 Run Control"]
229    #[inline(always)]
230    pub fn ch2run(&self) -> CH2RUN_R {
231        CH2RUN_R::new(((self.bits >> 2) & 1) != 0)
232    }
233    #[doc = "Bit 3 - Channel 3 Run Control"]
234    #[inline(always)]
235    pub fn ch3run(&self) -> CH3RUN_R {
236        CH3RUN_R::new(((self.bits >> 3) & 1) != 0)
237    }
238}
239impl W {
240    #[doc = "Bit 0 - Channel 0 Run Control"]
241    #[inline(always)]
242    pub fn ch0run(&mut self) -> CH0RUN_W<GLOBRC_SPEC> {
243        CH0RUN_W::new(self, 0)
244    }
245    #[doc = "Bit 1 - Channel 1 Run Control"]
246    #[inline(always)]
247    pub fn ch1run(&mut self) -> CH1RUN_W<GLOBRC_SPEC> {
248        CH1RUN_W::new(self, 1)
249    }
250    #[doc = "Bit 2 - Channel 2 Run Control"]
251    #[inline(always)]
252    pub fn ch2run(&mut self) -> CH2RUN_W<GLOBRC_SPEC> {
253        CH2RUN_W::new(self, 2)
254    }
255    #[doc = "Bit 3 - Channel 3 Run Control"]
256    #[inline(always)]
257    pub fn ch3run(&mut self) -> CH3RUN_W<GLOBRC_SPEC> {
258        CH3RUN_W::new(self, 3)
259    }
260}
261#[doc = "Global Run Control Register\n\nYou can [`read`](crate::Reg::read) this register and get [`globrc::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`globrc::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
262pub struct GLOBRC_SPEC;
263impl crate::RegisterSpec for GLOBRC_SPEC {
264    type Ux = u32;
265}
266#[doc = "`read()` method returns [`globrc::R`](R) reader structure"]
267impl crate::Readable for GLOBRC_SPEC {}
268#[doc = "`write(|w| ..)` method takes [`globrc::W`](W) writer structure"]
269impl crate::Writable for GLOBRC_SPEC {
270    type Safety = crate::Unsafe;
271    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
272    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
273}
274#[doc = "`reset()` method sets GLOBRC to value 0"]
275impl crate::Resettable for GLOBRC_SPEC {
276    const RESET_VALUE: u32 = 0;
277}