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