pub type R = crate::R<CCMR1_OUTPUTrs>;
pub type W = crate::W<CCMR1_OUTPUTrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum CC1S {
Output = 0,
}
impl From<CC1S> for u8 {
#[inline(always)]
fn from(variant: CC1S) -> Self {
variant as _
}
}
impl crate::FieldSpec for CC1S {
type Ux = u8;
}
impl crate::IsEnum for CC1S {}
pub type CCS_R = crate::FieldReader<CC1S>;
impl CCS_R {
#[inline(always)]
pub const fn variant(&self) -> Option<CC1S> {
match self.bits {
0 => Some(CC1S::Output),
_ => None,
}
}
#[inline(always)]
pub fn is_output(&self) -> bool {
*self == CC1S::Output
}
}
pub type CCS_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CC1S>;
impl<'a, REG> CCS_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn output(self) -> &'a mut crate::W<REG> {
self.variant(CC1S::Output)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OC1FE {
Disabled = 0,
Enabled = 1,
}
impl From<OC1FE> for bool {
#[inline(always)]
fn from(variant: OC1FE) -> Self {
variant as u8 != 0
}
}
pub type OCFE_R = crate::BitReader<OC1FE>;
impl OCFE_R {
#[inline(always)]
pub const fn variant(&self) -> OC1FE {
match self.bits {
false => OC1FE::Disabled,
true => OC1FE::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == OC1FE::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == OC1FE::Enabled
}
}
pub type OCFE_W<'a, REG> = crate::BitWriter<'a, REG, OC1FE>;
impl<'a, REG> OCFE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(OC1FE::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(OC1FE::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OC1PE {
Disabled = 0,
Enabled = 1,
}
impl From<OC1PE> for bool {
#[inline(always)]
fn from(variant: OC1PE) -> Self {
variant as u8 != 0
}
}
pub type OCPE_R = crate::BitReader<OC1PE>;
impl OCPE_R {
#[inline(always)]
pub const fn variant(&self) -> OC1PE {
match self.bits {
false => OC1PE::Disabled,
true => OC1PE::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == OC1PE::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == OC1PE::Enabled
}
}
pub type OCPE_W<'a, REG> = crate::BitWriter<'a, REG, OC1PE>;
impl<'a, REG> OCPE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(OC1PE::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(OC1PE::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum OC1M {
Frozen = 0,
ActiveOnMatch = 1,
InactiveOnMatch = 2,
Toggle = 3,
ForceInactive = 4,
ForceActive = 5,
PwmMode1 = 6,
PwmMode2 = 7,
}
impl From<OC1M> for u8 {
#[inline(always)]
fn from(variant: OC1M) -> Self {
variant as _
}
}
impl crate::FieldSpec for OC1M {
type Ux = u8;
}
impl crate::IsEnum for OC1M {}
pub type OCM_R = crate::FieldReader<OC1M>;
impl OCM_R {
#[inline(always)]
pub const fn variant(&self) -> OC1M {
match self.bits {
0 => OC1M::Frozen,
1 => OC1M::ActiveOnMatch,
2 => OC1M::InactiveOnMatch,
3 => OC1M::Toggle,
4 => OC1M::ForceInactive,
5 => OC1M::ForceActive,
6 => OC1M::PwmMode1,
7 => OC1M::PwmMode2,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_frozen(&self) -> bool {
*self == OC1M::Frozen
}
#[inline(always)]
pub fn is_active_on_match(&self) -> bool {
*self == OC1M::ActiveOnMatch
}
#[inline(always)]
pub fn is_inactive_on_match(&self) -> bool {
*self == OC1M::InactiveOnMatch
}
#[inline(always)]
pub fn is_toggle(&self) -> bool {
*self == OC1M::Toggle
}
#[inline(always)]
pub fn is_force_inactive(&self) -> bool {
*self == OC1M::ForceInactive
}
#[inline(always)]
pub fn is_force_active(&self) -> bool {
*self == OC1M::ForceActive
}
#[inline(always)]
pub fn is_pwm_mode1(&self) -> bool {
*self == OC1M::PwmMode1
}
#[inline(always)]
pub fn is_pwm_mode2(&self) -> bool {
*self == OC1M::PwmMode2
}
}
pub type OCM_W<'a, REG> = crate::FieldWriter<'a, REG, 3, OC1M, crate::Safe>;
impl<'a, REG> OCM_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn frozen(self) -> &'a mut crate::W<REG> {
self.variant(OC1M::Frozen)
}
#[inline(always)]
pub fn active_on_match(self) -> &'a mut crate::W<REG> {
self.variant(OC1M::ActiveOnMatch)
}
#[inline(always)]
pub fn inactive_on_match(self) -> &'a mut crate::W<REG> {
self.variant(OC1M::InactiveOnMatch)
}
#[inline(always)]
pub fn toggle(self) -> &'a mut crate::W<REG> {
self.variant(OC1M::Toggle)
}
#[inline(always)]
pub fn force_inactive(self) -> &'a mut crate::W<REG> {
self.variant(OC1M::ForceInactive)
}
#[inline(always)]
pub fn force_active(self) -> &'a mut crate::W<REG> {
self.variant(OC1M::ForceActive)
}
#[inline(always)]
pub fn pwm_mode1(self) -> &'a mut crate::W<REG> {
self.variant(OC1M::PwmMode1)
}
#[inline(always)]
pub fn pwm_mode2(self) -> &'a mut crate::W<REG> {
self.variant(OC1M::PwmMode2)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OC1CE {
Disabled = 0,
Enabled = 1,
}
impl From<OC1CE> for bool {
#[inline(always)]
fn from(variant: OC1CE) -> Self {
variant as u8 != 0
}
}
pub type OCCE_R = crate::BitReader<OC1CE>;
impl OCCE_R {
#[inline(always)]
pub const fn variant(&self) -> OC1CE {
match self.bits {
false => OC1CE::Disabled,
true => OC1CE::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == OC1CE::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == OC1CE::Enabled
}
}
pub type OCCE_W<'a, REG> = crate::BitWriter<'a, REG, OC1CE>;
impl<'a, REG> OCCE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(OC1CE::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(OC1CE::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OC1M_3 {
Normal = 0,
Extended = 1,
}
impl From<OC1M_3> for bool {
#[inline(always)]
fn from(variant: OC1M_3) -> Self {
variant as u8 != 0
}
}
pub type OCM_3_R = crate::BitReader<OC1M_3>;
impl OCM_3_R {
#[inline(always)]
pub const fn variant(&self) -> OC1M_3 {
match self.bits {
false => OC1M_3::Normal,
true => OC1M_3::Extended,
}
}
#[inline(always)]
pub fn is_normal(&self) -> bool {
*self == OC1M_3::Normal
}
#[inline(always)]
pub fn is_extended(&self) -> bool {
*self == OC1M_3::Extended
}
}
pub type OCM_3_W<'a, REG> = crate::BitWriter<'a, REG, OC1M_3>;
impl<'a, REG> OCM_3_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn normal(self) -> &'a mut crate::W<REG> {
self.variant(OC1M_3::Normal)
}
#[inline(always)]
pub fn extended(self) -> &'a mut crate::W<REG> {
self.variant(OC1M_3::Extended)
}
}
impl R {
#[inline(always)]
pub fn ccs(&self, n: u8) -> CCS_R {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
CCS_R::new(((self.bits >> (n * 8)) & 3) as u8)
}
#[inline(always)]
pub fn ccs_iter(&self) -> impl Iterator<Item = CCS_R> + '_ {
(0..2).map(move |n| CCS_R::new(((self.bits >> (n * 8)) & 3) as u8))
}
#[inline(always)]
pub fn cc1s(&self) -> CCS_R {
CCS_R::new((self.bits & 3) as u8)
}
#[inline(always)]
pub fn cc2s(&self) -> CCS_R {
CCS_R::new(((self.bits >> 8) & 3) as u8)
}
#[inline(always)]
pub fn ocfe(&self, n: u8) -> OCFE_R {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
OCFE_R::new(((self.bits >> (n * 8 + 2)) & 1) != 0)
}
#[inline(always)]
pub fn ocfe_iter(&self) -> impl Iterator<Item = OCFE_R> + '_ {
(0..2).map(move |n| OCFE_R::new(((self.bits >> (n * 8 + 2)) & 1) != 0))
}
#[inline(always)]
pub fn oc1fe(&self) -> OCFE_R {
OCFE_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn oc2fe(&self) -> OCFE_R {
OCFE_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn ocpe(&self, n: u8) -> OCPE_R {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
OCPE_R::new(((self.bits >> (n * 8 + 3)) & 1) != 0)
}
#[inline(always)]
pub fn ocpe_iter(&self) -> impl Iterator<Item = OCPE_R> + '_ {
(0..2).map(move |n| OCPE_R::new(((self.bits >> (n * 8 + 3)) & 1) != 0))
}
#[inline(always)]
pub fn oc1pe(&self) -> OCPE_R {
OCPE_R::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn oc2pe(&self) -> OCPE_R {
OCPE_R::new(((self.bits >> 11) & 1) != 0)
}
#[inline(always)]
pub fn ocm(&self, n: u8) -> OCM_R {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
OCM_R::new(((self.bits >> (n * 8 + 4)) & 7) as u8)
}
#[inline(always)]
pub fn ocm_iter(&self) -> impl Iterator<Item = OCM_R> + '_ {
(0..2).map(move |n| OCM_R::new(((self.bits >> (n * 8 + 4)) & 7) as u8))
}
#[inline(always)]
pub fn oc1m(&self) -> OCM_R {
OCM_R::new(((self.bits >> 4) & 7) as u8)
}
#[inline(always)]
pub fn oc2m(&self) -> OCM_R {
OCM_R::new(((self.bits >> 12) & 7) as u8)
}
#[inline(always)]
pub fn occe(&self, n: u8) -> OCCE_R {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
OCCE_R::new(((self.bits >> (n * 8 + 7)) & 1) != 0)
}
#[inline(always)]
pub fn occe_iter(&self) -> impl Iterator<Item = OCCE_R> + '_ {
(0..2).map(move |n| OCCE_R::new(((self.bits >> (n * 8 + 7)) & 1) != 0))
}
#[inline(always)]
pub fn oc1ce(&self) -> OCCE_R {
OCCE_R::new(((self.bits >> 7) & 1) != 0)
}
#[inline(always)]
pub fn oc2ce(&self) -> OCCE_R {
OCCE_R::new(((self.bits >> 15) & 1) != 0)
}
#[inline(always)]
pub fn ocm_3(&self, n: u8) -> OCM_3_R {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
OCM_3_R::new(((self.bits >> (n * 8 + 16)) & 1) != 0)
}
#[inline(always)]
pub fn ocm_3_iter(&self) -> impl Iterator<Item = OCM_3_R> + '_ {
(0..2).map(move |n| OCM_3_R::new(((self.bits >> (n * 8 + 16)) & 1) != 0))
}
#[inline(always)]
pub fn oc1m_3(&self) -> OCM_3_R {
OCM_3_R::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn oc2m_3(&self) -> OCM_3_R {
OCM_3_R::new(((self.bits >> 24) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CCMR1_Output")
.field("oc1ce", &self.oc1ce())
.field("oc2ce", &self.oc2ce())
.field("oc1m", &self.oc1m())
.field("oc2m", &self.oc2m())
.field("oc1pe", &self.oc1pe())
.field("oc2pe", &self.oc2pe())
.field("oc1fe", &self.oc1fe())
.field("oc2fe", &self.oc2fe())
.field("cc1s", &self.cc1s())
.field("cc2s", &self.cc2s())
.field("oc1m_3", &self.oc1m_3())
.field("oc2m_3", &self.oc2m_3())
.finish()
}
}
impl W {
#[inline(always)]
pub fn ccs(&mut self, n: u8) -> CCS_W<CCMR1_OUTPUTrs> {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
CCS_W::new(self, n * 8)
}
#[inline(always)]
pub fn cc1s(&mut self) -> CCS_W<CCMR1_OUTPUTrs> {
CCS_W::new(self, 0)
}
#[inline(always)]
pub fn cc2s(&mut self) -> CCS_W<CCMR1_OUTPUTrs> {
CCS_W::new(self, 8)
}
#[inline(always)]
pub fn ocfe(&mut self, n: u8) -> OCFE_W<CCMR1_OUTPUTrs> {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
OCFE_W::new(self, n * 8 + 2)
}
#[inline(always)]
pub fn oc1fe(&mut self) -> OCFE_W<CCMR1_OUTPUTrs> {
OCFE_W::new(self, 2)
}
#[inline(always)]
pub fn oc2fe(&mut self) -> OCFE_W<CCMR1_OUTPUTrs> {
OCFE_W::new(self, 10)
}
#[inline(always)]
pub fn ocpe(&mut self, n: u8) -> OCPE_W<CCMR1_OUTPUTrs> {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
OCPE_W::new(self, n * 8 + 3)
}
#[inline(always)]
pub fn oc1pe(&mut self) -> OCPE_W<CCMR1_OUTPUTrs> {
OCPE_W::new(self, 3)
}
#[inline(always)]
pub fn oc2pe(&mut self) -> OCPE_W<CCMR1_OUTPUTrs> {
OCPE_W::new(self, 11)
}
#[inline(always)]
pub fn ocm(&mut self, n: u8) -> OCM_W<CCMR1_OUTPUTrs> {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
OCM_W::new(self, n * 8 + 4)
}
#[inline(always)]
pub fn oc1m(&mut self) -> OCM_W<CCMR1_OUTPUTrs> {
OCM_W::new(self, 4)
}
#[inline(always)]
pub fn oc2m(&mut self) -> OCM_W<CCMR1_OUTPUTrs> {
OCM_W::new(self, 12)
}
#[inline(always)]
pub fn occe(&mut self, n: u8) -> OCCE_W<CCMR1_OUTPUTrs> {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
OCCE_W::new(self, n * 8 + 7)
}
#[inline(always)]
pub fn oc1ce(&mut self) -> OCCE_W<CCMR1_OUTPUTrs> {
OCCE_W::new(self, 7)
}
#[inline(always)]
pub fn oc2ce(&mut self) -> OCCE_W<CCMR1_OUTPUTrs> {
OCCE_W::new(self, 15)
}
#[inline(always)]
pub fn ocm_3(&mut self, n: u8) -> OCM_3_W<CCMR1_OUTPUTrs> {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
OCM_3_W::new(self, n * 8 + 16)
}
#[inline(always)]
pub fn oc1m_3(&mut self) -> OCM_3_W<CCMR1_OUTPUTrs> {
OCM_3_W::new(self, 16)
}
#[inline(always)]
pub fn oc2m_3(&mut self) -> OCM_3_W<CCMR1_OUTPUTrs> {
OCM_3_W::new(self, 24)
}
}
pub struct CCMR1_OUTPUTrs;
impl crate::RegisterSpec for CCMR1_OUTPUTrs {
type Ux = u32;
}
impl crate::Readable for CCMR1_OUTPUTrs {}
impl crate::Writable for CCMR1_OUTPUTrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CCMR1_OUTPUTrs {}