pub type R = crate::R<CR2rs>;
pub type W = crate::W<CR2rs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CCPC {
NotPreloaded = 0,
Preloaded = 1,
}
impl From<CCPC> for bool {
#[inline(always)]
fn from(variant: CCPC) -> Self {
variant as u8 != 0
}
}
pub type CCPC_R = crate::BitReader<CCPC>;
impl CCPC_R {
#[inline(always)]
pub const fn variant(&self) -> CCPC {
match self.bits {
false => CCPC::NotPreloaded,
true => CCPC::Preloaded,
}
}
#[inline(always)]
pub fn is_not_preloaded(&self) -> bool {
*self == CCPC::NotPreloaded
}
#[inline(always)]
pub fn is_preloaded(&self) -> bool {
*self == CCPC::Preloaded
}
}
pub type CCPC_W<'a, REG> = crate::BitWriter<'a, REG, CCPC>;
impl<'a, REG> CCPC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn not_preloaded(self) -> &'a mut crate::W<REG> {
self.variant(CCPC::NotPreloaded)
}
#[inline(always)]
pub fn preloaded(self) -> &'a mut crate::W<REG> {
self.variant(CCPC::Preloaded)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CCUS {
Sw = 0,
SwOrEdge = 1,
}
impl From<CCUS> for bool {
#[inline(always)]
fn from(variant: CCUS) -> Self {
variant as u8 != 0
}
}
pub type CCUS_R = crate::BitReader<CCUS>;
impl CCUS_R {
#[inline(always)]
pub const fn variant(&self) -> CCUS {
match self.bits {
false => CCUS::Sw,
true => CCUS::SwOrEdge,
}
}
#[inline(always)]
pub fn is_sw(&self) -> bool {
*self == CCUS::Sw
}
#[inline(always)]
pub fn is_sw_or_edge(&self) -> bool {
*self == CCUS::SwOrEdge
}
}
pub type CCUS_W<'a, REG> = crate::BitWriter<'a, REG, CCUS>;
impl<'a, REG> CCUS_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn sw(self) -> &'a mut crate::W<REG> {
self.variant(CCUS::Sw)
}
#[inline(always)]
pub fn sw_or_edge(self) -> &'a mut crate::W<REG> {
self.variant(CCUS::SwOrEdge)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CCDS {
OnCompare = 0,
OnUpdate = 1,
}
impl From<CCDS> for bool {
#[inline(always)]
fn from(variant: CCDS) -> Self {
variant as u8 != 0
}
}
pub type CCDS_R = crate::BitReader<CCDS>;
impl CCDS_R {
#[inline(always)]
pub const fn variant(&self) -> CCDS {
match self.bits {
false => CCDS::OnCompare,
true => CCDS::OnUpdate,
}
}
#[inline(always)]
pub fn is_on_compare(&self) -> bool {
*self == CCDS::OnCompare
}
#[inline(always)]
pub fn is_on_update(&self) -> bool {
*self == CCDS::OnUpdate
}
}
pub type CCDS_W<'a, REG> = crate::BitWriter<'a, REG, CCDS>;
impl<'a, REG> CCDS_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn on_compare(self) -> &'a mut crate::W<REG> {
self.variant(CCDS::OnCompare)
}
#[inline(always)]
pub fn on_update(self) -> &'a mut crate::W<REG> {
self.variant(CCDS::OnUpdate)
}
}
pub type MMS_R = crate::FieldReader;
pub type MMS_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TI1S {
Normal = 0,
Xor = 1,
}
impl From<TI1S> for bool {
#[inline(always)]
fn from(variant: TI1S) -> Self {
variant as u8 != 0
}
}
pub type TI1S_R = crate::BitReader<TI1S>;
impl TI1S_R {
#[inline(always)]
pub const fn variant(&self) -> TI1S {
match self.bits {
false => TI1S::Normal,
true => TI1S::Xor,
}
}
#[inline(always)]
pub fn is_normal(&self) -> bool {
*self == TI1S::Normal
}
#[inline(always)]
pub fn is_xor(&self) -> bool {
*self == TI1S::Xor
}
}
pub type TI1S_W<'a, REG> = crate::BitWriter<'a, REG, TI1S>;
impl<'a, REG> TI1S_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn normal(self) -> &'a mut crate::W<REG> {
self.variant(TI1S::Normal)
}
#[inline(always)]
pub fn xor(self) -> &'a mut crate::W<REG> {
self.variant(TI1S::Xor)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OIS1 {
Reset = 0,
Set = 1,
}
impl From<OIS1> for bool {
#[inline(always)]
fn from(variant: OIS1) -> Self {
variant as u8 != 0
}
}
pub type OIS_R = crate::BitReader<OIS1>;
impl OIS_R {
#[inline(always)]
pub const fn variant(&self) -> OIS1 {
match self.bits {
false => OIS1::Reset,
true => OIS1::Set,
}
}
#[inline(always)]
pub fn is_reset(&self) -> bool {
*self == OIS1::Reset
}
#[inline(always)]
pub fn is_set(&self) -> bool {
*self == OIS1::Set
}
}
pub type OIS_W<'a, REG> = crate::BitWriter<'a, REG, OIS1>;
impl<'a, REG> OIS_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn reset(self) -> &'a mut crate::W<REG> {
self.variant(OIS1::Reset)
}
#[inline(always)]
pub fn set_(self) -> &'a mut crate::W<REG> {
self.variant(OIS1::Set)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OIS1N {
Reset = 0,
Set = 1,
}
impl From<OIS1N> for bool {
#[inline(always)]
fn from(variant: OIS1N) -> Self {
variant as u8 != 0
}
}
pub type OISN_R = crate::BitReader<OIS1N>;
impl OISN_R {
#[inline(always)]
pub const fn variant(&self) -> OIS1N {
match self.bits {
false => OIS1N::Reset,
true => OIS1N::Set,
}
}
#[inline(always)]
pub fn is_reset(&self) -> bool {
*self == OIS1N::Reset
}
#[inline(always)]
pub fn is_set(&self) -> bool {
*self == OIS1N::Set
}
}
pub type OISN_W<'a, REG> = crate::BitWriter<'a, REG, OIS1N>;
impl<'a, REG> OISN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn reset(self) -> &'a mut crate::W<REG> {
self.variant(OIS1N::Reset)
}
#[inline(always)]
pub fn set_(self) -> &'a mut crate::W<REG> {
self.variant(OIS1N::Set)
}
}
pub type MMS2_R = crate::FieldReader;
pub type MMS2_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
impl R {
#[inline(always)]
pub fn ccpc(&self) -> CCPC_R {
CCPC_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn ccus(&self) -> CCUS_R {
CCUS_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn ccds(&self) -> CCDS_R {
CCDS_R::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn mms(&self) -> MMS_R {
MMS_R::new(((self.bits >> 4) & 7) as u8)
}
#[inline(always)]
pub fn ti1s(&self) -> TI1S_R {
TI1S_R::new(((self.bits >> 7) & 1) != 0)
}
#[inline(always)]
pub fn ois(&self, n: u8) -> OIS_R {
#[allow(clippy::no_effect)]
[(); 6][n as usize];
OIS_R::new(((self.bits >> (n * 2 + 8)) & 1) != 0)
}
#[inline(always)]
pub fn ois_iter(&self) -> impl Iterator<Item = OIS_R> + '_ {
(0..6).map(move |n| OIS_R::new(((self.bits >> (n * 2 + 8)) & 1) != 0))
}
#[inline(always)]
pub fn ois1(&self) -> OIS_R {
OIS_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn ois2(&self) -> OIS_R {
OIS_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn ois3(&self) -> OIS_R {
OIS_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn ois4(&self) -> OIS_R {
OIS_R::new(((self.bits >> 14) & 1) != 0)
}
#[inline(always)]
pub fn ois5(&self) -> OIS_R {
OIS_R::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn ois6(&self) -> OIS_R {
OIS_R::new(((self.bits >> 18) & 1) != 0)
}
#[inline(always)]
pub fn oisn(&self, n: u8) -> OISN_R {
#[allow(clippy::no_effect)]
[(); 3][n as usize];
OISN_R::new(((self.bits >> (n * 2 + 9)) & 1) != 0)
}
#[inline(always)]
pub fn oisn_iter(&self) -> impl Iterator<Item = OISN_R> + '_ {
(0..3).map(move |n| OISN_R::new(((self.bits >> (n * 2 + 9)) & 1) != 0))
}
#[inline(always)]
pub fn ois1n(&self) -> OISN_R {
OISN_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn ois2n(&self) -> OISN_R {
OISN_R::new(((self.bits >> 11) & 1) != 0)
}
#[inline(always)]
pub fn ois3n(&self) -> OISN_R {
OISN_R::new(((self.bits >> 13) & 1) != 0)
}
#[inline(always)]
pub fn mms2(&self) -> MMS2_R {
MMS2_R::new(((self.bits >> 20) & 0x0f) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CR2")
.field("ccpc", &self.ccpc())
.field("ccus", &self.ccus())
.field("ccds", &self.ccds())
.field("mms", &self.mms())
.field("ti1s", &self.ti1s())
.field("ois1", &self.ois1())
.field("ois2", &self.ois2())
.field("ois3", &self.ois3())
.field("ois4", &self.ois4())
.field("ois5", &self.ois5())
.field("ois6", &self.ois6())
.field("ois1n", &self.ois1n())
.field("ois2n", &self.ois2n())
.field("ois3n", &self.ois3n())
.field("mms2", &self.mms2())
.finish()
}
}
impl W {
#[inline(always)]
pub fn ccpc(&mut self) -> CCPC_W<CR2rs> {
CCPC_W::new(self, 0)
}
#[inline(always)]
pub fn ccus(&mut self) -> CCUS_W<CR2rs> {
CCUS_W::new(self, 2)
}
#[inline(always)]
pub fn ccds(&mut self) -> CCDS_W<CR2rs> {
CCDS_W::new(self, 3)
}
#[inline(always)]
pub fn mms(&mut self) -> MMS_W<CR2rs> {
MMS_W::new(self, 4)
}
#[inline(always)]
pub fn ti1s(&mut self) -> TI1S_W<CR2rs> {
TI1S_W::new(self, 7)
}
#[inline(always)]
pub fn ois(&mut self, n: u8) -> OIS_W<CR2rs> {
#[allow(clippy::no_effect)]
[(); 6][n as usize];
OIS_W::new(self, n * 2 + 8)
}
#[inline(always)]
pub fn ois1(&mut self) -> OIS_W<CR2rs> {
OIS_W::new(self, 8)
}
#[inline(always)]
pub fn ois2(&mut self) -> OIS_W<CR2rs> {
OIS_W::new(self, 10)
}
#[inline(always)]
pub fn ois3(&mut self) -> OIS_W<CR2rs> {
OIS_W::new(self, 12)
}
#[inline(always)]
pub fn ois4(&mut self) -> OIS_W<CR2rs> {
OIS_W::new(self, 14)
}
#[inline(always)]
pub fn ois5(&mut self) -> OIS_W<CR2rs> {
OIS_W::new(self, 16)
}
#[inline(always)]
pub fn ois6(&mut self) -> OIS_W<CR2rs> {
OIS_W::new(self, 18)
}
#[inline(always)]
pub fn oisn(&mut self, n: u8) -> OISN_W<CR2rs> {
#[allow(clippy::no_effect)]
[(); 3][n as usize];
OISN_W::new(self, n * 2 + 9)
}
#[inline(always)]
pub fn ois1n(&mut self) -> OISN_W<CR2rs> {
OISN_W::new(self, 9)
}
#[inline(always)]
pub fn ois2n(&mut self) -> OISN_W<CR2rs> {
OISN_W::new(self, 11)
}
#[inline(always)]
pub fn ois3n(&mut self) -> OISN_W<CR2rs> {
OISN_W::new(self, 13)
}
#[inline(always)]
pub fn mms2(&mut self) -> MMS2_W<CR2rs> {
MMS2_W::new(self, 20)
}
}
pub struct CR2rs;
impl crate::RegisterSpec for CR2rs {
type Ux = u32;
}
impl crate::Readable for CR2rs {}
impl crate::Writable for CR2rs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CR2rs {}