pub type R = crate::R<APB1HLPENRrs>;
pub type W = crate::W<APB1HLPENRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CRSLPEN {
Disabled = 0,
Enabled = 1,
}
impl From<CRSLPEN> for bool {
#[inline(always)]
fn from(variant: CRSLPEN) -> Self {
variant as u8 != 0
}
}
pub type CRSLPEN_R = crate::BitReader<CRSLPEN>;
impl CRSLPEN_R {
#[inline(always)]
pub const fn variant(&self) -> CRSLPEN {
match self.bits {
false => CRSLPEN::Disabled,
true => CRSLPEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == CRSLPEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == CRSLPEN::Enabled
}
}
pub type CRSLPEN_W<'a, REG> = crate::BitWriter<'a, REG, CRSLPEN>;
impl<'a, REG> CRSLPEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(CRSLPEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(CRSLPEN::Enabled)
}
}
pub use CRSLPEN_R as SWPMILPEN_R;
pub use CRSLPEN_R as OPAMPLPEN_R;
pub use CRSLPEN_R as MDIOSLPEN_R;
pub use CRSLPEN_R as FDCANLPEN_R;
pub use CRSLPEN_W as SWPMILPEN_W;
pub use CRSLPEN_W as OPAMPLPEN_W;
pub use CRSLPEN_W as MDIOSLPEN_W;
pub use CRSLPEN_W as FDCANLPEN_W;
impl R {
#[inline(always)]
pub fn crslpen(&self) -> CRSLPEN_R {
CRSLPEN_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn swpmilpen(&self) -> SWPMILPEN_R {
SWPMILPEN_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn opamplpen(&self) -> OPAMPLPEN_R {
OPAMPLPEN_R::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn mdioslpen(&self) -> MDIOSLPEN_R {
MDIOSLPEN_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn fdcanlpen(&self) -> FDCANLPEN_R {
FDCANLPEN_R::new(((self.bits >> 8) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("APB1HLPENR")
.field("crslpen", &self.crslpen())
.field("swpmilpen", &self.swpmilpen())
.field("opamplpen", &self.opamplpen())
.field("mdioslpen", &self.mdioslpen())
.field("fdcanlpen", &self.fdcanlpen())
.finish()
}
}
impl W {
#[inline(always)]
pub fn crslpen(&mut self) -> CRSLPEN_W<APB1HLPENRrs> {
CRSLPEN_W::new(self, 1)
}
#[inline(always)]
pub fn swpmilpen(&mut self) -> SWPMILPEN_W<APB1HLPENRrs> {
SWPMILPEN_W::new(self, 2)
}
#[inline(always)]
pub fn opamplpen(&mut self) -> OPAMPLPEN_W<APB1HLPENRrs> {
OPAMPLPEN_W::new(self, 4)
}
#[inline(always)]
pub fn mdioslpen(&mut self) -> MDIOSLPEN_W<APB1HLPENRrs> {
MDIOSLPEN_W::new(self, 5)
}
#[inline(always)]
pub fn fdcanlpen(&mut self) -> FDCANLPEN_W<APB1HLPENRrs> {
FDCANLPEN_W::new(self, 8)
}
}
pub struct APB1HLPENRrs;
impl crate::RegisterSpec for APB1HLPENRrs {
type Ux = u32;
}
impl crate::Readable for APB1HLPENRrs {}
impl crate::Writable for APB1HLPENRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for APB1HLPENRrs {
const RESET_VALUE: u32 = 0x0136;
}