py32f0/py32f002a/syscfg/
cfgr2.rs1pub struct R(crate::R<CFGR2_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CFGR2_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CFGR2_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CFGR2_SPEC>) -> Self {
13 R(reader)
14 }
15}
16pub struct W(crate::W<CFGR2_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CFGR2_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<CFGR2_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CFGR2_SPEC>) -> Self {
34 W(writer)
35 }
36}
37pub type LOCKUP_LOCK_R = crate::BitReader<LOCKUP_LOCK_A>;
39#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum LOCKUP_LOCK_A {
44 Disconnected = 0,
46 Connected = 1,
48}
49impl From<LOCKUP_LOCK_A> for bool {
50 #[inline(always)]
51 fn from(variant: LOCKUP_LOCK_A) -> Self {
52 variant as u8 != 0
53 }
54}
55impl LOCKUP_LOCK_R {
56 #[inline(always)]
58 pub fn variant(&self) -> LOCKUP_LOCK_A {
59 match self.bits {
60 false => LOCKUP_LOCK_A::Disconnected,
61 true => LOCKUP_LOCK_A::Connected,
62 }
63 }
64 #[inline(always)]
66 pub fn is_disconnected(&self) -> bool {
67 *self == LOCKUP_LOCK_A::Disconnected
68 }
69 #[inline(always)]
71 pub fn is_connected(&self) -> bool {
72 *self == LOCKUP_LOCK_A::Connected
73 }
74}
75pub type LOCKUP_LOCK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFGR2_SPEC, LOCKUP_LOCK_A, O>;
77impl<'a, const O: u8> LOCKUP_LOCK_W<'a, O> {
78 #[inline(always)]
80 pub fn disconnected(self) -> &'a mut W {
81 self.variant(LOCKUP_LOCK_A::Disconnected)
82 }
83 #[inline(always)]
85 pub fn connected(self) -> &'a mut W {
86 self.variant(LOCKUP_LOCK_A::Connected)
87 }
88}
89pub type COMP1_BRK_TIM1_R = crate::BitReader<COMP1_BRK_TIM1_A>;
91#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum COMP1_BRK_TIM1_A {
96 Disconnected = 0,
98 Connected = 1,
100}
101impl From<COMP1_BRK_TIM1_A> for bool {
102 #[inline(always)]
103 fn from(variant: COMP1_BRK_TIM1_A) -> Self {
104 variant as u8 != 0
105 }
106}
107impl COMP1_BRK_TIM1_R {
108 #[inline(always)]
110 pub fn variant(&self) -> COMP1_BRK_TIM1_A {
111 match self.bits {
112 false => COMP1_BRK_TIM1_A::Disconnected,
113 true => COMP1_BRK_TIM1_A::Connected,
114 }
115 }
116 #[inline(always)]
118 pub fn is_disconnected(&self) -> bool {
119 *self == COMP1_BRK_TIM1_A::Disconnected
120 }
121 #[inline(always)]
123 pub fn is_connected(&self) -> bool {
124 *self == COMP1_BRK_TIM1_A::Connected
125 }
126}
127pub type COMP1_BRK_TIM1_W<'a, const O: u8> =
129 crate::BitWriter<'a, u32, CFGR2_SPEC, COMP1_BRK_TIM1_A, O>;
130impl<'a, const O: u8> COMP1_BRK_TIM1_W<'a, O> {
131 #[inline(always)]
133 pub fn disconnected(self) -> &'a mut W {
134 self.variant(COMP1_BRK_TIM1_A::Disconnected)
135 }
136 #[inline(always)]
138 pub fn connected(self) -> &'a mut W {
139 self.variant(COMP1_BRK_TIM1_A::Connected)
140 }
141}
142pub use COMP1_BRK_TIM1_R as COMP2_BRK_TIM1_R;
144pub use COMP1_BRK_TIM1_R as COMP1_BRK_TIM16_R;
146pub use COMP1_BRK_TIM1_R as COMP2_BRK_TIM16_R;
148pub use COMP1_BRK_TIM1_W as COMP2_BRK_TIM1_W;
150pub use COMP1_BRK_TIM1_W as COMP1_BRK_TIM16_W;
152pub use COMP1_BRK_TIM1_W as COMP2_BRK_TIM16_W;
154pub type ETR_SRC_TIM1_R = crate::FieldReader<u8, ETR_SRC_TIM1_A>;
156#[derive(Clone, Copy, Debug, PartialEq, Eq)]
160#[repr(u8)]
161pub enum ETR_SRC_TIM1_A {
162 Gpio = 0,
164 Comp1 = 1,
166 Comp2 = 2,
168 Adc = 3,
170}
171impl From<ETR_SRC_TIM1_A> for u8 {
172 #[inline(always)]
173 fn from(variant: ETR_SRC_TIM1_A) -> Self {
174 variant as _
175 }
176}
177impl ETR_SRC_TIM1_R {
178 #[inline(always)]
180 pub fn variant(&self) -> ETR_SRC_TIM1_A {
181 match self.bits {
182 0 => ETR_SRC_TIM1_A::Gpio,
183 1 => ETR_SRC_TIM1_A::Comp1,
184 2 => ETR_SRC_TIM1_A::Comp2,
185 3 => ETR_SRC_TIM1_A::Adc,
186 _ => unreachable!(),
187 }
188 }
189 #[inline(always)]
191 pub fn is_gpio(&self) -> bool {
192 *self == ETR_SRC_TIM1_A::Gpio
193 }
194 #[inline(always)]
196 pub fn is_comp1(&self) -> bool {
197 *self == ETR_SRC_TIM1_A::Comp1
198 }
199 #[inline(always)]
201 pub fn is_comp2(&self) -> bool {
202 *self == ETR_SRC_TIM1_A::Comp2
203 }
204 #[inline(always)]
206 pub fn is_adc(&self) -> bool {
207 *self == ETR_SRC_TIM1_A::Adc
208 }
209}
210pub type ETR_SRC_TIM1_W<'a, const O: u8> =
212 crate::FieldWriterSafe<'a, u32, CFGR2_SPEC, u8, ETR_SRC_TIM1_A, 2, O>;
213impl<'a, const O: u8> ETR_SRC_TIM1_W<'a, O> {
214 #[inline(always)]
216 pub fn gpio(self) -> &'a mut W {
217 self.variant(ETR_SRC_TIM1_A::Gpio)
218 }
219 #[inline(always)]
221 pub fn comp1(self) -> &'a mut W {
222 self.variant(ETR_SRC_TIM1_A::Comp1)
223 }
224 #[inline(always)]
226 pub fn comp2(self) -> &'a mut W {
227 self.variant(ETR_SRC_TIM1_A::Comp2)
228 }
229 #[inline(always)]
231 pub fn adc(self) -> &'a mut W {
232 self.variant(ETR_SRC_TIM1_A::Adc)
233 }
234}
235impl R {
236 #[inline(always)]
238 pub fn lockup_lock(&self) -> LOCKUP_LOCK_R {
239 LOCKUP_LOCK_R::new((self.bits & 1) != 0)
240 }
241 #[inline(always)]
243 pub fn comp1_brk_tim1(&self) -> COMP1_BRK_TIM1_R {
244 COMP1_BRK_TIM1_R::new(((self.bits >> 3) & 1) != 0)
245 }
246 #[inline(always)]
248 pub fn comp2_brk_tim1(&self) -> COMP2_BRK_TIM1_R {
249 COMP2_BRK_TIM1_R::new(((self.bits >> 4) & 1) != 0)
250 }
251 #[inline(always)]
253 pub fn comp1_brk_tim16(&self) -> COMP1_BRK_TIM16_R {
254 COMP1_BRK_TIM16_R::new(((self.bits >> 5) & 1) != 0)
255 }
256 #[inline(always)]
258 pub fn comp2_brk_tim16(&self) -> COMP2_BRK_TIM16_R {
259 COMP2_BRK_TIM16_R::new(((self.bits >> 6) & 1) != 0)
260 }
261 #[inline(always)]
263 pub fn etr_src_tim1(&self) -> ETR_SRC_TIM1_R {
264 ETR_SRC_TIM1_R::new(((self.bits >> 9) & 3) as u8)
265 }
266}
267impl W {
268 #[inline(always)]
270 #[must_use]
271 pub fn lockup_lock(&mut self) -> LOCKUP_LOCK_W<0> {
272 LOCKUP_LOCK_W::new(self)
273 }
274 #[inline(always)]
276 #[must_use]
277 pub fn comp1_brk_tim1(&mut self) -> COMP1_BRK_TIM1_W<3> {
278 COMP1_BRK_TIM1_W::new(self)
279 }
280 #[inline(always)]
282 #[must_use]
283 pub fn comp2_brk_tim1(&mut self) -> COMP2_BRK_TIM1_W<4> {
284 COMP2_BRK_TIM1_W::new(self)
285 }
286 #[inline(always)]
288 #[must_use]
289 pub fn comp1_brk_tim16(&mut self) -> COMP1_BRK_TIM16_W<5> {
290 COMP1_BRK_TIM16_W::new(self)
291 }
292 #[inline(always)]
294 #[must_use]
295 pub fn comp2_brk_tim16(&mut self) -> COMP2_BRK_TIM16_W<6> {
296 COMP2_BRK_TIM16_W::new(self)
297 }
298 #[inline(always)]
300 #[must_use]
301 pub fn etr_src_tim1(&mut self) -> ETR_SRC_TIM1_W<9> {
302 ETR_SRC_TIM1_W::new(self)
303 }
304 #[inline(always)]
306 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
307 self.0.bits(bits);
308 self
309 }
310}
311pub struct CFGR2_SPEC;
317impl crate::RegisterSpec for CFGR2_SPEC {
318 type Ux = u32;
319}
320impl crate::Readable for CFGR2_SPEC {
322 type Reader = R;
323}
324impl crate::Writable for CFGR2_SPEC {
326 type Writer = W;
327 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
328 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
329}
330impl crate::Resettable for CFGR2_SPEC {
332 const RESET_VALUE: Self::Ux = 0;
333}