pub type R = crate::R<EM4CTRLrs>;
pub type W = crate::W<EM4CTRLrs>;
pub type Em4stateR = crate::BitReader;
pub type Em4stateW<'a, REG> = crate::BitWriter<'a, REG>;
pub type RetainlfrcoR = crate::BitReader;
pub type RetainlfrcoW<'a, REG> = crate::BitWriter<'a, REG>;
pub type RetainlfxoR = crate::BitReader;
pub type RetainlfxoW<'a, REG> = crate::BitWriter<'a, REG>;
pub type RetainulfrcoR = crate::BitReader;
pub type RetainulfrcoW<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum EM4IORETMODE {
Disable = 0,
Em4exit = 1,
Swunlatch = 2,
}
impl From<EM4IORETMODE> for u8 {
#[inline(always)]
fn from(variant: EM4IORETMODE) -> Self {
variant as _
}
}
impl crate::FieldSpec for EM4IORETMODE {
type Ux = u8;
}
impl crate::IsEnum for EM4IORETMODE {}
pub type Em4ioretmodeR = crate::FieldReader<EM4IORETMODE>;
impl Em4ioretmodeR {
#[inline(always)]
pub const fn variant(&self) -> Option<EM4IORETMODE> {
match self.bits {
0 => Some(EM4IORETMODE::Disable),
1 => Some(EM4IORETMODE::Em4exit),
2 => Some(EM4IORETMODE::Swunlatch),
_ => None,
}
}
#[inline(always)]
pub fn is_disable(&self) -> bool {
*self == EM4IORETMODE::Disable
}
#[inline(always)]
pub fn is_em4exit(&self) -> bool {
*self == EM4IORETMODE::Em4exit
}
#[inline(always)]
pub fn is_swunlatch(&self) -> bool {
*self == EM4IORETMODE::Swunlatch
}
}
pub type Em4ioretmodeW<'a, REG> = crate::FieldWriter<'a, REG, 2, EM4IORETMODE>;
impl<'a, REG> Em4ioretmodeW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn disable(self) -> &'a mut crate::W<REG> {
self.variant(EM4IORETMODE::Disable)
}
#[inline(always)]
pub fn em4exit(self) -> &'a mut crate::W<REG> {
self.variant(EM4IORETMODE::Em4exit)
}
#[inline(always)]
pub fn swunlatch(self) -> &'a mut crate::W<REG> {
self.variant(EM4IORETMODE::Swunlatch)
}
}
pub type Em4entryW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
impl R {
#[inline(always)]
pub fn em4state(&self) -> Em4stateR {
Em4stateR::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn retainlfrco(&self) -> RetainlfrcoR {
RetainlfrcoR::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn retainlfxo(&self) -> RetainlfxoR {
RetainlfxoR::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn retainulfrco(&self) -> RetainulfrcoR {
RetainulfrcoR::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn em4ioretmode(&self) -> Em4ioretmodeR {
Em4ioretmodeR::new(((self.bits >> 4) & 3) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("EM4CTRL")
.field("em4state", &self.em4state())
.field("retainlfrco", &self.retainlfrco())
.field("retainlfxo", &self.retainlfxo())
.field("retainulfrco", &self.retainulfrco())
.field("em4ioretmode", &self.em4ioretmode())
.finish()
}
}
impl W {
#[inline(always)]
pub fn em4state(&mut self) -> Em4stateW<'_, EM4CTRLrs> {
Em4stateW::new(self, 0)
}
#[inline(always)]
pub fn retainlfrco(&mut self) -> RetainlfrcoW<'_, EM4CTRLrs> {
RetainlfrcoW::new(self, 1)
}
#[inline(always)]
pub fn retainlfxo(&mut self) -> RetainlfxoW<'_, EM4CTRLrs> {
RetainlfxoW::new(self, 2)
}
#[inline(always)]
pub fn retainulfrco(&mut self) -> RetainulfrcoW<'_, EM4CTRLrs> {
RetainulfrcoW::new(self, 3)
}
#[inline(always)]
pub fn em4ioretmode(&mut self) -> Em4ioretmodeW<'_, EM4CTRLrs> {
Em4ioretmodeW::new(self, 4)
}
#[inline(always)]
pub fn em4entry(&mut self) -> Em4entryW<'_, EM4CTRLrs> {
Em4entryW::new(self, 16)
}
}
pub struct EM4CTRLrs;
impl crate::RegisterSpec for EM4CTRLrs {
type Ux = u32;
}
impl crate::Readable for EM4CTRLrs {}
impl crate::Writable for EM4CTRLrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for EM4CTRLrs {}