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)
}
}
impl R {
#[inline(always)]
pub fn ccs(&self, n: u8) -> CCS_R {
#[allow(clippy::no_effect)]
[(); 1][n as usize];
CCS_R::new(((self.bits >> (n * 0)) & 3) as u8)
}
#[inline(always)]
pub fn ccs_iter(&self) -> impl Iterator<Item = CCS_R> + '_ {
(0..1).map(move |n| CCS_R::new(((self.bits >> (n * 0)) & 3) as u8))
}
#[inline(always)]
pub fn cc1s(&self) -> CCS_R {
CCS_R::new((self.bits & 3) as u8)
}
#[inline(always)]
pub fn ocfe(&self, n: u8) -> OCFE_R {
#[allow(clippy::no_effect)]
[(); 1][n as usize];
OCFE_R::new(((self.bits >> (n * 0 + 2)) & 1) != 0)
}
#[inline(always)]
pub fn ocfe_iter(&self) -> impl Iterator<Item = OCFE_R> + '_ {
(0..1).map(move |n| OCFE_R::new(((self.bits >> (n * 0 + 2)) & 1) != 0))
}
#[inline(always)]
pub fn oc1fe(&self) -> OCFE_R {
OCFE_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn ocpe(&self, n: u8) -> OCPE_R {
#[allow(clippy::no_effect)]
[(); 1][n as usize];
OCPE_R::new(((self.bits >> (n * 0 + 3)) & 1) != 0)
}
#[inline(always)]
pub fn ocpe_iter(&self) -> impl Iterator<Item = OCPE_R> + '_ {
(0..1).map(move |n| OCPE_R::new(((self.bits >> (n * 0 + 3)) & 1) != 0))
}
#[inline(always)]
pub fn oc1pe(&self) -> OCPE_R {
OCPE_R::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn ocm(&self, n: u8) -> OCM_R {
#[allow(clippy::no_effect)]
[(); 1][n as usize];
OCM_R::new(((self.bits >> (n * 0 + 4)) & 7) as u8)
}
#[inline(always)]
pub fn ocm_iter(&self) -> impl Iterator<Item = OCM_R> + '_ {
(0..1).map(move |n| OCM_R::new(((self.bits >> (n * 0 + 4)) & 7) as u8))
}
#[inline(always)]
pub fn oc1m(&self) -> OCM_R {
OCM_R::new(((self.bits >> 4) & 7) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CCMR1_Output")
.field("oc1m", &self.oc1m())
.field("oc1pe", &self.oc1pe())
.field("oc1fe", &self.oc1fe())
.field("cc1s", &self.cc1s())
.finish()
}
}
impl W {
#[inline(always)]
pub fn ccs(&mut self, n: u8) -> CCS_W<CCMR1_OUTPUTrs> {
#[allow(clippy::no_effect)]
[(); 1][n as usize];
CCS_W::new(self, n * 0)
}
#[inline(always)]
pub fn cc1s(&mut self) -> CCS_W<CCMR1_OUTPUTrs> {
CCS_W::new(self, 0)
}
#[inline(always)]
pub fn ocfe(&mut self, n: u8) -> OCFE_W<CCMR1_OUTPUTrs> {
#[allow(clippy::no_effect)]
[(); 1][n as usize];
OCFE_W::new(self, n * 0 + 2)
}
#[inline(always)]
pub fn oc1fe(&mut self) -> OCFE_W<CCMR1_OUTPUTrs> {
OCFE_W::new(self, 2)
}
#[inline(always)]
pub fn ocpe(&mut self, n: u8) -> OCPE_W<CCMR1_OUTPUTrs> {
#[allow(clippy::no_effect)]
[(); 1][n as usize];
OCPE_W::new(self, n * 0 + 3)
}
#[inline(always)]
pub fn oc1pe(&mut self) -> OCPE_W<CCMR1_OUTPUTrs> {
OCPE_W::new(self, 3)
}
#[inline(always)]
pub fn ocm(&mut self, n: u8) -> OCM_W<CCMR1_OUTPUTrs> {
#[allow(clippy::no_effect)]
[(); 1][n as usize];
OCM_W::new(self, n * 0 + 4)
}
#[inline(always)]
pub fn oc1m(&mut self) -> OCM_W<CCMR1_OUTPUTrs> {
OCM_W::new(self, 4)
}
}
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 {}