1pub struct R(crate::R<CR1_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CR1_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CR1_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CR1_SPEC>) -> Self {
13 R(reader)
14 }
15}
16pub struct W(crate::W<CR1_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CR1_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<CR1_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CR1_SPEC>) -> Self {
34 W(writer)
35 }
36}
37pub type CEN_R = crate::BitReader<CEN_A>;
39#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum CEN_A {
44 Disabled = 0,
46 Enabled = 1,
48}
49impl From<CEN_A> for bool {
50 #[inline(always)]
51 fn from(variant: CEN_A) -> Self {
52 variant as u8 != 0
53 }
54}
55impl CEN_R {
56 #[inline(always)]
58 pub fn variant(&self) -> CEN_A {
59 match self.bits {
60 false => CEN_A::Disabled,
61 true => CEN_A::Enabled,
62 }
63 }
64 #[inline(always)]
66 pub fn is_disabled(&self) -> bool {
67 *self == CEN_A::Disabled
68 }
69 #[inline(always)]
71 pub fn is_enabled(&self) -> bool {
72 *self == CEN_A::Enabled
73 }
74}
75pub type CEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, CEN_A, O>;
77impl<'a, const O: u8> CEN_W<'a, O> {
78 #[inline(always)]
80 pub fn disabled(self) -> &'a mut W {
81 self.variant(CEN_A::Disabled)
82 }
83 #[inline(always)]
85 pub fn enabled(self) -> &'a mut W {
86 self.variant(CEN_A::Enabled)
87 }
88}
89pub type UDIS_R = crate::BitReader<UDIS_A>;
91#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum UDIS_A {
96 Enabled = 0,
98 Disabled = 1,
100}
101impl From<UDIS_A> for bool {
102 #[inline(always)]
103 fn from(variant: UDIS_A) -> Self {
104 variant as u8 != 0
105 }
106}
107impl UDIS_R {
108 #[inline(always)]
110 pub fn variant(&self) -> UDIS_A {
111 match self.bits {
112 false => UDIS_A::Enabled,
113 true => UDIS_A::Disabled,
114 }
115 }
116 #[inline(always)]
118 pub fn is_enabled(&self) -> bool {
119 *self == UDIS_A::Enabled
120 }
121 #[inline(always)]
123 pub fn is_disabled(&self) -> bool {
124 *self == UDIS_A::Disabled
125 }
126}
127pub type UDIS_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, UDIS_A, O>;
129impl<'a, const O: u8> UDIS_W<'a, O> {
130 #[inline(always)]
132 pub fn enabled(self) -> &'a mut W {
133 self.variant(UDIS_A::Enabled)
134 }
135 #[inline(always)]
137 pub fn disabled(self) -> &'a mut W {
138 self.variant(UDIS_A::Disabled)
139 }
140}
141pub type URS_R = crate::BitReader<URS_A>;
143#[derive(Clone, Copy, Debug, PartialEq, Eq)]
147pub enum URS_A {
148 AnyEvent = 0,
150 CounterOnly = 1,
152}
153impl From<URS_A> for bool {
154 #[inline(always)]
155 fn from(variant: URS_A) -> Self {
156 variant as u8 != 0
157 }
158}
159impl URS_R {
160 #[inline(always)]
162 pub fn variant(&self) -> URS_A {
163 match self.bits {
164 false => URS_A::AnyEvent,
165 true => URS_A::CounterOnly,
166 }
167 }
168 #[inline(always)]
170 pub fn is_any_event(&self) -> bool {
171 *self == URS_A::AnyEvent
172 }
173 #[inline(always)]
175 pub fn is_counter_only(&self) -> bool {
176 *self == URS_A::CounterOnly
177 }
178}
179pub type URS_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, URS_A, O>;
181impl<'a, const O: u8> URS_W<'a, O> {
182 #[inline(always)]
184 pub fn any_event(self) -> &'a mut W {
185 self.variant(URS_A::AnyEvent)
186 }
187 #[inline(always)]
189 pub fn counter_only(self) -> &'a mut W {
190 self.variant(URS_A::CounterOnly)
191 }
192}
193pub type OPM_R = crate::BitReader<OPM_A>;
195#[derive(Clone, Copy, Debug, PartialEq, Eq)]
199pub enum OPM_A {
200 Disabled = 0,
202 Enabled = 1,
204}
205impl From<OPM_A> for bool {
206 #[inline(always)]
207 fn from(variant: OPM_A) -> Self {
208 variant as u8 != 0
209 }
210}
211impl OPM_R {
212 #[inline(always)]
214 pub fn variant(&self) -> OPM_A {
215 match self.bits {
216 false => OPM_A::Disabled,
217 true => OPM_A::Enabled,
218 }
219 }
220 #[inline(always)]
222 pub fn is_disabled(&self) -> bool {
223 *self == OPM_A::Disabled
224 }
225 #[inline(always)]
227 pub fn is_enabled(&self) -> bool {
228 *self == OPM_A::Enabled
229 }
230}
231pub type OPM_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, OPM_A, O>;
233impl<'a, const O: u8> OPM_W<'a, O> {
234 #[inline(always)]
236 pub fn disabled(self) -> &'a mut W {
237 self.variant(OPM_A::Disabled)
238 }
239 #[inline(always)]
241 pub fn enabled(self) -> &'a mut W {
242 self.variant(OPM_A::Enabled)
243 }
244}
245pub type DIR_R = crate::BitReader<DIR_A>;
247#[derive(Clone, Copy, Debug, PartialEq, Eq)]
251pub enum DIR_A {
252 Up = 0,
254 Down = 1,
256}
257impl From<DIR_A> for bool {
258 #[inline(always)]
259 fn from(variant: DIR_A) -> Self {
260 variant as u8 != 0
261 }
262}
263impl DIR_R {
264 #[inline(always)]
266 pub fn variant(&self) -> DIR_A {
267 match self.bits {
268 false => DIR_A::Up,
269 true => DIR_A::Down,
270 }
271 }
272 #[inline(always)]
274 pub fn is_up(&self) -> bool {
275 *self == DIR_A::Up
276 }
277 #[inline(always)]
279 pub fn is_down(&self) -> bool {
280 *self == DIR_A::Down
281 }
282}
283pub type DIR_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, DIR_A, O>;
285impl<'a, const O: u8> DIR_W<'a, O> {
286 #[inline(always)]
288 pub fn up(self) -> &'a mut W {
289 self.variant(DIR_A::Up)
290 }
291 #[inline(always)]
293 pub fn down(self) -> &'a mut W {
294 self.variant(DIR_A::Down)
295 }
296}
297pub type CMS_R = crate::FieldReader<u8, CMS_A>;
299#[derive(Clone, Copy, Debug, PartialEq, Eq)]
303#[repr(u8)]
304pub enum CMS_A {
305 EdgeAligned = 0,
307 CenterAligned1 = 1,
309 CenterAligned2 = 2,
311 CenterAligned3 = 3,
313}
314impl From<CMS_A> for u8 {
315 #[inline(always)]
316 fn from(variant: CMS_A) -> Self {
317 variant as _
318 }
319}
320impl CMS_R {
321 #[inline(always)]
323 pub fn variant(&self) -> CMS_A {
324 match self.bits {
325 0 => CMS_A::EdgeAligned,
326 1 => CMS_A::CenterAligned1,
327 2 => CMS_A::CenterAligned2,
328 3 => CMS_A::CenterAligned3,
329 _ => unreachable!(),
330 }
331 }
332 #[inline(always)]
334 pub fn is_edge_aligned(&self) -> bool {
335 *self == CMS_A::EdgeAligned
336 }
337 #[inline(always)]
339 pub fn is_center_aligned1(&self) -> bool {
340 *self == CMS_A::CenterAligned1
341 }
342 #[inline(always)]
344 pub fn is_center_aligned2(&self) -> bool {
345 *self == CMS_A::CenterAligned2
346 }
347 #[inline(always)]
349 pub fn is_center_aligned3(&self) -> bool {
350 *self == CMS_A::CenterAligned3
351 }
352}
353pub type CMS_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, CR1_SPEC, u8, CMS_A, 2, O>;
355impl<'a, const O: u8> CMS_W<'a, O> {
356 #[inline(always)]
358 pub fn edge_aligned(self) -> &'a mut W {
359 self.variant(CMS_A::EdgeAligned)
360 }
361 #[inline(always)]
363 pub fn center_aligned1(self) -> &'a mut W {
364 self.variant(CMS_A::CenterAligned1)
365 }
366 #[inline(always)]
368 pub fn center_aligned2(self) -> &'a mut W {
369 self.variant(CMS_A::CenterAligned2)
370 }
371 #[inline(always)]
373 pub fn center_aligned3(self) -> &'a mut W {
374 self.variant(CMS_A::CenterAligned3)
375 }
376}
377pub type ARPE_R = crate::BitReader<ARPE_A>;
379#[derive(Clone, Copy, Debug, PartialEq, Eq)]
383pub enum ARPE_A {
384 Disabled = 0,
386 Enabled = 1,
388}
389impl From<ARPE_A> for bool {
390 #[inline(always)]
391 fn from(variant: ARPE_A) -> Self {
392 variant as u8 != 0
393 }
394}
395impl ARPE_R {
396 #[inline(always)]
398 pub fn variant(&self) -> ARPE_A {
399 match self.bits {
400 false => ARPE_A::Disabled,
401 true => ARPE_A::Enabled,
402 }
403 }
404 #[inline(always)]
406 pub fn is_disabled(&self) -> bool {
407 *self == ARPE_A::Disabled
408 }
409 #[inline(always)]
411 pub fn is_enabled(&self) -> bool {
412 *self == ARPE_A::Enabled
413 }
414}
415pub type ARPE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR1_SPEC, ARPE_A, O>;
417impl<'a, const O: u8> ARPE_W<'a, O> {
418 #[inline(always)]
420 pub fn disabled(self) -> &'a mut W {
421 self.variant(ARPE_A::Disabled)
422 }
423 #[inline(always)]
425 pub fn enabled(self) -> &'a mut W {
426 self.variant(ARPE_A::Enabled)
427 }
428}
429pub type CKD_R = crate::FieldReader<u8, CKD_A>;
431#[derive(Clone, Copy, Debug, PartialEq, Eq)]
435#[repr(u8)]
436pub enum CKD_A {
437 Div1 = 0,
439 Div2 = 1,
441 Div4 = 2,
443}
444impl From<CKD_A> for u8 {
445 #[inline(always)]
446 fn from(variant: CKD_A) -> Self {
447 variant as _
448 }
449}
450impl CKD_R {
451 #[inline(always)]
453 pub fn variant(&self) -> Option<CKD_A> {
454 match self.bits {
455 0 => Some(CKD_A::Div1),
456 1 => Some(CKD_A::Div2),
457 2 => Some(CKD_A::Div4),
458 _ => None,
459 }
460 }
461 #[inline(always)]
463 pub fn is_div1(&self) -> bool {
464 *self == CKD_A::Div1
465 }
466 #[inline(always)]
468 pub fn is_div2(&self) -> bool {
469 *self == CKD_A::Div2
470 }
471 #[inline(always)]
473 pub fn is_div4(&self) -> bool {
474 *self == CKD_A::Div4
475 }
476}
477pub type CKD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CR1_SPEC, u8, CKD_A, 2, O>;
479impl<'a, const O: u8> CKD_W<'a, O> {
480 #[inline(always)]
482 pub fn div1(self) -> &'a mut W {
483 self.variant(CKD_A::Div1)
484 }
485 #[inline(always)]
487 pub fn div2(self) -> &'a mut W {
488 self.variant(CKD_A::Div2)
489 }
490 #[inline(always)]
492 pub fn div4(self) -> &'a mut W {
493 self.variant(CKD_A::Div4)
494 }
495}
496impl R {
497 #[inline(always)]
499 pub fn cen(&self) -> CEN_R {
500 CEN_R::new((self.bits & 1) != 0)
501 }
502 #[inline(always)]
504 pub fn udis(&self) -> UDIS_R {
505 UDIS_R::new(((self.bits >> 1) & 1) != 0)
506 }
507 #[inline(always)]
509 pub fn urs(&self) -> URS_R {
510 URS_R::new(((self.bits >> 2) & 1) != 0)
511 }
512 #[inline(always)]
514 pub fn opm(&self) -> OPM_R {
515 OPM_R::new(((self.bits >> 3) & 1) != 0)
516 }
517 #[inline(always)]
519 pub fn dir(&self) -> DIR_R {
520 DIR_R::new(((self.bits >> 4) & 1) != 0)
521 }
522 #[inline(always)]
524 pub fn cms(&self) -> CMS_R {
525 CMS_R::new(((self.bits >> 5) & 3) as u8)
526 }
527 #[inline(always)]
529 pub fn arpe(&self) -> ARPE_R {
530 ARPE_R::new(((self.bits >> 7) & 1) != 0)
531 }
532 #[inline(always)]
534 pub fn ckd(&self) -> CKD_R {
535 CKD_R::new(((self.bits >> 8) & 3) as u8)
536 }
537}
538impl W {
539 #[inline(always)]
541 #[must_use]
542 pub fn cen(&mut self) -> CEN_W<0> {
543 CEN_W::new(self)
544 }
545 #[inline(always)]
547 #[must_use]
548 pub fn udis(&mut self) -> UDIS_W<1> {
549 UDIS_W::new(self)
550 }
551 #[inline(always)]
553 #[must_use]
554 pub fn urs(&mut self) -> URS_W<2> {
555 URS_W::new(self)
556 }
557 #[inline(always)]
559 #[must_use]
560 pub fn opm(&mut self) -> OPM_W<3> {
561 OPM_W::new(self)
562 }
563 #[inline(always)]
565 #[must_use]
566 pub fn dir(&mut self) -> DIR_W<4> {
567 DIR_W::new(self)
568 }
569 #[inline(always)]
571 #[must_use]
572 pub fn cms(&mut self) -> CMS_W<5> {
573 CMS_W::new(self)
574 }
575 #[inline(always)]
577 #[must_use]
578 pub fn arpe(&mut self) -> ARPE_W<7> {
579 ARPE_W::new(self)
580 }
581 #[inline(always)]
583 #[must_use]
584 pub fn ckd(&mut self) -> CKD_W<8> {
585 CKD_W::new(self)
586 }
587 #[inline(always)]
589 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
590 self.0.bits(bits);
591 self
592 }
593}
594pub struct CR1_SPEC;
600impl crate::RegisterSpec for CR1_SPEC {
601 type Ux = u32;
602}
603impl crate::Readable for CR1_SPEC {
605 type Reader = R;
606}
607impl crate::Writable for CR1_SPEC {
609 type Writer = W;
610 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
611 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
612}
613impl crate::Resettable for CR1_SPEC {
615 const RESET_VALUE: Self::Ux = 0;
616}