pub type R = crate::R<AHB2ENRrs>;
pub type W = crate::W<AHB2ENRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OTGFSEN {
Disabled = 0,
Enabled = 1,
}
impl From<OTGFSEN> for bool {
#[inline(always)]
fn from(variant: OTGFSEN) -> Self {
variant as u8 != 0
}
}
pub type OTGFSEN_R = crate::BitReader<OTGFSEN>;
impl OTGFSEN_R {
#[inline(always)]
pub const fn variant(&self) -> OTGFSEN {
match self.bits {
false => OTGFSEN::Disabled,
true => OTGFSEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == OTGFSEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == OTGFSEN::Enabled
}
}
pub type OTGFSEN_W<'a, REG> = crate::BitWriter<'a, REG, OTGFSEN>;
impl<'a, REG> OTGFSEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(OTGFSEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(OTGFSEN::Enabled)
}
}
impl R {
#[inline(always)]
pub fn otgfsen(&self) -> OTGFSEN_R {
OTGFSEN_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("AHB2ENR")
.field("otgfsen", &self.otgfsen())
.finish()
}
}
impl W {
#[inline(always)]
pub fn otgfsen(&mut self) -> OTGFSEN_W<AHB2ENRrs> {
OTGFSEN_W::new(self, 7)
}
}
pub struct AHB2ENRrs;
impl crate::RegisterSpec for AHB2ENRrs {
type Ux = u32;
}
impl crate::Readable for AHB2ENRrs {}
impl crate::Writable for AHB2ENRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for AHB2ENRrs {}