pub type R = crate::R<CALCTRLrs>;
pub type W = crate::W<CALCTRLrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum UPSEL {
Hfxo = 0,
Lfxo = 1,
Hfrco = 2,
Lfrco = 3,
Auxhfrco = 4,
Prs = 5,
}
impl From<UPSEL> for u8 {
#[inline(always)]
fn from(variant: UPSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for UPSEL {
type Ux = u8;
}
impl crate::IsEnum for UPSEL {}
pub type UpselR = crate::FieldReader<UPSEL>;
impl UpselR {
#[inline(always)]
pub const fn variant(&self) -> Option<UPSEL> {
match self.bits {
0 => Some(UPSEL::Hfxo),
1 => Some(UPSEL::Lfxo),
2 => Some(UPSEL::Hfrco),
3 => Some(UPSEL::Lfrco),
4 => Some(UPSEL::Auxhfrco),
5 => Some(UPSEL::Prs),
_ => None,
}
}
#[inline(always)]
pub fn is_hfxo(&self) -> bool {
*self == UPSEL::Hfxo
}
#[inline(always)]
pub fn is_lfxo(&self) -> bool {
*self == UPSEL::Lfxo
}
#[inline(always)]
pub fn is_hfrco(&self) -> bool {
*self == UPSEL::Hfrco
}
#[inline(always)]
pub fn is_lfrco(&self) -> bool {
*self == UPSEL::Lfrco
}
#[inline(always)]
pub fn is_auxhfrco(&self) -> bool {
*self == UPSEL::Auxhfrco
}
#[inline(always)]
pub fn is_prs(&self) -> bool {
*self == UPSEL::Prs
}
}
pub type UpselW<'a, REG> = crate::FieldWriter<'a, REG, 3, UPSEL>;
impl<'a, REG> UpselW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn hfxo(self) -> &'a mut crate::W<REG> {
self.variant(UPSEL::Hfxo)
}
#[inline(always)]
pub fn lfxo(self) -> &'a mut crate::W<REG> {
self.variant(UPSEL::Lfxo)
}
#[inline(always)]
pub fn hfrco(self) -> &'a mut crate::W<REG> {
self.variant(UPSEL::Hfrco)
}
#[inline(always)]
pub fn lfrco(self) -> &'a mut crate::W<REG> {
self.variant(UPSEL::Lfrco)
}
#[inline(always)]
pub fn auxhfrco(self) -> &'a mut crate::W<REG> {
self.variant(UPSEL::Auxhfrco)
}
#[inline(always)]
pub fn prs(self) -> &'a mut crate::W<REG> {
self.variant(UPSEL::Prs)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum DOWNSEL {
Hfclk = 0,
Hfxo = 1,
Lfxo = 2,
Hfrco = 3,
Lfrco = 4,
Auxhfrco = 5,
Prs = 6,
}
impl From<DOWNSEL> for u8 {
#[inline(always)]
fn from(variant: DOWNSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for DOWNSEL {
type Ux = u8;
}
impl crate::IsEnum for DOWNSEL {}
pub type DownselR = crate::FieldReader<DOWNSEL>;
impl DownselR {
#[inline(always)]
pub const fn variant(&self) -> Option<DOWNSEL> {
match self.bits {
0 => Some(DOWNSEL::Hfclk),
1 => Some(DOWNSEL::Hfxo),
2 => Some(DOWNSEL::Lfxo),
3 => Some(DOWNSEL::Hfrco),
4 => Some(DOWNSEL::Lfrco),
5 => Some(DOWNSEL::Auxhfrco),
6 => Some(DOWNSEL::Prs),
_ => None,
}
}
#[inline(always)]
pub fn is_hfclk(&self) -> bool {
*self == DOWNSEL::Hfclk
}
#[inline(always)]
pub fn is_hfxo(&self) -> bool {
*self == DOWNSEL::Hfxo
}
#[inline(always)]
pub fn is_lfxo(&self) -> bool {
*self == DOWNSEL::Lfxo
}
#[inline(always)]
pub fn is_hfrco(&self) -> bool {
*self == DOWNSEL::Hfrco
}
#[inline(always)]
pub fn is_lfrco(&self) -> bool {
*self == DOWNSEL::Lfrco
}
#[inline(always)]
pub fn is_auxhfrco(&self) -> bool {
*self == DOWNSEL::Auxhfrco
}
#[inline(always)]
pub fn is_prs(&self) -> bool {
*self == DOWNSEL::Prs
}
}
pub type DownselW<'a, REG> = crate::FieldWriter<'a, REG, 3, DOWNSEL>;
impl<'a, REG> DownselW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn hfclk(self) -> &'a mut crate::W<REG> {
self.variant(DOWNSEL::Hfclk)
}
#[inline(always)]
pub fn hfxo(self) -> &'a mut crate::W<REG> {
self.variant(DOWNSEL::Hfxo)
}
#[inline(always)]
pub fn lfxo(self) -> &'a mut crate::W<REG> {
self.variant(DOWNSEL::Lfxo)
}
#[inline(always)]
pub fn hfrco(self) -> &'a mut crate::W<REG> {
self.variant(DOWNSEL::Hfrco)
}
#[inline(always)]
pub fn lfrco(self) -> &'a mut crate::W<REG> {
self.variant(DOWNSEL::Lfrco)
}
#[inline(always)]
pub fn auxhfrco(self) -> &'a mut crate::W<REG> {
self.variant(DOWNSEL::Auxhfrco)
}
#[inline(always)]
pub fn prs(self) -> &'a mut crate::W<REG> {
self.variant(DOWNSEL::Prs)
}
}
pub type ContR = crate::BitReader;
pub type ContW<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PRSUPSEL {
Prsch0 = 0,
Prsch1 = 1,
Prsch2 = 2,
Prsch3 = 3,
Prsch4 = 4,
Prsch5 = 5,
Prsch6 = 6,
Prsch7 = 7,
Prsch8 = 8,
Prsch9 = 9,
Prsch10 = 10,
Prsch11 = 11,
}
impl From<PRSUPSEL> for u8 {
#[inline(always)]
fn from(variant: PRSUPSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for PRSUPSEL {
type Ux = u8;
}
impl crate::IsEnum for PRSUPSEL {}
pub type PrsupselR = crate::FieldReader<PRSUPSEL>;
impl PrsupselR {
#[inline(always)]
pub const fn variant(&self) -> Option<PRSUPSEL> {
match self.bits {
0 => Some(PRSUPSEL::Prsch0),
1 => Some(PRSUPSEL::Prsch1),
2 => Some(PRSUPSEL::Prsch2),
3 => Some(PRSUPSEL::Prsch3),
4 => Some(PRSUPSEL::Prsch4),
5 => Some(PRSUPSEL::Prsch5),
6 => Some(PRSUPSEL::Prsch6),
7 => Some(PRSUPSEL::Prsch7),
8 => Some(PRSUPSEL::Prsch8),
9 => Some(PRSUPSEL::Prsch9),
10 => Some(PRSUPSEL::Prsch10),
11 => Some(PRSUPSEL::Prsch11),
_ => None,
}
}
#[inline(always)]
pub fn is_prsch0(&self) -> bool {
*self == PRSUPSEL::Prsch0
}
#[inline(always)]
pub fn is_prsch1(&self) -> bool {
*self == PRSUPSEL::Prsch1
}
#[inline(always)]
pub fn is_prsch2(&self) -> bool {
*self == PRSUPSEL::Prsch2
}
#[inline(always)]
pub fn is_prsch3(&self) -> bool {
*self == PRSUPSEL::Prsch3
}
#[inline(always)]
pub fn is_prsch4(&self) -> bool {
*self == PRSUPSEL::Prsch4
}
#[inline(always)]
pub fn is_prsch5(&self) -> bool {
*self == PRSUPSEL::Prsch5
}
#[inline(always)]
pub fn is_prsch6(&self) -> bool {
*self == PRSUPSEL::Prsch6
}
#[inline(always)]
pub fn is_prsch7(&self) -> bool {
*self == PRSUPSEL::Prsch7
}
#[inline(always)]
pub fn is_prsch8(&self) -> bool {
*self == PRSUPSEL::Prsch8
}
#[inline(always)]
pub fn is_prsch9(&self) -> bool {
*self == PRSUPSEL::Prsch9
}
#[inline(always)]
pub fn is_prsch10(&self) -> bool {
*self == PRSUPSEL::Prsch10
}
#[inline(always)]
pub fn is_prsch11(&self) -> bool {
*self == PRSUPSEL::Prsch11
}
}
pub type PrsupselW<'a, REG> = crate::FieldWriter<'a, REG, 4, PRSUPSEL>;
impl<'a, REG> PrsupselW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn prsch0(self) -> &'a mut crate::W<REG> {
self.variant(PRSUPSEL::Prsch0)
}
#[inline(always)]
pub fn prsch1(self) -> &'a mut crate::W<REG> {
self.variant(PRSUPSEL::Prsch1)
}
#[inline(always)]
pub fn prsch2(self) -> &'a mut crate::W<REG> {
self.variant(PRSUPSEL::Prsch2)
}
#[inline(always)]
pub fn prsch3(self) -> &'a mut crate::W<REG> {
self.variant(PRSUPSEL::Prsch3)
}
#[inline(always)]
pub fn prsch4(self) -> &'a mut crate::W<REG> {
self.variant(PRSUPSEL::Prsch4)
}
#[inline(always)]
pub fn prsch5(self) -> &'a mut crate::W<REG> {
self.variant(PRSUPSEL::Prsch5)
}
#[inline(always)]
pub fn prsch6(self) -> &'a mut crate::W<REG> {
self.variant(PRSUPSEL::Prsch6)
}
#[inline(always)]
pub fn prsch7(self) -> &'a mut crate::W<REG> {
self.variant(PRSUPSEL::Prsch7)
}
#[inline(always)]
pub fn prsch8(self) -> &'a mut crate::W<REG> {
self.variant(PRSUPSEL::Prsch8)
}
#[inline(always)]
pub fn prsch9(self) -> &'a mut crate::W<REG> {
self.variant(PRSUPSEL::Prsch9)
}
#[inline(always)]
pub fn prsch10(self) -> &'a mut crate::W<REG> {
self.variant(PRSUPSEL::Prsch10)
}
#[inline(always)]
pub fn prsch11(self) -> &'a mut crate::W<REG> {
self.variant(PRSUPSEL::Prsch11)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PRSDOWNSEL {
Prsch0 = 0,
Prsch1 = 1,
Prsch2 = 2,
Prsch3 = 3,
Prsch4 = 4,
Prsch5 = 5,
Prsch6 = 6,
Prsch7 = 7,
Prsch8 = 8,
Prsch9 = 9,
Prsch10 = 10,
Prsch11 = 11,
}
impl From<PRSDOWNSEL> for u8 {
#[inline(always)]
fn from(variant: PRSDOWNSEL) -> Self {
variant as _
}
}
impl crate::FieldSpec for PRSDOWNSEL {
type Ux = u8;
}
impl crate::IsEnum for PRSDOWNSEL {}
pub type PrsdownselR = crate::FieldReader<PRSDOWNSEL>;
impl PrsdownselR {
#[inline(always)]
pub const fn variant(&self) -> Option<PRSDOWNSEL> {
match self.bits {
0 => Some(PRSDOWNSEL::Prsch0),
1 => Some(PRSDOWNSEL::Prsch1),
2 => Some(PRSDOWNSEL::Prsch2),
3 => Some(PRSDOWNSEL::Prsch3),
4 => Some(PRSDOWNSEL::Prsch4),
5 => Some(PRSDOWNSEL::Prsch5),
6 => Some(PRSDOWNSEL::Prsch6),
7 => Some(PRSDOWNSEL::Prsch7),
8 => Some(PRSDOWNSEL::Prsch8),
9 => Some(PRSDOWNSEL::Prsch9),
10 => Some(PRSDOWNSEL::Prsch10),
11 => Some(PRSDOWNSEL::Prsch11),
_ => None,
}
}
#[inline(always)]
pub fn is_prsch0(&self) -> bool {
*self == PRSDOWNSEL::Prsch0
}
#[inline(always)]
pub fn is_prsch1(&self) -> bool {
*self == PRSDOWNSEL::Prsch1
}
#[inline(always)]
pub fn is_prsch2(&self) -> bool {
*self == PRSDOWNSEL::Prsch2
}
#[inline(always)]
pub fn is_prsch3(&self) -> bool {
*self == PRSDOWNSEL::Prsch3
}
#[inline(always)]
pub fn is_prsch4(&self) -> bool {
*self == PRSDOWNSEL::Prsch4
}
#[inline(always)]
pub fn is_prsch5(&self) -> bool {
*self == PRSDOWNSEL::Prsch5
}
#[inline(always)]
pub fn is_prsch6(&self) -> bool {
*self == PRSDOWNSEL::Prsch6
}
#[inline(always)]
pub fn is_prsch7(&self) -> bool {
*self == PRSDOWNSEL::Prsch7
}
#[inline(always)]
pub fn is_prsch8(&self) -> bool {
*self == PRSDOWNSEL::Prsch8
}
#[inline(always)]
pub fn is_prsch9(&self) -> bool {
*self == PRSDOWNSEL::Prsch9
}
#[inline(always)]
pub fn is_prsch10(&self) -> bool {
*self == PRSDOWNSEL::Prsch10
}
#[inline(always)]
pub fn is_prsch11(&self) -> bool {
*self == PRSDOWNSEL::Prsch11
}
}
pub type PrsdownselW<'a, REG> = crate::FieldWriter<'a, REG, 4, PRSDOWNSEL>;
impl<'a, REG> PrsdownselW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn prsch0(self) -> &'a mut crate::W<REG> {
self.variant(PRSDOWNSEL::Prsch0)
}
#[inline(always)]
pub fn prsch1(self) -> &'a mut crate::W<REG> {
self.variant(PRSDOWNSEL::Prsch1)
}
#[inline(always)]
pub fn prsch2(self) -> &'a mut crate::W<REG> {
self.variant(PRSDOWNSEL::Prsch2)
}
#[inline(always)]
pub fn prsch3(self) -> &'a mut crate::W<REG> {
self.variant(PRSDOWNSEL::Prsch3)
}
#[inline(always)]
pub fn prsch4(self) -> &'a mut crate::W<REG> {
self.variant(PRSDOWNSEL::Prsch4)
}
#[inline(always)]
pub fn prsch5(self) -> &'a mut crate::W<REG> {
self.variant(PRSDOWNSEL::Prsch5)
}
#[inline(always)]
pub fn prsch6(self) -> &'a mut crate::W<REG> {
self.variant(PRSDOWNSEL::Prsch6)
}
#[inline(always)]
pub fn prsch7(self) -> &'a mut crate::W<REG> {
self.variant(PRSDOWNSEL::Prsch7)
}
#[inline(always)]
pub fn prsch8(self) -> &'a mut crate::W<REG> {
self.variant(PRSDOWNSEL::Prsch8)
}
#[inline(always)]
pub fn prsch9(self) -> &'a mut crate::W<REG> {
self.variant(PRSDOWNSEL::Prsch9)
}
#[inline(always)]
pub fn prsch10(self) -> &'a mut crate::W<REG> {
self.variant(PRSDOWNSEL::Prsch10)
}
#[inline(always)]
pub fn prsch11(self) -> &'a mut crate::W<REG> {
self.variant(PRSDOWNSEL::Prsch11)
}
}
impl R {
#[inline(always)]
pub fn upsel(&self) -> UpselR {
UpselR::new((self.bits & 7) as u8)
}
#[inline(always)]
pub fn downsel(&self) -> DownselR {
DownselR::new(((self.bits >> 4) & 7) as u8)
}
#[inline(always)]
pub fn cont(&self) -> ContR {
ContR::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn prsupsel(&self) -> PrsupselR {
PrsupselR::new(((self.bits >> 16) & 0x0f) as u8)
}
#[inline(always)]
pub fn prsdownsel(&self) -> PrsdownselR {
PrsdownselR::new(((self.bits >> 24) & 0x0f) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("CALCTRL")
.field("upsel", &self.upsel())
.field("downsel", &self.downsel())
.field("cont", &self.cont())
.field("prsupsel", &self.prsupsel())
.field("prsdownsel", &self.prsdownsel())
.finish()
}
}
impl W {
#[inline(always)]
pub fn upsel(&mut self) -> UpselW<'_, CALCTRLrs> {
UpselW::new(self, 0)
}
#[inline(always)]
pub fn downsel(&mut self) -> DownselW<'_, CALCTRLrs> {
DownselW::new(self, 4)
}
#[inline(always)]
pub fn cont(&mut self) -> ContW<'_, CALCTRLrs> {
ContW::new(self, 8)
}
#[inline(always)]
pub fn prsupsel(&mut self) -> PrsupselW<'_, CALCTRLrs> {
PrsupselW::new(self, 16)
}
#[inline(always)]
pub fn prsdownsel(&mut self) -> PrsdownselW<'_, CALCTRLrs> {
PrsdownselW::new(self, 24)
}
}
pub struct CALCTRLrs;
impl crate::RegisterSpec for CALCTRLrs {
type Ux = u32;
}
impl crate::Readable for CALCTRLrs {}
impl crate::Writable for CALCTRLrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for CALCTRLrs {}