xmc4100/hrpwm0/
csgfsg.rs

1#[doc = "Register `CSGFSG` reader"]
2pub type R = crate::R<CSGFSG_SPEC>;
3#[doc = "DAC0 slope generation status\n\nValue on reset: 0"]
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5pub enum S0RB_A {
6    #[doc = "0: Slope generation is stopped."]
7    VALUE1 = 0,
8    #[doc = "1: Slope generation is running."]
9    VALUE2 = 1,
10}
11impl From<S0RB_A> for bool {
12    #[inline(always)]
13    fn from(variant: S0RB_A) -> Self {
14        variant as u8 != 0
15    }
16}
17#[doc = "Field `S0RB` reader - DAC0 slope generation status"]
18pub type S0RB_R = crate::BitReader<S0RB_A>;
19impl S0RB_R {
20    #[doc = "Get enumerated values variant"]
21    #[inline(always)]
22    pub const fn variant(&self) -> S0RB_A {
23        match self.bits {
24            false => S0RB_A::VALUE1,
25            true => S0RB_A::VALUE2,
26        }
27    }
28    #[doc = "Slope generation is stopped."]
29    #[inline(always)]
30    pub fn is_value1(&self) -> bool {
31        *self == S0RB_A::VALUE1
32    }
33    #[doc = "Slope generation is running."]
34    #[inline(always)]
35    pub fn is_value2(&self) -> bool {
36        *self == S0RB_A::VALUE2
37    }
38}
39#[doc = "CSG0 prescaler status\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum P0RB_A {
42    #[doc = "0: Prescaler is stopped. The clock used for the slope generation is halted and therefore the slope is frozen."]
43    VALUE1 = 0,
44    #[doc = "1: Prescaler is running."]
45    VALUE2 = 1,
46}
47impl From<P0RB_A> for bool {
48    #[inline(always)]
49    fn from(variant: P0RB_A) -> Self {
50        variant as u8 != 0
51    }
52}
53#[doc = "Field `P0RB` reader - CSG0 prescaler status"]
54pub type P0RB_R = crate::BitReader<P0RB_A>;
55impl P0RB_R {
56    #[doc = "Get enumerated values variant"]
57    #[inline(always)]
58    pub const fn variant(&self) -> P0RB_A {
59        match self.bits {
60            false => P0RB_A::VALUE1,
61            true => P0RB_A::VALUE2,
62        }
63    }
64    #[doc = "Prescaler is stopped. The clock used for the slope generation is halted and therefore the slope is frozen."]
65    #[inline(always)]
66    pub fn is_value1(&self) -> bool {
67        *self == P0RB_A::VALUE1
68    }
69    #[doc = "Prescaler is running."]
70    #[inline(always)]
71    pub fn is_value2(&self) -> bool {
72        *self == P0RB_A::VALUE2
73    }
74}
75#[doc = "DAC1 slope generation status\n\nValue on reset: 0"]
76#[derive(Clone, Copy, Debug, PartialEq, Eq)]
77pub enum S1RB_A {
78    #[doc = "0: Slope generation is stopped."]
79    VALUE1 = 0,
80    #[doc = "1: Slope generation is running."]
81    VALUE2 = 1,
82}
83impl From<S1RB_A> for bool {
84    #[inline(always)]
85    fn from(variant: S1RB_A) -> Self {
86        variant as u8 != 0
87    }
88}
89#[doc = "Field `S1RB` reader - DAC1 slope generation status"]
90pub type S1RB_R = crate::BitReader<S1RB_A>;
91impl S1RB_R {
92    #[doc = "Get enumerated values variant"]
93    #[inline(always)]
94    pub const fn variant(&self) -> S1RB_A {
95        match self.bits {
96            false => S1RB_A::VALUE1,
97            true => S1RB_A::VALUE2,
98        }
99    }
100    #[doc = "Slope generation is stopped."]
101    #[inline(always)]
102    pub fn is_value1(&self) -> bool {
103        *self == S1RB_A::VALUE1
104    }
105    #[doc = "Slope generation is running."]
106    #[inline(always)]
107    pub fn is_value2(&self) -> bool {
108        *self == S1RB_A::VALUE2
109    }
110}
111#[doc = "CSG1 prescaler status\n\nValue on reset: 0"]
112#[derive(Clone, Copy, Debug, PartialEq, Eq)]
113pub enum P1RB_A {
114    #[doc = "0: Prescaler is stopped. The clock used for the slope generation is halted and therefore the slope is frozen."]
115    VALUE1 = 0,
116    #[doc = "1: Prescaler is running."]
117    VALUE2 = 1,
118}
119impl From<P1RB_A> for bool {
120    #[inline(always)]
121    fn from(variant: P1RB_A) -> Self {
122        variant as u8 != 0
123    }
124}
125#[doc = "Field `P1RB` reader - CSG1 prescaler status"]
126pub type P1RB_R = crate::BitReader<P1RB_A>;
127impl P1RB_R {
128    #[doc = "Get enumerated values variant"]
129    #[inline(always)]
130    pub const fn variant(&self) -> P1RB_A {
131        match self.bits {
132            false => P1RB_A::VALUE1,
133            true => P1RB_A::VALUE2,
134        }
135    }
136    #[doc = "Prescaler is stopped. The clock used for the slope generation is halted and therefore the slope is frozen."]
137    #[inline(always)]
138    pub fn is_value1(&self) -> bool {
139        *self == P1RB_A::VALUE1
140    }
141    #[doc = "Prescaler is running."]
142    #[inline(always)]
143    pub fn is_value2(&self) -> bool {
144        *self == P1RB_A::VALUE2
145    }
146}
147#[doc = "DAC2 slope generation status\n\nValue on reset: 0"]
148#[derive(Clone, Copy, Debug, PartialEq, Eq)]
149pub enum S2RB_A {
150    #[doc = "0: Slope generation is stopped."]
151    VALUE1 = 0,
152    #[doc = "1: Slope generation is running."]
153    VALUE2 = 1,
154}
155impl From<S2RB_A> for bool {
156    #[inline(always)]
157    fn from(variant: S2RB_A) -> Self {
158        variant as u8 != 0
159    }
160}
161#[doc = "Field `S2RB` reader - DAC2 slope generation status"]
162pub type S2RB_R = crate::BitReader<S2RB_A>;
163impl S2RB_R {
164    #[doc = "Get enumerated values variant"]
165    #[inline(always)]
166    pub const fn variant(&self) -> S2RB_A {
167        match self.bits {
168            false => S2RB_A::VALUE1,
169            true => S2RB_A::VALUE2,
170        }
171    }
172    #[doc = "Slope generation is stopped."]
173    #[inline(always)]
174    pub fn is_value1(&self) -> bool {
175        *self == S2RB_A::VALUE1
176    }
177    #[doc = "Slope generation is running."]
178    #[inline(always)]
179    pub fn is_value2(&self) -> bool {
180        *self == S2RB_A::VALUE2
181    }
182}
183#[doc = "CSG2 prescaler status\n\nValue on reset: 0"]
184#[derive(Clone, Copy, Debug, PartialEq, Eq)]
185pub enum P2RB_A {
186    #[doc = "0: Prescaler is stopped. The clock used for the slope generation is halted and therefore the slope is frozen."]
187    VALUE1 = 0,
188    #[doc = "1: Prescaler is running."]
189    VALUE2 = 1,
190}
191impl From<P2RB_A> for bool {
192    #[inline(always)]
193    fn from(variant: P2RB_A) -> Self {
194        variant as u8 != 0
195    }
196}
197#[doc = "Field `P2RB` reader - CSG2 prescaler status"]
198pub type P2RB_R = crate::BitReader<P2RB_A>;
199impl P2RB_R {
200    #[doc = "Get enumerated values variant"]
201    #[inline(always)]
202    pub const fn variant(&self) -> P2RB_A {
203        match self.bits {
204            false => P2RB_A::VALUE1,
205            true => P2RB_A::VALUE2,
206        }
207    }
208    #[doc = "Prescaler is stopped. The clock used for the slope generation is halted and therefore the slope is frozen."]
209    #[inline(always)]
210    pub fn is_value1(&self) -> bool {
211        *self == P2RB_A::VALUE1
212    }
213    #[doc = "Prescaler is running."]
214    #[inline(always)]
215    pub fn is_value2(&self) -> bool {
216        *self == P2RB_A::VALUE2
217    }
218}
219impl R {
220    #[doc = "Bit 0 - DAC0 slope generation status"]
221    #[inline(always)]
222    pub fn s0rb(&self) -> S0RB_R {
223        S0RB_R::new((self.bits & 1) != 0)
224    }
225    #[doc = "Bit 1 - CSG0 prescaler status"]
226    #[inline(always)]
227    pub fn p0rb(&self) -> P0RB_R {
228        P0RB_R::new(((self.bits >> 1) & 1) != 0)
229    }
230    #[doc = "Bit 8 - DAC1 slope generation status"]
231    #[inline(always)]
232    pub fn s1rb(&self) -> S1RB_R {
233        S1RB_R::new(((self.bits >> 8) & 1) != 0)
234    }
235    #[doc = "Bit 9 - CSG1 prescaler status"]
236    #[inline(always)]
237    pub fn p1rb(&self) -> P1RB_R {
238        P1RB_R::new(((self.bits >> 9) & 1) != 0)
239    }
240    #[doc = "Bit 16 - DAC2 slope generation status"]
241    #[inline(always)]
242    pub fn s2rb(&self) -> S2RB_R {
243        S2RB_R::new(((self.bits >> 16) & 1) != 0)
244    }
245    #[doc = "Bit 17 - CSG2 prescaler status"]
246    #[inline(always)]
247    pub fn p2rb(&self) -> P2RB_R {
248        P2RB_R::new(((self.bits >> 17) & 1) != 0)
249    }
250}
251#[doc = "Global CSG slope/prescaler status\n\nYou can [`read`](crate::Reg::read) this register and get [`csgfsg::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
252pub struct CSGFSG_SPEC;
253impl crate::RegisterSpec for CSGFSG_SPEC {
254    type Ux = u32;
255}
256#[doc = "`read()` method returns [`csgfsg::R`](R) reader structure"]
257impl crate::Readable for CSGFSG_SPEC {}
258#[doc = "`reset()` method sets CSGFSG to value 0"]
259impl crate::Resettable for CSGFSG_SPEC {
260    const RESET_VALUE: u32 = 0;
261}