pub type R = crate::R<CCRrs>;
pub type W = crate::W<CCRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum DUAL {
Independent = 0,
DualRj = 1,
DualRa = 2,
DualIj = 3,
DualJ = 5,
DualR = 6,
DualI = 7,
DualA = 9,
}
impl From<DUAL> for u8 {
#[inline(always)]
fn from(variant: DUAL) -> Self {
variant as _
}
}
impl crate::FieldSpec for DUAL {
type Ux = u8;
}
impl crate::IsEnum for DUAL {}
pub type DUAL_R = crate::FieldReader<DUAL>;
impl DUAL_R {
#[inline(always)]
pub const fn variant(&self) -> Option<DUAL> {
match self.bits {
0 => Some(DUAL::Independent),
1 => Some(DUAL::DualRj),
2 => Some(DUAL::DualRa),
3 => Some(DUAL::DualIj),
5 => Some(DUAL::DualJ),
6 => Some(DUAL::DualR),
7 => Some(DUAL::DualI),
9 => Some(DUAL::DualA),
_ => None,
}
}
#[inline(always)]
pub fn is_independent(&self) -> bool {
*self == DUAL::Independent
}
#[inline(always)]
pub fn is_dual_rj(&self) -> bool {
*self == DUAL::DualRj
}
#[inline(always)]
pub fn is_dual_ra(&self) -> bool {
*self == DUAL::DualRa
}
#[inline(always)]
pub fn is_dual_ij(&self) -> bool {
*self == DUAL::DualIj
}
#[inline(always)]
pub fn is_dual_j(&self) -> bool {
*self == DUAL::DualJ
}
#[inline(always)]
pub fn is_dual_r(&self) -> bool {
*self == DUAL::DualR
}
#[inline(always)]
pub fn is_dual_i(&self) -> bool {
*self == DUAL::DualI
}
#[inline(always)]
pub fn is_dual_a(&self) -> bool {
*self == DUAL::DualA
}
}
pub type DUAL_W<'a, REG> = crate::FieldWriter<'a, REG, 5, DUAL>;
impl<'a, REG> DUAL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn independent(self) -> &'a mut crate::W<REG> {
self.variant(DUAL::Independent)
}
#[inline(always)]
pub fn dual_rj(self) -> &'a mut crate::W<REG> {
self.variant(DUAL::DualRj)
}
#[inline(always)]
pub fn dual_ra(self) -> &'a mut crate::W<REG> {
self.variant(DUAL::DualRa)
}
#[inline(always)]
pub fn dual_ij(self) -> &'a mut crate::W<REG> {
self.variant(DUAL::DualIj)
}
#[inline(always)]
pub fn dual_j(self) -> &'a mut crate::W<REG> {
self.variant(DUAL::DualJ)
}
#[inline(always)]
pub fn dual_r(self) -> &'a mut crate::W<REG> {
self.variant(DUAL::DualR)
}
#[inline(always)]
pub fn dual_i(self) -> &'a mut crate::W<REG> {
self.variant(DUAL::DualI)
}
#[inline(always)]
pub fn dual_a(self) -> &'a mut crate::W<REG> {
self.variant(DUAL::DualA)
}
}
pub type DELAY_R = crate::FieldReader;
pub type DELAY_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum DAMDF {
NoPack = 0,
Format32to10 = 2,
Format8 = 3,
}
impl From<DAMDF> for u8 {
#[inline(always)]
fn from(variant: DAMDF) -> Self {
variant as _
}
}
impl crate::FieldSpec for DAMDF {
type Ux = u8;
}
impl crate::IsEnum for DAMDF {}
pub type DAMDF_R = crate::FieldReader<DAMDF>;
impl DAMDF_R {
#[inline(always)]
pub const fn variant(&self) -> Option<DAMDF> {
match self.bits {
0 => Some(DAMDF::NoPack),
2 => Some(DAMDF::Format32to10),
3 => Some(DAMDF::Format8),
_ => None,
}
}
#[inline(always)]
pub fn is_no_pack(&self) -> bool {
*self == DAMDF::NoPack
}
#[inline(always)]
pub fn is_format32to10(&self) -> bool {
*self == DAMDF::Format32to10
}
#[inline(always)]
pub fn is_format8(&self) -> bool {
*self == DAMDF::Format8
}
}
pub type DAMDF_W<'a, REG> = crate::FieldWriter<'a, REG, 2, DAMDF>;
impl<'a, REG> DAMDF_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn no_pack(self) -> &'a mut crate::W<REG> {
self.variant(DAMDF::NoPack)
}
#[inline(always)]
pub fn format32to10(self) -> &'a mut crate::W<REG> {
self.variant(DAMDF::Format32to10)
}
#[inline(always)]
pub fn format8(self) -> &'a mut crate::W<REG> {
self.variant(DAMDF::Format8)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum CKMODE {
Asynchronous = 0,
SyncDiv1 = 1,
SyncDiv2 = 2,
SyncDiv4 = 3,
}
impl From<CKMODE> for u8 {
#[inline(always)]
fn from(variant: CKMODE) -> Self {
variant as _
}
}
impl crate::FieldSpec for CKMODE {
type Ux = u8;
}
impl crate::IsEnum for CKMODE {}
pub type CKMODE_R = crate::FieldReader<CKMODE>;
impl CKMODE_R {
#[inline(always)]
pub const fn variant(&self) -> CKMODE {
match self.bits {
0 => CKMODE::Asynchronous,
1 => CKMODE::SyncDiv1,
2 => CKMODE::SyncDiv2,
3 => CKMODE::SyncDiv4,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_asynchronous(&self) -> bool {
*self == CKMODE::Asynchronous
}
#[inline(always)]
pub fn is_sync_div1(&self) -> bool {
*self == CKMODE::SyncDiv1
}
#[inline(always)]
pub fn is_sync_div2(&self) -> bool {
*self == CKMODE::SyncDiv2
}
#[inline(always)]
pub fn is_sync_div4(&self) -> bool {
*self == CKMODE::SyncDiv4
}
}
pub type CKMODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CKMODE, crate::Safe>;
impl<'a, REG> CKMODE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn asynchronous(self) -> &'a mut crate::W<REG> {
self.variant(CKMODE::Asynchronous)
}
#[inline(always)]
pub fn sync_div1(self) -> &'a mut crate::W<REG> {
self.variant(CKMODE::SyncDiv1)
}
#[inline(always)]
pub fn sync_div2(self) -> &'a mut crate::W<REG> {
self.variant(CKMODE::SyncDiv2)
}
#[inline(always)]
pub fn sync_div4(self) -> &'a mut crate::W<REG> {
self.variant(CKMODE::SyncDiv4)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PRESC {
Div1 = 0,
Div2 = 1,
Div4 = 2,
Div6 = 3,
Div8 = 4,
Div10 = 5,
Div12 = 6,
Div16 = 7,
Div32 = 8,
Div64 = 9,
Div128 = 10,
Div256 = 11,
}
impl From<PRESC> for u8 {
#[inline(always)]
fn from(variant: PRESC) -> Self {
variant as _
}
}
impl crate::FieldSpec for PRESC {
type Ux = u8;
}
impl crate::IsEnum for PRESC {}
pub type PRESC_R = crate::FieldReader<PRESC>;
impl PRESC_R {
#[inline(always)]
pub const fn variant(&self) -> Option<PRESC> {
match self.bits {
0 => Some(PRESC::Div1),
1 => Some(PRESC::Div2),
2 => Some(PRESC::Div4),
3 => Some(PRESC::Div6),
4 => Some(PRESC::Div8),
5 => Some(PRESC::Div10),
6 => Some(PRESC::Div12),
7 => Some(PRESC::Div16),
8 => Some(PRESC::Div32),
9 => Some(PRESC::Div64),
10 => Some(PRESC::Div128),
11 => Some(PRESC::Div256),
_ => None,
}
}
#[inline(always)]
pub fn is_div1(&self) -> bool {
*self == PRESC::Div1
}
#[inline(always)]
pub fn is_div2(&self) -> bool {
*self == PRESC::Div2
}
#[inline(always)]
pub fn is_div4(&self) -> bool {
*self == PRESC::Div4
}
#[inline(always)]
pub fn is_div6(&self) -> bool {
*self == PRESC::Div6
}
#[inline(always)]
pub fn is_div8(&self) -> bool {
*self == PRESC::Div8
}
#[inline(always)]
pub fn is_div10(&self) -> bool {
*self == PRESC::Div10
}
#[inline(always)]
pub fn is_div12(&self) -> bool {
*self == PRESC::Div12
}
#[inline(always)]
pub fn is_div16(&self) -> bool {
*self == PRESC::Div16
}
#[inline(always)]
pub fn is_div32(&self) -> bool {
*self == PRESC::Div32
}
#[inline(always)]
pub fn is_div64(&self) -> bool {
*self == PRESC::Div64
}
#[inline(always)]
pub fn is_div128(&self) -> bool {
*self == PRESC::Div128
}
#[inline(always)]
pub fn is_div256(&self) -> bool {
*self == PRESC::Div256
}
}
pub type PRESC_W<'a, REG> = crate::FieldWriter<'a, REG, 4, PRESC>;
impl<'a, REG> PRESC_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn div1(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div1)
}
#[inline(always)]
pub fn div2(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div2)
}
#[inline(always)]
pub fn div4(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div4)
}
#[inline(always)]
pub fn div6(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div6)
}
#[inline(always)]
pub fn div8(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div8)
}
#[inline(always)]
pub fn div10(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div10)
}
#[inline(always)]
pub fn div12(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div12)
}
#[inline(always)]
pub fn div16(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div16)
}
#[inline(always)]
pub fn div32(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div32)
}
#[inline(always)]
pub fn div64(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div64)
}
#[inline(always)]
pub fn div128(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div128)
}
#[inline(always)]
pub fn div256(self) -> &'a mut crate::W<REG> {
self.variant(PRESC::Div256)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum VREFEN {
Disabled = 0,
Enabled = 1,
}
impl From<VREFEN> for bool {
#[inline(always)]
fn from(variant: VREFEN) -> Self {
variant as u8 != 0
}
}
pub type VREFEN_R = crate::BitReader<VREFEN>;
impl VREFEN_R {
#[inline(always)]
pub const fn variant(&self) -> VREFEN {
match self.bits {
false => VREFEN::Disabled,
true => VREFEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == VREFEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == VREFEN::Enabled
}
}
pub type VREFEN_W<'a, REG> = crate::BitWriter<'a, REG, VREFEN>;
impl<'a, REG> VREFEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(VREFEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(VREFEN::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum VSENSEEN {
Disabled = 0,
Enabled = 1,
}
impl From<VSENSEEN> for bool {
#[inline(always)]
fn from(variant: VSENSEEN) -> Self {
variant as u8 != 0
}
}
pub type VSENSEEN_R = crate::BitReader<VSENSEEN>;
impl VSENSEEN_R {
#[inline(always)]
pub const fn variant(&self) -> VSENSEEN {
match self.bits {
false => VSENSEEN::Disabled,
true => VSENSEEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == VSENSEEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == VSENSEEN::Enabled
}
}
pub type VSENSEEN_W<'a, REG> = crate::BitWriter<'a, REG, VSENSEEN>;
impl<'a, REG> VSENSEEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(VSENSEEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(VSENSEEN::Enabled)
}
}
pub use VSENSEEN_R as VBATEN_R;
pub use VSENSEEN_W as VBATEN_W;
impl R {
#[inline(always)]
pub fn dual(&self) -> DUAL_R {
DUAL_R::new((self.bits & 0x1f) as u8)
}
#[inline(always)]
pub fn delay(&self) -> DELAY_R {
DELAY_R::new(((self.bits >> 8) & 0x0f) as u8)
}
#[inline(always)]
pub fn damdf(&self) -> DAMDF_R {
DAMDF_R::new(((self.bits >> 14) & 3) as u8)
}
#[inline(always)]
pub fn ckmode(&self) -> CKMODE_R {
CKMODE_R::new(((self.bits >> 16) & 3) as u8)
}
#[inline(always)]
pub fn presc(&self) -> PRESC_R {
PRESC_R::new(((self.bits >> 18) & 0x0f) as u8)
}
#[inline(always)]
pub fn vrefen(&self) -> VREFEN_R {
VREFEN_R::new(((self.bits >> 22) & 1) != 0)
}
#[inline(always)]
pub fn vsenseen(&self) -> VSENSEEN_R {
VSENSEEN_R::new(((self.bits >> 23) & 1) != 0)
}
#[inline(always)]
pub fn vbaten(&self) -> VBATEN_R {
VBATEN_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("CCR")
.field("dual", &self.dual())
.field("delay", &self.delay())
.field("damdf", &self.damdf())
.field("ckmode", &self.ckmode())
.field("presc", &self.presc())
.field("vrefen", &self.vrefen())
.field("vsenseen", &self.vsenseen())
.field("vbaten", &self.vbaten())
.finish()
}
}
impl W {
#[inline(always)]
pub fn dual(&mut self) -> DUAL_W<CCRrs> {
DUAL_W::new(self, 0)
}
#[inline(always)]
pub fn delay(&mut self) -> DELAY_W<CCRrs> {
DELAY_W::new(self, 8)
}
#[inline(always)]
pub fn damdf(&mut self) -> DAMDF_W<CCRrs> {
DAMDF_W::new(self, 14)
}
#[inline(always)]
pub fn ckmode(&mut self) -> CKMODE_W<CCRrs> {
CKMODE_W::new(self, 16)
}
#[inline(always)]
pub fn presc(&mut self) -> PRESC_W<CCRrs> {
PRESC_W::new(self, 18)
}
#[inline(always)]
pub fn vrefen(&mut self) -> VREFEN_W<CCRrs> {
VREFEN_W::new(self, 22)
}
#[inline(always)]
pub fn vsenseen(&mut self) -> VSENSEEN_W<CCRrs> {
VSENSEEN_W::new(self, 23)
}
#[inline(always)]
pub fn vbaten(&mut self) -> VBATEN_W<CCRrs> {
VBATEN_W::new(self, 24)
}
}
pub struct CCRrs;
impl crate::RegisterSpec for CCRrs {
type Ux = u32;
}
impl crate::Readable for CCRrs {}
impl crate::Writable for CCRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CCRrs {}