stm32f1_staging/stm32f107/tim13/
cr1.rs1pub type R = crate::R<CR1rs>;
3pub type W = crate::W<CR1rs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum CEN {
11 Disabled = 0,
13 Enabled = 1,
15}
16impl From<CEN> for bool {
17 #[inline(always)]
18 fn from(variant: CEN) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type CEN_R = crate::BitReader<CEN>;
24impl CEN_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> CEN {
28 match self.bits {
29 false => CEN::Disabled,
30 true => CEN::Enabled,
31 }
32 }
33 #[inline(always)]
35 pub fn is_disabled(&self) -> bool {
36 *self == CEN::Disabled
37 }
38 #[inline(always)]
40 pub fn is_enabled(&self) -> bool {
41 *self == CEN::Enabled
42 }
43}
44pub type CEN_W<'a, REG> = crate::BitWriter<'a, REG, CEN>;
46impl<'a, REG> CEN_W<'a, REG>
47where
48 REG: crate::Writable + crate::RegisterSpec,
49{
50 #[inline(always)]
52 pub fn disabled(self) -> &'a mut crate::W<REG> {
53 self.variant(CEN::Disabled)
54 }
55 #[inline(always)]
57 pub fn enabled(self) -> &'a mut crate::W<REG> {
58 self.variant(CEN::Enabled)
59 }
60}
61#[cfg_attr(feature = "defmt", derive(defmt::Format))]
65#[derive(Clone, Copy, Debug, PartialEq, Eq)]
66pub enum UDIS {
67 Enabled = 0,
69 Disabled = 1,
71}
72impl From<UDIS> for bool {
73 #[inline(always)]
74 fn from(variant: UDIS) -> Self {
75 variant as u8 != 0
76 }
77}
78pub type UDIS_R = crate::BitReader<UDIS>;
80impl UDIS_R {
81 #[inline(always)]
83 pub const fn variant(&self) -> UDIS {
84 match self.bits {
85 false => UDIS::Enabled,
86 true => UDIS::Disabled,
87 }
88 }
89 #[inline(always)]
91 pub fn is_enabled(&self) -> bool {
92 *self == UDIS::Enabled
93 }
94 #[inline(always)]
96 pub fn is_disabled(&self) -> bool {
97 *self == UDIS::Disabled
98 }
99}
100pub type UDIS_W<'a, REG> = crate::BitWriter<'a, REG, UDIS>;
102impl<'a, REG> UDIS_W<'a, REG>
103where
104 REG: crate::Writable + crate::RegisterSpec,
105{
106 #[inline(always)]
108 pub fn enabled(self) -> &'a mut crate::W<REG> {
109 self.variant(UDIS::Enabled)
110 }
111 #[inline(always)]
113 pub fn disabled(self) -> &'a mut crate::W<REG> {
114 self.variant(UDIS::Disabled)
115 }
116}
117#[cfg_attr(feature = "defmt", derive(defmt::Format))]
121#[derive(Clone, Copy, Debug, PartialEq, Eq)]
122pub enum URS {
123 AnyEvent = 0,
125 CounterOnly = 1,
127}
128impl From<URS> for bool {
129 #[inline(always)]
130 fn from(variant: URS) -> Self {
131 variant as u8 != 0
132 }
133}
134pub type URS_R = crate::BitReader<URS>;
136impl URS_R {
137 #[inline(always)]
139 pub const fn variant(&self) -> URS {
140 match self.bits {
141 false => URS::AnyEvent,
142 true => URS::CounterOnly,
143 }
144 }
145 #[inline(always)]
147 pub fn is_any_event(&self) -> bool {
148 *self == URS::AnyEvent
149 }
150 #[inline(always)]
152 pub fn is_counter_only(&self) -> bool {
153 *self == URS::CounterOnly
154 }
155}
156pub type URS_W<'a, REG> = crate::BitWriter<'a, REG, URS>;
158impl<'a, REG> URS_W<'a, REG>
159where
160 REG: crate::Writable + crate::RegisterSpec,
161{
162 #[inline(always)]
164 pub fn any_event(self) -> &'a mut crate::W<REG> {
165 self.variant(URS::AnyEvent)
166 }
167 #[inline(always)]
169 pub fn counter_only(self) -> &'a mut crate::W<REG> {
170 self.variant(URS::CounterOnly)
171 }
172}
173#[cfg_attr(feature = "defmt", derive(defmt::Format))]
177#[derive(Clone, Copy, Debug, PartialEq, Eq)]
178pub enum OPM {
179 Disabled = 0,
181 Enabled = 1,
183}
184impl From<OPM> for bool {
185 #[inline(always)]
186 fn from(variant: OPM) -> Self {
187 variant as u8 != 0
188 }
189}
190pub type OPM_R = crate::BitReader<OPM>;
192impl OPM_R {
193 #[inline(always)]
195 pub const fn variant(&self) -> OPM {
196 match self.bits {
197 false => OPM::Disabled,
198 true => OPM::Enabled,
199 }
200 }
201 #[inline(always)]
203 pub fn is_disabled(&self) -> bool {
204 *self == OPM::Disabled
205 }
206 #[inline(always)]
208 pub fn is_enabled(&self) -> bool {
209 *self == OPM::Enabled
210 }
211}
212pub type OPM_W<'a, REG> = crate::BitWriter<'a, REG, OPM>;
214impl<'a, REG> OPM_W<'a, REG>
215where
216 REG: crate::Writable + crate::RegisterSpec,
217{
218 #[inline(always)]
220 pub fn disabled(self) -> &'a mut crate::W<REG> {
221 self.variant(OPM::Disabled)
222 }
223 #[inline(always)]
225 pub fn enabled(self) -> &'a mut crate::W<REG> {
226 self.variant(OPM::Enabled)
227 }
228}
229#[cfg_attr(feature = "defmt", derive(defmt::Format))]
233#[derive(Clone, Copy, Debug, PartialEq, Eq)]
234pub enum ARPE {
235 Disabled = 0,
237 Enabled = 1,
239}
240impl From<ARPE> for bool {
241 #[inline(always)]
242 fn from(variant: ARPE) -> Self {
243 variant as u8 != 0
244 }
245}
246pub type ARPE_R = crate::BitReader<ARPE>;
248impl ARPE_R {
249 #[inline(always)]
251 pub const fn variant(&self) -> ARPE {
252 match self.bits {
253 false => ARPE::Disabled,
254 true => ARPE::Enabled,
255 }
256 }
257 #[inline(always)]
259 pub fn is_disabled(&self) -> bool {
260 *self == ARPE::Disabled
261 }
262 #[inline(always)]
264 pub fn is_enabled(&self) -> bool {
265 *self == ARPE::Enabled
266 }
267}
268pub type ARPE_W<'a, REG> = crate::BitWriter<'a, REG, ARPE>;
270impl<'a, REG> ARPE_W<'a, REG>
271where
272 REG: crate::Writable + crate::RegisterSpec,
273{
274 #[inline(always)]
276 pub fn disabled(self) -> &'a mut crate::W<REG> {
277 self.variant(ARPE::Disabled)
278 }
279 #[inline(always)]
281 pub fn enabled(self) -> &'a mut crate::W<REG> {
282 self.variant(ARPE::Enabled)
283 }
284}
285#[cfg_attr(feature = "defmt", derive(defmt::Format))]
289#[derive(Clone, Copy, Debug, PartialEq, Eq)]
290#[repr(u8)]
291pub enum CKD {
292 Div1 = 0,
294 Div2 = 1,
296 Div4 = 2,
298}
299impl From<CKD> for u8 {
300 #[inline(always)]
301 fn from(variant: CKD) -> Self {
302 variant as _
303 }
304}
305impl crate::FieldSpec for CKD {
306 type Ux = u8;
307}
308impl crate::IsEnum for CKD {}
309pub type CKD_R = crate::FieldReader<CKD>;
311impl CKD_R {
312 #[inline(always)]
314 pub const fn variant(&self) -> Option<CKD> {
315 match self.bits {
316 0 => Some(CKD::Div1),
317 1 => Some(CKD::Div2),
318 2 => Some(CKD::Div4),
319 _ => None,
320 }
321 }
322 #[inline(always)]
324 pub fn is_div1(&self) -> bool {
325 *self == CKD::Div1
326 }
327 #[inline(always)]
329 pub fn is_div2(&self) -> bool {
330 *self == CKD::Div2
331 }
332 #[inline(always)]
334 pub fn is_div4(&self) -> bool {
335 *self == CKD::Div4
336 }
337}
338pub type CKD_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CKD>;
340impl<'a, REG> CKD_W<'a, REG>
341where
342 REG: crate::Writable + crate::RegisterSpec,
343 REG::Ux: From<u8>,
344{
345 #[inline(always)]
347 pub fn div1(self) -> &'a mut crate::W<REG> {
348 self.variant(CKD::Div1)
349 }
350 #[inline(always)]
352 pub fn div2(self) -> &'a mut crate::W<REG> {
353 self.variant(CKD::Div2)
354 }
355 #[inline(always)]
357 pub fn div4(self) -> &'a mut crate::W<REG> {
358 self.variant(CKD::Div4)
359 }
360}
361impl R {
362 #[inline(always)]
364 pub fn cen(&self) -> CEN_R {
365 CEN_R::new((self.bits & 1) != 0)
366 }
367 #[inline(always)]
369 pub fn udis(&self) -> UDIS_R {
370 UDIS_R::new(((self.bits >> 1) & 1) != 0)
371 }
372 #[inline(always)]
374 pub fn urs(&self) -> URS_R {
375 URS_R::new(((self.bits >> 2) & 1) != 0)
376 }
377 #[inline(always)]
379 pub fn opm(&self) -> OPM_R {
380 OPM_R::new(((self.bits >> 3) & 1) != 0)
381 }
382 #[inline(always)]
384 pub fn arpe(&self) -> ARPE_R {
385 ARPE_R::new(((self.bits >> 7) & 1) != 0)
386 }
387 #[inline(always)]
389 pub fn ckd(&self) -> CKD_R {
390 CKD_R::new(((self.bits >> 8) & 3) as u8)
391 }
392}
393impl core::fmt::Debug for R {
394 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
395 f.debug_struct("CR1")
396 .field("ckd", &self.ckd())
397 .field("arpe", &self.arpe())
398 .field("urs", &self.urs())
399 .field("udis", &self.udis())
400 .field("cen", &self.cen())
401 .field("opm", &self.opm())
402 .finish()
403 }
404}
405impl W {
406 #[inline(always)]
408 pub fn cen(&mut self) -> CEN_W<CR1rs> {
409 CEN_W::new(self, 0)
410 }
411 #[inline(always)]
413 pub fn udis(&mut self) -> UDIS_W<CR1rs> {
414 UDIS_W::new(self, 1)
415 }
416 #[inline(always)]
418 pub fn urs(&mut self) -> URS_W<CR1rs> {
419 URS_W::new(self, 2)
420 }
421 #[inline(always)]
423 pub fn opm(&mut self) -> OPM_W<CR1rs> {
424 OPM_W::new(self, 3)
425 }
426 #[inline(always)]
428 pub fn arpe(&mut self) -> ARPE_W<CR1rs> {
429 ARPE_W::new(self, 7)
430 }
431 #[inline(always)]
433 pub fn ckd(&mut self) -> CKD_W<CR1rs> {
434 CKD_W::new(self, 8)
435 }
436}
437pub struct CR1rs;
443impl crate::RegisterSpec for CR1rs {
444 type Ux = u32;
445}
446impl crate::Readable for CR1rs {}
448impl crate::Writable for CR1rs {
450 type Safety = crate::Unsafe;
451}
452impl crate::Resettable for CR1rs {}