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 DCMIEN {
Disabled = 0,
Enabled = 1,
}
impl From<DCMIEN> for bool {
#[inline(always)]
fn from(variant: DCMIEN) -> Self {
variant as u8 != 0
}
}
pub type DCMIEN_R = crate::BitReader<DCMIEN>;
impl DCMIEN_R {
#[inline(always)]
pub const fn variant(&self) -> DCMIEN {
match self.bits {
false => DCMIEN::Disabled,
true => DCMIEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == DCMIEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == DCMIEN::Enabled
}
}
pub type DCMIEN_W<'a, REG> = crate::BitWriter<'a, REG, DCMIEN>;
impl<'a, REG> DCMIEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(DCMIEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(DCMIEN::Enabled)
}
}
pub use DCMIEN_R as OTGFSEN_R;
pub use DCMIEN_W as OTGFSEN_W;
impl R {
#[inline(always)]
pub fn dcmien(&self) -> DCMIEN_R {
DCMIEN_R::new((self.bits & 1) != 0)
}
#[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("dcmien", &self.dcmien())
.field("otgfsen", &self.otgfsen())
.finish()
}
}
impl W {
#[inline(always)]
pub fn dcmien(&mut self) -> DCMIEN_W<AHB2ENRrs> {
DCMIEN_W::new(self, 0)
}
#[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 {}