pub type R = crate::R<AHB3LPENRrs>;
pub type W = crate::W<AHB3LPENRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum FMCLPEN {
DisabledInSleep = 0,
EnabledInSleep = 1,
}
impl From<FMCLPEN> for bool {
#[inline(always)]
fn from(variant: FMCLPEN) -> Self {
variant as u8 != 0
}
}
pub type FMCLPEN_R = crate::BitReader<FMCLPEN>;
impl FMCLPEN_R {
#[inline(always)]
pub const fn variant(&self) -> FMCLPEN {
match self.bits {
false => FMCLPEN::DisabledInSleep,
true => FMCLPEN::EnabledInSleep,
}
}
#[inline(always)]
pub fn is_disabled_in_sleep(&self) -> bool {
*self == FMCLPEN::DisabledInSleep
}
#[inline(always)]
pub fn is_enabled_in_sleep(&self) -> bool {
*self == FMCLPEN::EnabledInSleep
}
}
pub type FMCLPEN_W<'a, REG> = crate::BitWriter<'a, REG, FMCLPEN>;
impl<'a, REG> FMCLPEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled_in_sleep(self) -> &'a mut crate::W<REG> {
self.variant(FMCLPEN::DisabledInSleep)
}
#[inline(always)]
pub fn enabled_in_sleep(self) -> &'a mut crate::W<REG> {
self.variant(FMCLPEN::EnabledInSleep)
}
}
pub use FMCLPEN_R as QSPILPEN_R;
pub use FMCLPEN_W as QSPILPEN_W;
impl R {
#[inline(always)]
pub fn fmclpen(&self) -> FMCLPEN_R {
FMCLPEN_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn qspilpen(&self) -> QSPILPEN_R {
QSPILPEN_R::new(((self.bits >> 1) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AHB3LPENR")
.field("fmclpen", &self.fmclpen())
.field("qspilpen", &self.qspilpen())
.finish()
}
}
impl W {
#[inline(always)]
pub fn fmclpen(&mut self) -> FMCLPEN_W<AHB3LPENRrs> {
FMCLPEN_W::new(self, 0)
}
#[inline(always)]
pub fn qspilpen(&mut self) -> QSPILPEN_W<AHB3LPENRrs> {
QSPILPEN_W::new(self, 1)
}
}
pub struct AHB3LPENRrs;
impl crate::RegisterSpec for AHB3LPENRrs {
type Ux = u32;
}
impl crate::Readable for AHB3LPENRrs {}
impl crate::Writable for AHB3LPENRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for AHB3LPENRrs {
const RESET_VALUE: u32 = 0x01;
}