pub type R = crate::R<CCERrs>;
pub type W = crate::W<CCERrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CC1E {
Disabled = 0,
Enabled = 1,
}
impl From<CC1E> for bool {
#[inline(always)]
fn from(variant: CC1E) -> Self {
variant as u8 != 0
}
}
pub type CCE_R = crate::BitReader<CC1E>;
impl CCE_R {
#[inline(always)]
pub const fn variant(&self) -> CC1E {
match self.bits {
false => CC1E::Disabled,
true => CC1E::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == CC1E::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == CC1E::Enabled
}
}
pub type CCE_W<'a, REG> = crate::BitWriter<'a, REG, CC1E>;
impl<'a, REG> CCE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(CC1E::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(CC1E::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CC1P {
RisingEdge = 0,
FallingEdge = 1,
}
impl From<CC1P> for bool {
#[inline(always)]
fn from(variant: CC1P) -> Self {
variant as u8 != 0
}
}
pub type CCP_R = crate::BitReader<CC1P>;
impl CCP_R {
#[inline(always)]
pub const fn variant(&self) -> CC1P {
match self.bits {
false => CC1P::RisingEdge,
true => CC1P::FallingEdge,
}
}
#[inline(always)]
pub fn is_rising_edge(&self) -> bool {
*self == CC1P::RisingEdge
}
#[inline(always)]
pub fn is_falling_edge(&self) -> bool {
*self == CC1P::FallingEdge
}
}
pub type CCP_W<'a, REG> = crate::BitWriter<'a, REG, CC1P>;
impl<'a, REG> CCP_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn rising_edge(self) -> &'a mut crate::W<REG> {
self.variant(CC1P::RisingEdge)
}
#[inline(always)]
pub fn falling_edge(self) -> &'a mut crate::W<REG> {
self.variant(CC1P::FallingEdge)
}
}
pub type CCNP_R = crate::BitReader;
pub type CCNP_W<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[inline(always)]
pub fn cce(&self, n: u8) -> CCE_R {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
CCE_R::new(((self.bits >> (n * 4)) & 1) != 0)
}
#[inline(always)]
pub fn cce_iter(&self) -> impl Iterator<Item = CCE_R> + '_ {
(0..2).map(move |n| CCE_R::new(((self.bits >> (n * 4)) & 1) != 0))
}
#[inline(always)]
pub fn cc1e(&self) -> CCE_R {
CCE_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn cc2e(&self) -> CCE_R {
CCE_R::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn ccp(&self, n: u8) -> CCP_R {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
CCP_R::new(((self.bits >> (n * 4 + 1)) & 1) != 0)
}
#[inline(always)]
pub fn ccp_iter(&self) -> impl Iterator<Item = CCP_R> + '_ {
(0..2).map(move |n| CCP_R::new(((self.bits >> (n * 4 + 1)) & 1) != 0))
}
#[inline(always)]
pub fn cc1p(&self) -> CCP_R {
CCP_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn cc2p(&self) -> CCP_R {
CCP_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn ccnp(&self, n: u8) -> CCNP_R {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
CCNP_R::new(((self.bits >> (n * 4 + 3)) & 1) != 0)
}
#[inline(always)]
pub fn ccnp_iter(&self) -> impl Iterator<Item = CCNP_R> + '_ {
(0..2).map(move |n| CCNP_R::new(((self.bits >> (n * 4 + 3)) & 1) != 0))
}
#[inline(always)]
pub fn cc1np(&self) -> CCNP_R {
CCNP_R::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn cc2np(&self) -> CCNP_R {
CCNP_R::new(((self.bits >> 7) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CCER")
.field("cc1np", &self.cc1np())
.field("cc2np", &self.cc2np())
.field("cc1p", &self.cc1p())
.field("cc2p", &self.cc2p())
.field("cc1e", &self.cc1e())
.field("cc2e", &self.cc2e())
.finish()
}
}
impl W {
#[inline(always)]
pub fn cce(&mut self, n: u8) -> CCE_W<CCERrs> {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
CCE_W::new(self, n * 4)
}
#[inline(always)]
pub fn cc1e(&mut self) -> CCE_W<CCERrs> {
CCE_W::new(self, 0)
}
#[inline(always)]
pub fn cc2e(&mut self) -> CCE_W<CCERrs> {
CCE_W::new(self, 4)
}
#[inline(always)]
pub fn ccp(&mut self, n: u8) -> CCP_W<CCERrs> {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
CCP_W::new(self, n * 4 + 1)
}
#[inline(always)]
pub fn cc1p(&mut self) -> CCP_W<CCERrs> {
CCP_W::new(self, 1)
}
#[inline(always)]
pub fn cc2p(&mut self) -> CCP_W<CCERrs> {
CCP_W::new(self, 5)
}
#[inline(always)]
pub fn ccnp(&mut self, n: u8) -> CCNP_W<CCERrs> {
#[allow(clippy::no_effect)]
[(); 2][n as usize];
CCNP_W::new(self, n * 4 + 3)
}
#[inline(always)]
pub fn cc1np(&mut self) -> CCNP_W<CCERrs> {
CCNP_W::new(self, 3)
}
#[inline(always)]
pub fn cc2np(&mut self) -> CCNP_W<CCERrs> {
CCNP_W::new(self, 7)
}
}
pub struct CCERrs;
impl crate::RegisterSpec for CCERrs {
type Ux = u32;
}
impl crate::Readable for CCERrs {}
impl crate::Writable for CCERrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CCERrs {}