pub type R = crate::R<DCDCCTRLrs>;
pub type W = crate::W<DCDCCTRLrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum DCDCMODE {
Bypass = 0,
Lownoise = 1,
Lowpower = 2,
Off = 3,
}
impl From<DCDCMODE> for u8 {
#[inline(always)]
fn from(variant: DCDCMODE) -> Self {
variant as _
}
}
impl crate::FieldSpec for DCDCMODE {
type Ux = u8;
}
impl crate::IsEnum for DCDCMODE {}
pub type DcdcmodeR = crate::FieldReader<DCDCMODE>;
impl DcdcmodeR {
#[inline(always)]
pub const fn variant(&self) -> DCDCMODE {
match self.bits {
0 => DCDCMODE::Bypass,
1 => DCDCMODE::Lownoise,
2 => DCDCMODE::Lowpower,
3 => DCDCMODE::Off,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_bypass(&self) -> bool {
*self == DCDCMODE::Bypass
}
#[inline(always)]
pub fn is_lownoise(&self) -> bool {
*self == DCDCMODE::Lownoise
}
#[inline(always)]
pub fn is_lowpower(&self) -> bool {
*self == DCDCMODE::Lowpower
}
#[inline(always)]
pub fn is_off(&self) -> bool {
*self == DCDCMODE::Off
}
}
pub type DcdcmodeW<'a, REG> = crate::FieldWriter<'a, REG, 2, DCDCMODE, crate::Safe>;
impl<'a, REG> DcdcmodeW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn bypass(self) -> &'a mut crate::W<REG> {
self.variant(DCDCMODE::Bypass)
}
#[inline(always)]
pub fn lownoise(self) -> &'a mut crate::W<REG> {
self.variant(DCDCMODE::Lownoise)
}
#[inline(always)]
pub fn lowpower(self) -> &'a mut crate::W<REG> {
self.variant(DCDCMODE::Lowpower)
}
#[inline(always)]
pub fn off(self) -> &'a mut crate::W<REG> {
self.variant(DCDCMODE::Off)
}
}
pub type Dcdcmodeem23R = crate::BitReader;
pub type Dcdcmodeem23W<'a, REG> = crate::BitWriter<'a, REG>;
pub type Dcdcmodeem4R = crate::BitReader;
pub type Dcdcmodeem4W<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[inline(always)]
pub fn dcdcmode(&self) -> DcdcmodeR {
DcdcmodeR::new((self.bits & 3) as u8)
}
#[inline(always)]
pub fn dcdcmodeem23(&self) -> Dcdcmodeem23R {
Dcdcmodeem23R::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn dcdcmodeem4(&self) -> Dcdcmodeem4R {
Dcdcmodeem4R::new(((self.bits >> 5) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("DCDCCTRL")
.field("dcdcmode", &self.dcdcmode())
.field("dcdcmodeem23", &self.dcdcmodeem23())
.field("dcdcmodeem4", &self.dcdcmodeem4())
.finish()
}
}
impl W {
#[inline(always)]
pub fn dcdcmode(&mut self) -> DcdcmodeW<'_, DCDCCTRLrs> {
DcdcmodeW::new(self, 0)
}
#[inline(always)]
pub fn dcdcmodeem23(&mut self) -> Dcdcmodeem23W<'_, DCDCCTRLrs> {
Dcdcmodeem23W::new(self, 4)
}
#[inline(always)]
pub fn dcdcmodeem4(&mut self) -> Dcdcmodeem4W<'_, DCDCCTRLrs> {
Dcdcmodeem4W::new(self, 5)
}
}
pub struct DCDCCTRLrs;
impl crate::RegisterSpec for DCDCCTRLrs {
type Ux = u32;
}
impl crate::Readable for DCDCCTRLrs {}
impl crate::Writable for DCDCCTRLrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for DCDCCTRLrs {
const RESET_VALUE: u32 = 0x30;
}