stm32f7_staging/stm32f733/tim2/
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 DIR {
235 Up = 0,
237 Down = 1,
239}
240impl From<DIR> for bool {
241 #[inline(always)]
242 fn from(variant: DIR) -> Self {
243 variant as u8 != 0
244 }
245}
246pub type DIR_R = crate::BitReader<DIR>;
248impl DIR_R {
249 #[inline(always)]
251 pub const fn variant(&self) -> DIR {
252 match self.bits {
253 false => DIR::Up,
254 true => DIR::Down,
255 }
256 }
257 #[inline(always)]
259 pub fn is_up(&self) -> bool {
260 *self == DIR::Up
261 }
262 #[inline(always)]
264 pub fn is_down(&self) -> bool {
265 *self == DIR::Down
266 }
267}
268pub type DIR_W<'a, REG> = crate::BitWriter<'a, REG, DIR>;
270impl<'a, REG> DIR_W<'a, REG>
271where
272 REG: crate::Writable + crate::RegisterSpec,
273{
274 #[inline(always)]
276 pub fn up(self) -> &'a mut crate::W<REG> {
277 self.variant(DIR::Up)
278 }
279 #[inline(always)]
281 pub fn down(self) -> &'a mut crate::W<REG> {
282 self.variant(DIR::Down)
283 }
284}
285#[cfg_attr(feature = "defmt", derive(defmt::Format))]
289#[derive(Clone, Copy, Debug, PartialEq, Eq)]
290#[repr(u8)]
291pub enum CMS {
292 EdgeAligned = 0,
294 CenterAligned1 = 1,
296 CenterAligned2 = 2,
298 CenterAligned3 = 3,
300}
301impl From<CMS> for u8 {
302 #[inline(always)]
303 fn from(variant: CMS) -> Self {
304 variant as _
305 }
306}
307impl crate::FieldSpec for CMS {
308 type Ux = u8;
309}
310impl crate::IsEnum for CMS {}
311pub type CMS_R = crate::FieldReader<CMS>;
313impl CMS_R {
314 #[inline(always)]
316 pub const fn variant(&self) -> CMS {
317 match self.bits {
318 0 => CMS::EdgeAligned,
319 1 => CMS::CenterAligned1,
320 2 => CMS::CenterAligned2,
321 3 => CMS::CenterAligned3,
322 _ => unreachable!(),
323 }
324 }
325 #[inline(always)]
327 pub fn is_edge_aligned(&self) -> bool {
328 *self == CMS::EdgeAligned
329 }
330 #[inline(always)]
332 pub fn is_center_aligned1(&self) -> bool {
333 *self == CMS::CenterAligned1
334 }
335 #[inline(always)]
337 pub fn is_center_aligned2(&self) -> bool {
338 *self == CMS::CenterAligned2
339 }
340 #[inline(always)]
342 pub fn is_center_aligned3(&self) -> bool {
343 *self == CMS::CenterAligned3
344 }
345}
346pub type CMS_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CMS, crate::Safe>;
348impl<'a, REG> CMS_W<'a, REG>
349where
350 REG: crate::Writable + crate::RegisterSpec,
351 REG::Ux: From<u8>,
352{
353 #[inline(always)]
355 pub fn edge_aligned(self) -> &'a mut crate::W<REG> {
356 self.variant(CMS::EdgeAligned)
357 }
358 #[inline(always)]
360 pub fn center_aligned1(self) -> &'a mut crate::W<REG> {
361 self.variant(CMS::CenterAligned1)
362 }
363 #[inline(always)]
365 pub fn center_aligned2(self) -> &'a mut crate::W<REG> {
366 self.variant(CMS::CenterAligned2)
367 }
368 #[inline(always)]
370 pub fn center_aligned3(self) -> &'a mut crate::W<REG> {
371 self.variant(CMS::CenterAligned3)
372 }
373}
374#[cfg_attr(feature = "defmt", derive(defmt::Format))]
378#[derive(Clone, Copy, Debug, PartialEq, Eq)]
379pub enum ARPE {
380 Disabled = 0,
382 Enabled = 1,
384}
385impl From<ARPE> for bool {
386 #[inline(always)]
387 fn from(variant: ARPE) -> Self {
388 variant as u8 != 0
389 }
390}
391pub type ARPE_R = crate::BitReader<ARPE>;
393impl ARPE_R {
394 #[inline(always)]
396 pub const fn variant(&self) -> ARPE {
397 match self.bits {
398 false => ARPE::Disabled,
399 true => ARPE::Enabled,
400 }
401 }
402 #[inline(always)]
404 pub fn is_disabled(&self) -> bool {
405 *self == ARPE::Disabled
406 }
407 #[inline(always)]
409 pub fn is_enabled(&self) -> bool {
410 *self == ARPE::Enabled
411 }
412}
413pub type ARPE_W<'a, REG> = crate::BitWriter<'a, REG, ARPE>;
415impl<'a, REG> ARPE_W<'a, REG>
416where
417 REG: crate::Writable + crate::RegisterSpec,
418{
419 #[inline(always)]
421 pub fn disabled(self) -> &'a mut crate::W<REG> {
422 self.variant(ARPE::Disabled)
423 }
424 #[inline(always)]
426 pub fn enabled(self) -> &'a mut crate::W<REG> {
427 self.variant(ARPE::Enabled)
428 }
429}
430#[cfg_attr(feature = "defmt", derive(defmt::Format))]
434#[derive(Clone, Copy, Debug, PartialEq, Eq)]
435#[repr(u8)]
436pub enum CKD {
437 Div1 = 0,
439 Div2 = 1,
441 Div4 = 2,
443}
444impl From<CKD> for u8 {
445 #[inline(always)]
446 fn from(variant: CKD) -> Self {
447 variant as _
448 }
449}
450impl crate::FieldSpec for CKD {
451 type Ux = u8;
452}
453impl crate::IsEnum for CKD {}
454pub type CKD_R = crate::FieldReader<CKD>;
456impl CKD_R {
457 #[inline(always)]
459 pub const fn variant(&self) -> Option<CKD> {
460 match self.bits {
461 0 => Some(CKD::Div1),
462 1 => Some(CKD::Div2),
463 2 => Some(CKD::Div4),
464 _ => None,
465 }
466 }
467 #[inline(always)]
469 pub fn is_div1(&self) -> bool {
470 *self == CKD::Div1
471 }
472 #[inline(always)]
474 pub fn is_div2(&self) -> bool {
475 *self == CKD::Div2
476 }
477 #[inline(always)]
479 pub fn is_div4(&self) -> bool {
480 *self == CKD::Div4
481 }
482}
483pub type CKD_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CKD>;
485impl<'a, REG> CKD_W<'a, REG>
486where
487 REG: crate::Writable + crate::RegisterSpec,
488 REG::Ux: From<u8>,
489{
490 #[inline(always)]
492 pub fn div1(self) -> &'a mut crate::W<REG> {
493 self.variant(CKD::Div1)
494 }
495 #[inline(always)]
497 pub fn div2(self) -> &'a mut crate::W<REG> {
498 self.variant(CKD::Div2)
499 }
500 #[inline(always)]
502 pub fn div4(self) -> &'a mut crate::W<REG> {
503 self.variant(CKD::Div4)
504 }
505}
506pub type UIFREMAP_R = crate::BitReader;
508pub type UIFREMAP_W<'a, REG> = crate::BitWriter<'a, REG>;
510impl R {
511 #[inline(always)]
513 pub fn cen(&self) -> CEN_R {
514 CEN_R::new((self.bits & 1) != 0)
515 }
516 #[inline(always)]
518 pub fn udis(&self) -> UDIS_R {
519 UDIS_R::new(((self.bits >> 1) & 1) != 0)
520 }
521 #[inline(always)]
523 pub fn urs(&self) -> URS_R {
524 URS_R::new(((self.bits >> 2) & 1) != 0)
525 }
526 #[inline(always)]
528 pub fn opm(&self) -> OPM_R {
529 OPM_R::new(((self.bits >> 3) & 1) != 0)
530 }
531 #[inline(always)]
533 pub fn dir(&self) -> DIR_R {
534 DIR_R::new(((self.bits >> 4) & 1) != 0)
535 }
536 #[inline(always)]
538 pub fn cms(&self) -> CMS_R {
539 CMS_R::new(((self.bits >> 5) & 3) as u8)
540 }
541 #[inline(always)]
543 pub fn arpe(&self) -> ARPE_R {
544 ARPE_R::new(((self.bits >> 7) & 1) != 0)
545 }
546 #[inline(always)]
548 pub fn ckd(&self) -> CKD_R {
549 CKD_R::new(((self.bits >> 8) & 3) as u8)
550 }
551 #[inline(always)]
553 pub fn uifremap(&self) -> UIFREMAP_R {
554 UIFREMAP_R::new(((self.bits >> 11) & 1) != 0)
555 }
556}
557impl core::fmt::Debug for R {
558 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
559 f.debug_struct("CR1")
560 .field("ckd", &self.ckd())
561 .field("arpe", &self.arpe())
562 .field("cms", &self.cms())
563 .field("dir", &self.dir())
564 .field("opm", &self.opm())
565 .field("urs", &self.urs())
566 .field("udis", &self.udis())
567 .field("cen", &self.cen())
568 .field("uifremap", &self.uifremap())
569 .finish()
570 }
571}
572impl W {
573 #[inline(always)]
575 pub fn cen(&mut self) -> CEN_W<CR1rs> {
576 CEN_W::new(self, 0)
577 }
578 #[inline(always)]
580 pub fn udis(&mut self) -> UDIS_W<CR1rs> {
581 UDIS_W::new(self, 1)
582 }
583 #[inline(always)]
585 pub fn urs(&mut self) -> URS_W<CR1rs> {
586 URS_W::new(self, 2)
587 }
588 #[inline(always)]
590 pub fn opm(&mut self) -> OPM_W<CR1rs> {
591 OPM_W::new(self, 3)
592 }
593 #[inline(always)]
595 pub fn dir(&mut self) -> DIR_W<CR1rs> {
596 DIR_W::new(self, 4)
597 }
598 #[inline(always)]
600 pub fn cms(&mut self) -> CMS_W<CR1rs> {
601 CMS_W::new(self, 5)
602 }
603 #[inline(always)]
605 pub fn arpe(&mut self) -> ARPE_W<CR1rs> {
606 ARPE_W::new(self, 7)
607 }
608 #[inline(always)]
610 pub fn ckd(&mut self) -> CKD_W<CR1rs> {
611 CKD_W::new(self, 8)
612 }
613 #[inline(always)]
615 pub fn uifremap(&mut self) -> UIFREMAP_W<CR1rs> {
616 UIFREMAP_W::new(self, 11)
617 }
618}
619pub struct CR1rs;
625impl crate::RegisterSpec for CR1rs {
626 type Ux = u32;
627}
628impl crate::Readable for CR1rs {}
630impl crate::Writable for CR1rs {
632 type Safety = crate::Unsafe;
633}
634impl crate::Resettable for CR1rs {}