pub type R = crate::R<HFXOCTRLrs>;
pub type W = crate::W<HFXOCTRLrs>;
pub type ModeR = crate::BitReader;
pub type ModeW<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum PEAKDETSHUNTOPTMODE {
Autocmd = 0,
Cmd = 1,
Manual = 2,
}
impl From<PEAKDETSHUNTOPTMODE> for u8 {
#[inline(always)]
fn from(variant: PEAKDETSHUNTOPTMODE) -> Self {
variant as _
}
}
impl crate::FieldSpec for PEAKDETSHUNTOPTMODE {
type Ux = u8;
}
impl crate::IsEnum for PEAKDETSHUNTOPTMODE {}
pub type PeakdetshuntoptmodeR = crate::FieldReader<PEAKDETSHUNTOPTMODE>;
impl PeakdetshuntoptmodeR {
#[inline(always)]
pub const fn variant(&self) -> Option<PEAKDETSHUNTOPTMODE> {
match self.bits {
0 => Some(PEAKDETSHUNTOPTMODE::Autocmd),
1 => Some(PEAKDETSHUNTOPTMODE::Cmd),
2 => Some(PEAKDETSHUNTOPTMODE::Manual),
_ => None,
}
}
#[inline(always)]
pub fn is_autocmd(&self) -> bool {
*self == PEAKDETSHUNTOPTMODE::Autocmd
}
#[inline(always)]
pub fn is_cmd(&self) -> bool {
*self == PEAKDETSHUNTOPTMODE::Cmd
}
#[inline(always)]
pub fn is_manual(&self) -> bool {
*self == PEAKDETSHUNTOPTMODE::Manual
}
}
pub type PeakdetshuntoptmodeW<'a, REG> = crate::FieldWriter<'a, REG, 2, PEAKDETSHUNTOPTMODE>;
impl<'a, REG> PeakdetshuntoptmodeW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn autocmd(self) -> &'a mut crate::W<REG> {
self.variant(PEAKDETSHUNTOPTMODE::Autocmd)
}
#[inline(always)]
pub fn cmd(self) -> &'a mut crate::W<REG> {
self.variant(PEAKDETSHUNTOPTMODE::Cmd)
}
#[inline(always)]
pub fn manual(self) -> &'a mut crate::W<REG> {
self.variant(PEAKDETSHUNTOPTMODE::Manual)
}
}
pub type LowpowerR = crate::BitReader;
pub type LowpowerW<'a, REG> = crate::BitWriter<'a, REG>;
pub type Xti2gndR = crate::BitReader;
pub type Xti2gndW<'a, REG> = crate::BitWriter<'a, REG>;
pub type Xto2gndR = crate::BitReader;
pub type Xto2gndW<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum LFTIMEOUT {
_0cycles = 0,
_2cycles = 1,
_4cycles = 2,
_16cycles = 3,
_32cycles = 4,
_64cycles = 5,
_1kcycles = 6,
_4kcycles = 7,
}
impl From<LFTIMEOUT> for u8 {
#[inline(always)]
fn from(variant: LFTIMEOUT) -> Self {
variant as _
}
}
impl crate::FieldSpec for LFTIMEOUT {
type Ux = u8;
}
impl crate::IsEnum for LFTIMEOUT {}
pub type LftimeoutR = crate::FieldReader<LFTIMEOUT>;
impl LftimeoutR {
#[inline(always)]
pub const fn variant(&self) -> LFTIMEOUT {
match self.bits {
0 => LFTIMEOUT::_0cycles,
1 => LFTIMEOUT::_2cycles,
2 => LFTIMEOUT::_4cycles,
3 => LFTIMEOUT::_16cycles,
4 => LFTIMEOUT::_32cycles,
5 => LFTIMEOUT::_64cycles,
6 => LFTIMEOUT::_1kcycles,
7 => LFTIMEOUT::_4kcycles,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_0cycles(&self) -> bool {
*self == LFTIMEOUT::_0cycles
}
#[inline(always)]
pub fn is_2cycles(&self) -> bool {
*self == LFTIMEOUT::_2cycles
}
#[inline(always)]
pub fn is_4cycles(&self) -> bool {
*self == LFTIMEOUT::_4cycles
}
#[inline(always)]
pub fn is_16cycles(&self) -> bool {
*self == LFTIMEOUT::_16cycles
}
#[inline(always)]
pub fn is_32cycles(&self) -> bool {
*self == LFTIMEOUT::_32cycles
}
#[inline(always)]
pub fn is_64cycles(&self) -> bool {
*self == LFTIMEOUT::_64cycles
}
#[inline(always)]
pub fn is_1kcycles(&self) -> bool {
*self == LFTIMEOUT::_1kcycles
}
#[inline(always)]
pub fn is_4kcycles(&self) -> bool {
*self == LFTIMEOUT::_4kcycles
}
}
pub type LftimeoutW<'a, REG> = crate::FieldWriter<'a, REG, 3, LFTIMEOUT, crate::Safe>;
impl<'a, REG> LftimeoutW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn _0cycles(self) -> &'a mut crate::W<REG> {
self.variant(LFTIMEOUT::_0cycles)
}
#[inline(always)]
pub fn _2cycles(self) -> &'a mut crate::W<REG> {
self.variant(LFTIMEOUT::_2cycles)
}
#[inline(always)]
pub fn _4cycles(self) -> &'a mut crate::W<REG> {
self.variant(LFTIMEOUT::_4cycles)
}
#[inline(always)]
pub fn _16cycles(self) -> &'a mut crate::W<REG> {
self.variant(LFTIMEOUT::_16cycles)
}
#[inline(always)]
pub fn _32cycles(self) -> &'a mut crate::W<REG> {
self.variant(LFTIMEOUT::_32cycles)
}
#[inline(always)]
pub fn _64cycles(self) -> &'a mut crate::W<REG> {
self.variant(LFTIMEOUT::_64cycles)
}
#[inline(always)]
pub fn _1kcycles(self) -> &'a mut crate::W<REG> {
self.variant(LFTIMEOUT::_1kcycles)
}
#[inline(always)]
pub fn _4kcycles(self) -> &'a mut crate::W<REG> {
self.variant(LFTIMEOUT::_4kcycles)
}
}
pub type Autostartem0em1R = crate::BitReader;
pub type Autostartem0em1W<'a, REG> = crate::BitWriter<'a, REG>;
pub type Autostartselem0em1R = crate::BitReader;
pub type Autostartselem0em1W<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[inline(always)]
pub fn mode(&self) -> ModeR {
ModeR::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn peakdetshuntoptmode(&self) -> PeakdetshuntoptmodeR {
PeakdetshuntoptmodeR::new(((self.bits >> 4) & 3) as u8)
}
#[inline(always)]
pub fn lowpower(&self) -> LowpowerR {
LowpowerR::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn xti2gnd(&self) -> Xti2gndR {
Xti2gndR::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn xto2gnd(&self) -> Xto2gndR {
Xto2gndR::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn lftimeout(&self) -> LftimeoutR {
LftimeoutR::new(((self.bits >> 24) & 7) as u8)
}
#[inline(always)]
pub fn autostartem0em1(&self) -> Autostartem0em1R {
Autostartem0em1R::new(((self.bits >> 28) & 1) != 0)
}
#[inline(always)]
pub fn autostartselem0em1(&self) -> Autostartselem0em1R {
Autostartselem0em1R::new(((self.bits >> 29) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("HFXOCTRL")
.field("mode", &self.mode())
.field("peakdetshuntoptmode", &self.peakdetshuntoptmode())
.field("lowpower", &self.lowpower())
.field("xti2gnd", &self.xti2gnd())
.field("xto2gnd", &self.xto2gnd())
.field("lftimeout", &self.lftimeout())
.field("autostartem0em1", &self.autostartem0em1())
.field("autostartselem0em1", &self.autostartselem0em1())
.finish()
}
}
impl W {
#[inline(always)]
pub fn mode(&mut self) -> ModeW<'_, HFXOCTRLrs> {
ModeW::new(self, 0)
}
#[inline(always)]
pub fn peakdetshuntoptmode(&mut self) -> PeakdetshuntoptmodeW<'_, HFXOCTRLrs> {
PeakdetshuntoptmodeW::new(self, 4)
}
#[inline(always)]
pub fn lowpower(&mut self) -> LowpowerW<'_, HFXOCTRLrs> {
LowpowerW::new(self, 8)
}
#[inline(always)]
pub fn xti2gnd(&mut self) -> Xti2gndW<'_, HFXOCTRLrs> {
Xti2gndW::new(self, 9)
}
#[inline(always)]
pub fn xto2gnd(&mut self) -> Xto2gndW<'_, HFXOCTRLrs> {
Xto2gndW::new(self, 10)
}
#[inline(always)]
pub fn lftimeout(&mut self) -> LftimeoutW<'_, HFXOCTRLrs> {
LftimeoutW::new(self, 24)
}
#[inline(always)]
pub fn autostartem0em1(&mut self) -> Autostartem0em1W<'_, HFXOCTRLrs> {
Autostartem0em1W::new(self, 28)
}
#[inline(always)]
pub fn autostartselem0em1(&mut self) -> Autostartselem0em1W<'_, HFXOCTRLrs> {
Autostartselem0em1W::new(self, 29)
}
}
pub struct HFXOCTRLrs;
impl crate::RegisterSpec for HFXOCTRLrs {
type Ux = u32;
}
impl crate::Readable for HFXOCTRLrs {}
impl crate::Writable for HFXOCTRLrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for HFXOCTRLrs {}