1pub type R = crate::R<CCMR1_OUTPUTrs>;
3pub type W = crate::W<CCMR1_OUTPUTrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10#[repr(u8)]
11pub enum CC1S {
12 Output = 0,
14}
15impl From<CC1S> for u8 {
16 #[inline(always)]
17 fn from(variant: CC1S) -> Self {
18 variant as _
19 }
20}
21impl crate::FieldSpec for CC1S {
22 type Ux = u8;
23}
24impl crate::IsEnum for CC1S {}
25pub type CCS_R = crate::FieldReader<CC1S>;
27impl CCS_R {
28 #[inline(always)]
30 pub const fn variant(&self) -> Option<CC1S> {
31 match self.bits {
32 0 => Some(CC1S::Output),
33 _ => None,
34 }
35 }
36 #[inline(always)]
38 pub fn is_output(&self) -> bool {
39 *self == CC1S::Output
40 }
41}
42pub type CCS_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CC1S>;
44impl<'a, REG> CCS_W<'a, REG>
45where
46 REG: crate::Writable + crate::RegisterSpec,
47 REG::Ux: From<u8>,
48{
49 #[inline(always)]
51 pub fn output(self) -> &'a mut crate::W<REG> {
52 self.variant(CC1S::Output)
53 }
54}
55#[cfg_attr(feature = "defmt", derive(defmt::Format))]
59#[derive(Clone, Copy, Debug, PartialEq, Eq)]
60pub enum OC1FE {
61 Disabled = 0,
63 Enabled = 1,
65}
66impl From<OC1FE> for bool {
67 #[inline(always)]
68 fn from(variant: OC1FE) -> Self {
69 variant as u8 != 0
70 }
71}
72pub type OCFE_R = crate::BitReader<OC1FE>;
74impl OCFE_R {
75 #[inline(always)]
77 pub const fn variant(&self) -> OC1FE {
78 match self.bits {
79 false => OC1FE::Disabled,
80 true => OC1FE::Enabled,
81 }
82 }
83 #[inline(always)]
85 pub fn is_disabled(&self) -> bool {
86 *self == OC1FE::Disabled
87 }
88 #[inline(always)]
90 pub fn is_enabled(&self) -> bool {
91 *self == OC1FE::Enabled
92 }
93}
94pub type OCFE_W<'a, REG> = crate::BitWriter<'a, REG, OC1FE>;
96impl<'a, REG> OCFE_W<'a, REG>
97where
98 REG: crate::Writable + crate::RegisterSpec,
99{
100 #[inline(always)]
102 pub fn disabled(self) -> &'a mut crate::W<REG> {
103 self.variant(OC1FE::Disabled)
104 }
105 #[inline(always)]
107 pub fn enabled(self) -> &'a mut crate::W<REG> {
108 self.variant(OC1FE::Enabled)
109 }
110}
111#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum OC1PE {
117 Disabled = 0,
119 Enabled = 1,
121}
122impl From<OC1PE> for bool {
123 #[inline(always)]
124 fn from(variant: OC1PE) -> Self {
125 variant as u8 != 0
126 }
127}
128pub type OCPE_R = crate::BitReader<OC1PE>;
130impl OCPE_R {
131 #[inline(always)]
133 pub const fn variant(&self) -> OC1PE {
134 match self.bits {
135 false => OC1PE::Disabled,
136 true => OC1PE::Enabled,
137 }
138 }
139 #[inline(always)]
141 pub fn is_disabled(&self) -> bool {
142 *self == OC1PE::Disabled
143 }
144 #[inline(always)]
146 pub fn is_enabled(&self) -> bool {
147 *self == OC1PE::Enabled
148 }
149}
150pub type OCPE_W<'a, REG> = crate::BitWriter<'a, REG, OC1PE>;
152impl<'a, REG> OCPE_W<'a, REG>
153where
154 REG: crate::Writable + crate::RegisterSpec,
155{
156 #[inline(always)]
158 pub fn disabled(self) -> &'a mut crate::W<REG> {
159 self.variant(OC1PE::Disabled)
160 }
161 #[inline(always)]
163 pub fn enabled(self) -> &'a mut crate::W<REG> {
164 self.variant(OC1PE::Enabled)
165 }
166}
167#[cfg_attr(feature = "defmt", derive(defmt::Format))]
171#[derive(Clone, Copy, Debug, PartialEq, Eq)]
172#[repr(u8)]
173pub enum OC1M {
174 Frozen = 0,
176 ActiveOnMatch = 1,
178 InactiveOnMatch = 2,
180 Toggle = 3,
182 ForceInactive = 4,
184 ForceActive = 5,
186 PwmMode1 = 6,
188 PwmMode2 = 7,
190}
191impl From<OC1M> for u8 {
192 #[inline(always)]
193 fn from(variant: OC1M) -> Self {
194 variant as _
195 }
196}
197impl crate::FieldSpec for OC1M {
198 type Ux = u8;
199}
200impl crate::IsEnum for OC1M {}
201pub type OCM_R = crate::FieldReader<OC1M>;
203impl OCM_R {
204 #[inline(always)]
206 pub const fn variant(&self) -> OC1M {
207 match self.bits {
208 0 => OC1M::Frozen,
209 1 => OC1M::ActiveOnMatch,
210 2 => OC1M::InactiveOnMatch,
211 3 => OC1M::Toggle,
212 4 => OC1M::ForceInactive,
213 5 => OC1M::ForceActive,
214 6 => OC1M::PwmMode1,
215 7 => OC1M::PwmMode2,
216 _ => unreachable!(),
217 }
218 }
219 #[inline(always)]
221 pub fn is_frozen(&self) -> bool {
222 *self == OC1M::Frozen
223 }
224 #[inline(always)]
226 pub fn is_active_on_match(&self) -> bool {
227 *self == OC1M::ActiveOnMatch
228 }
229 #[inline(always)]
231 pub fn is_inactive_on_match(&self) -> bool {
232 *self == OC1M::InactiveOnMatch
233 }
234 #[inline(always)]
236 pub fn is_toggle(&self) -> bool {
237 *self == OC1M::Toggle
238 }
239 #[inline(always)]
241 pub fn is_force_inactive(&self) -> bool {
242 *self == OC1M::ForceInactive
243 }
244 #[inline(always)]
246 pub fn is_force_active(&self) -> bool {
247 *self == OC1M::ForceActive
248 }
249 #[inline(always)]
251 pub fn is_pwm_mode1(&self) -> bool {
252 *self == OC1M::PwmMode1
253 }
254 #[inline(always)]
256 pub fn is_pwm_mode2(&self) -> bool {
257 *self == OC1M::PwmMode2
258 }
259}
260pub type OCM_W<'a, REG> = crate::FieldWriter<'a, REG, 3, OC1M, crate::Safe>;
262impl<'a, REG> OCM_W<'a, REG>
263where
264 REG: crate::Writable + crate::RegisterSpec,
265 REG::Ux: From<u8>,
266{
267 #[inline(always)]
269 pub fn frozen(self) -> &'a mut crate::W<REG> {
270 self.variant(OC1M::Frozen)
271 }
272 #[inline(always)]
274 pub fn active_on_match(self) -> &'a mut crate::W<REG> {
275 self.variant(OC1M::ActiveOnMatch)
276 }
277 #[inline(always)]
279 pub fn inactive_on_match(self) -> &'a mut crate::W<REG> {
280 self.variant(OC1M::InactiveOnMatch)
281 }
282 #[inline(always)]
284 pub fn toggle(self) -> &'a mut crate::W<REG> {
285 self.variant(OC1M::Toggle)
286 }
287 #[inline(always)]
289 pub fn force_inactive(self) -> &'a mut crate::W<REG> {
290 self.variant(OC1M::ForceInactive)
291 }
292 #[inline(always)]
294 pub fn force_active(self) -> &'a mut crate::W<REG> {
295 self.variant(OC1M::ForceActive)
296 }
297 #[inline(always)]
299 pub fn pwm_mode1(self) -> &'a mut crate::W<REG> {
300 self.variant(OC1M::PwmMode1)
301 }
302 #[inline(always)]
304 pub fn pwm_mode2(self) -> &'a mut crate::W<REG> {
305 self.variant(OC1M::PwmMode2)
306 }
307}
308#[cfg_attr(feature = "defmt", derive(defmt::Format))]
312#[derive(Clone, Copy, Debug, PartialEq, Eq)]
313pub enum OC1M_3 {
314 Normal = 0,
316 Extended = 1,
318}
319impl From<OC1M_3> for bool {
320 #[inline(always)]
321 fn from(variant: OC1M_3) -> Self {
322 variant as u8 != 0
323 }
324}
325pub type OCM_3_R = crate::BitReader<OC1M_3>;
327impl OCM_3_R {
328 #[inline(always)]
330 pub const fn variant(&self) -> OC1M_3 {
331 match self.bits {
332 false => OC1M_3::Normal,
333 true => OC1M_3::Extended,
334 }
335 }
336 #[inline(always)]
338 pub fn is_normal(&self) -> bool {
339 *self == OC1M_3::Normal
340 }
341 #[inline(always)]
343 pub fn is_extended(&self) -> bool {
344 *self == OC1M_3::Extended
345 }
346}
347pub type OCM_3_W<'a, REG> = crate::BitWriter<'a, REG, OC1M_3>;
349impl<'a, REG> OCM_3_W<'a, REG>
350where
351 REG: crate::Writable + crate::RegisterSpec,
352{
353 #[inline(always)]
355 pub fn normal(self) -> &'a mut crate::W<REG> {
356 self.variant(OC1M_3::Normal)
357 }
358 #[inline(always)]
360 pub fn extended(self) -> &'a mut crate::W<REG> {
361 self.variant(OC1M_3::Extended)
362 }
363}
364impl R {
365 #[inline(always)]
369 pub fn ccs(&self, n: u8) -> CCS_R {
370 #[allow(clippy::no_effect)]
371 [(); 2][n as usize];
372 CCS_R::new(((self.bits >> (n * 8)) & 3) as u8)
373 }
374 #[inline(always)]
377 pub fn ccs_iter(&self) -> impl Iterator<Item = CCS_R> + '_ {
378 (0..2).map(move |n| CCS_R::new(((self.bits >> (n * 8)) & 3) as u8))
379 }
380 #[inline(always)]
382 pub fn cc1s(&self) -> CCS_R {
383 CCS_R::new((self.bits & 3) as u8)
384 }
385 #[inline(always)]
387 pub fn cc2s(&self) -> CCS_R {
388 CCS_R::new(((self.bits >> 8) & 3) as u8)
389 }
390 #[inline(always)]
394 pub fn ocfe(&self, n: u8) -> OCFE_R {
395 #[allow(clippy::no_effect)]
396 [(); 2][n as usize];
397 OCFE_R::new(((self.bits >> (n * 8 + 2)) & 1) != 0)
398 }
399 #[inline(always)]
402 pub fn ocfe_iter(&self) -> impl Iterator<Item = OCFE_R> + '_ {
403 (0..2).map(move |n| OCFE_R::new(((self.bits >> (n * 8 + 2)) & 1) != 0))
404 }
405 #[inline(always)]
407 pub fn oc1fe(&self) -> OCFE_R {
408 OCFE_R::new(((self.bits >> 2) & 1) != 0)
409 }
410 #[inline(always)]
412 pub fn oc2fe(&self) -> OCFE_R {
413 OCFE_R::new(((self.bits >> 10) & 1) != 0)
414 }
415 #[inline(always)]
419 pub fn ocpe(&self, n: u8) -> OCPE_R {
420 #[allow(clippy::no_effect)]
421 [(); 2][n as usize];
422 OCPE_R::new(((self.bits >> (n * 8 + 3)) & 1) != 0)
423 }
424 #[inline(always)]
427 pub fn ocpe_iter(&self) -> impl Iterator<Item = OCPE_R> + '_ {
428 (0..2).map(move |n| OCPE_R::new(((self.bits >> (n * 8 + 3)) & 1) != 0))
429 }
430 #[inline(always)]
432 pub fn oc1pe(&self) -> OCPE_R {
433 OCPE_R::new(((self.bits >> 3) & 1) != 0)
434 }
435 #[inline(always)]
437 pub fn oc2pe(&self) -> OCPE_R {
438 OCPE_R::new(((self.bits >> 11) & 1) != 0)
439 }
440 #[inline(always)]
444 pub fn ocm(&self, n: u8) -> OCM_R {
445 #[allow(clippy::no_effect)]
446 [(); 2][n as usize];
447 OCM_R::new(((self.bits >> (n * 8 + 4)) & 7) as u8)
448 }
449 #[inline(always)]
452 pub fn ocm_iter(&self) -> impl Iterator<Item = OCM_R> + '_ {
453 (0..2).map(move |n| OCM_R::new(((self.bits >> (n * 8 + 4)) & 7) as u8))
454 }
455 #[inline(always)]
457 pub fn oc1m(&self) -> OCM_R {
458 OCM_R::new(((self.bits >> 4) & 7) as u8)
459 }
460 #[inline(always)]
462 pub fn oc2m(&self) -> OCM_R {
463 OCM_R::new(((self.bits >> 12) & 7) as u8)
464 }
465 #[inline(always)]
469 pub fn ocm_3(&self, n: u8) -> OCM_3_R {
470 #[allow(clippy::no_effect)]
471 [(); 2][n as usize];
472 OCM_3_R::new(((self.bits >> (n * 8 + 16)) & 1) != 0)
473 }
474 #[inline(always)]
477 pub fn ocm_3_iter(&self) -> impl Iterator<Item = OCM_3_R> + '_ {
478 (0..2).map(move |n| OCM_3_R::new(((self.bits >> (n * 8 + 16)) & 1) != 0))
479 }
480 #[inline(always)]
482 pub fn oc1m_3(&self) -> OCM_3_R {
483 OCM_3_R::new(((self.bits >> 16) & 1) != 0)
484 }
485 #[inline(always)]
487 pub fn oc2m_3(&self) -> OCM_3_R {
488 OCM_3_R::new(((self.bits >> 24) & 1) != 0)
489 }
490}
491impl core::fmt::Debug for R {
492 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
493 f.debug_struct("CCMR1_Output")
494 .field("cc1s", &self.cc1s())
495 .field("cc2s", &self.cc2s())
496 .field("oc1fe", &self.oc1fe())
497 .field("oc2fe", &self.oc2fe())
498 .field("oc1pe", &self.oc1pe())
499 .field("oc2pe", &self.oc2pe())
500 .field("oc1m", &self.oc1m())
501 .field("oc2m", &self.oc2m())
502 .field("oc1m_3", &self.oc1m_3())
503 .field("oc2m_3", &self.oc2m_3())
504 .finish()
505 }
506}
507impl W {
508 #[inline(always)]
512 pub fn ccs(&mut self, n: u8) -> CCS_W<CCMR1_OUTPUTrs> {
513 #[allow(clippy::no_effect)]
514 [(); 2][n as usize];
515 CCS_W::new(self, n * 8)
516 }
517 #[inline(always)]
519 pub fn cc1s(&mut self) -> CCS_W<CCMR1_OUTPUTrs> {
520 CCS_W::new(self, 0)
521 }
522 #[inline(always)]
524 pub fn cc2s(&mut self) -> CCS_W<CCMR1_OUTPUTrs> {
525 CCS_W::new(self, 8)
526 }
527 #[inline(always)]
531 pub fn ocfe(&mut self, n: u8) -> OCFE_W<CCMR1_OUTPUTrs> {
532 #[allow(clippy::no_effect)]
533 [(); 2][n as usize];
534 OCFE_W::new(self, n * 8 + 2)
535 }
536 #[inline(always)]
538 pub fn oc1fe(&mut self) -> OCFE_W<CCMR1_OUTPUTrs> {
539 OCFE_W::new(self, 2)
540 }
541 #[inline(always)]
543 pub fn oc2fe(&mut self) -> OCFE_W<CCMR1_OUTPUTrs> {
544 OCFE_W::new(self, 10)
545 }
546 #[inline(always)]
550 pub fn ocpe(&mut self, n: u8) -> OCPE_W<CCMR1_OUTPUTrs> {
551 #[allow(clippy::no_effect)]
552 [(); 2][n as usize];
553 OCPE_W::new(self, n * 8 + 3)
554 }
555 #[inline(always)]
557 pub fn oc1pe(&mut self) -> OCPE_W<CCMR1_OUTPUTrs> {
558 OCPE_W::new(self, 3)
559 }
560 #[inline(always)]
562 pub fn oc2pe(&mut self) -> OCPE_W<CCMR1_OUTPUTrs> {
563 OCPE_W::new(self, 11)
564 }
565 #[inline(always)]
569 pub fn ocm(&mut self, n: u8) -> OCM_W<CCMR1_OUTPUTrs> {
570 #[allow(clippy::no_effect)]
571 [(); 2][n as usize];
572 OCM_W::new(self, n * 8 + 4)
573 }
574 #[inline(always)]
576 pub fn oc1m(&mut self) -> OCM_W<CCMR1_OUTPUTrs> {
577 OCM_W::new(self, 4)
578 }
579 #[inline(always)]
581 pub fn oc2m(&mut self) -> OCM_W<CCMR1_OUTPUTrs> {
582 OCM_W::new(self, 12)
583 }
584 #[inline(always)]
588 pub fn ocm_3(&mut self, n: u8) -> OCM_3_W<CCMR1_OUTPUTrs> {
589 #[allow(clippy::no_effect)]
590 [(); 2][n as usize];
591 OCM_3_W::new(self, n * 8 + 16)
592 }
593 #[inline(always)]
595 pub fn oc1m_3(&mut self) -> OCM_3_W<CCMR1_OUTPUTrs> {
596 OCM_3_W::new(self, 16)
597 }
598 #[inline(always)]
600 pub fn oc2m_3(&mut self) -> OCM_3_W<CCMR1_OUTPUTrs> {
601 OCM_3_W::new(self, 24)
602 }
603}
604pub struct CCMR1_OUTPUTrs;
610impl crate::RegisterSpec for CCMR1_OUTPUTrs {
611 type Ux = u32;
612}
613impl crate::Readable for CCMR1_OUTPUTrs {}
615impl crate::Writable for CCMR1_OUTPUTrs {
617 type Safety = crate::Unsafe;
618}
619impl crate::Resettable for CCMR1_OUTPUTrs {}