pub type R = crate::R<APB1HENRrs>;
pub type W = crate::W<APB1HENRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CRSEN {
Disabled = 0,
Enabled = 1,
}
impl From<CRSEN> for bool {
#[inline(always)]
fn from(variant: CRSEN) -> Self {
variant as u8 != 0
}
}
pub type CRSEN_R = crate::BitReader<CRSEN>;
impl CRSEN_R {
#[inline(always)]
pub const fn variant(&self) -> CRSEN {
match self.bits {
false => CRSEN::Disabled,
true => CRSEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == CRSEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == CRSEN::Enabled
}
}
pub type CRSEN_W<'a, REG> = crate::BitWriter<'a, REG, CRSEN>;
impl<'a, REG> CRSEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(CRSEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(CRSEN::Enabled)
}
}
pub use CRSEN_R as SWPMIEN_R;
pub use CRSEN_R as OPAMPEN_R;
pub use CRSEN_R as MDIOSEN_R;
pub use CRSEN_R as FDCANEN_R;
pub use CRSEN_W as SWPMIEN_W;
pub use CRSEN_W as OPAMPEN_W;
pub use CRSEN_W as MDIOSEN_W;
pub use CRSEN_W as FDCANEN_W;
impl R {
#[inline(always)]
pub fn crsen(&self) -> CRSEN_R {
CRSEN_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn swpmien(&self) -> SWPMIEN_R {
SWPMIEN_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn opampen(&self) -> OPAMPEN_R {
OPAMPEN_R::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn mdiosen(&self) -> MDIOSEN_R {
MDIOSEN_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn fdcanen(&self) -> FDCANEN_R {
FDCANEN_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("APB1HENR")
.field("crsen", &self.crsen())
.field("swpmien", &self.swpmien())
.field("opampen", &self.opampen())
.field("mdiosen", &self.mdiosen())
.field("fdcanen", &self.fdcanen())
.finish()
}
}
impl W {
#[inline(always)]
pub fn crsen(&mut self) -> CRSEN_W<APB1HENRrs> {
CRSEN_W::new(self, 1)
}
#[inline(always)]
pub fn swpmien(&mut self) -> SWPMIEN_W<APB1HENRrs> {
SWPMIEN_W::new(self, 2)
}
#[inline(always)]
pub fn opampen(&mut self) -> OPAMPEN_W<APB1HENRrs> {
OPAMPEN_W::new(self, 4)
}
#[inline(always)]
pub fn mdiosen(&mut self) -> MDIOSEN_W<APB1HENRrs> {
MDIOSEN_W::new(self, 5)
}
#[inline(always)]
pub fn fdcanen(&mut self) -> FDCANEN_W<APB1HENRrs> {
FDCANEN_W::new(self, 8)
}
}
pub struct APB1HENRrs;
impl crate::RegisterSpec for APB1HENRrs {
type Ux = u32;
}
impl crate::Readable for APB1HENRrs {}
impl crate::Writable for APB1HENRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for APB1HENRrs {}