pub type R = crate::R<AHB1LPENRrs>;
pub type W = crate::W<AHB1LPENRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DMA1LPEN {
Disabled = 0,
Enabled = 1,
}
impl From<DMA1LPEN> for bool {
#[inline(always)]
fn from(variant: DMA1LPEN) -> Self {
variant as u8 != 0
}
}
pub type DMA1LPEN_R = crate::BitReader<DMA1LPEN>;
impl DMA1LPEN_R {
#[inline(always)]
pub const fn variant(&self) -> DMA1LPEN {
match self.bits {
false => DMA1LPEN::Disabled,
true => DMA1LPEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == DMA1LPEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == DMA1LPEN::Enabled
}
}
pub type DMA1LPEN_W<'a, REG> = crate::BitWriter<'a, REG, DMA1LPEN>;
impl<'a, REG> DMA1LPEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(DMA1LPEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(DMA1LPEN::Enabled)
}
}
pub use DMA1LPEN_R as DMA2LPEN_R;
pub use DMA1LPEN_R as ADC12LPEN_R;
pub use DMA1LPEN_R as CRCLPEN_R;
pub use DMA1LPEN_R as USB1OTGLPEN_R;
pub use DMA1LPEN_R as USB1OTGULPILPEN_R;
pub use DMA1LPEN_W as DMA2LPEN_W;
pub use DMA1LPEN_W as ADC12LPEN_W;
pub use DMA1LPEN_W as CRCLPEN_W;
pub use DMA1LPEN_W as USB1OTGLPEN_W;
pub use DMA1LPEN_W as USB1OTGULPILPEN_W;
impl R {
#[inline(always)]
pub fn dma1lpen(&self) -> DMA1LPEN_R {
DMA1LPEN_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn dma2lpen(&self) -> DMA2LPEN_R {
DMA2LPEN_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn adc12lpen(&self) -> ADC12LPEN_R {
ADC12LPEN_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn crclpen(&self) -> CRCLPEN_R {
CRCLPEN_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn usb1otglpen(&self) -> USB1OTGLPEN_R {
USB1OTGLPEN_R::new(((self.bits >> 25) & 1) != 0)
}
#[inline(always)]
pub fn usb1otgulpilpen(&self) -> USB1OTGULPILPEN_R {
USB1OTGULPILPEN_R::new(((self.bits >> 26) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AHB1LPENR")
.field("dma1lpen", &self.dma1lpen())
.field("dma2lpen", &self.dma2lpen())
.field("adc12lpen", &self.adc12lpen())
.field("crclpen", &self.crclpen())
.field("usb1otglpen", &self.usb1otglpen())
.field("usb1otgulpilpen", &self.usb1otgulpilpen())
.finish()
}
}
impl W {
#[inline(always)]
pub fn dma1lpen(&mut self) -> DMA1LPEN_W<AHB1LPENRrs> {
DMA1LPEN_W::new(self, 0)
}
#[inline(always)]
pub fn dma2lpen(&mut self) -> DMA2LPEN_W<AHB1LPENRrs> {
DMA2LPEN_W::new(self, 1)
}
#[inline(always)]
pub fn adc12lpen(&mut self) -> ADC12LPEN_W<AHB1LPENRrs> {
ADC12LPEN_W::new(self, 5)
}
#[inline(always)]
pub fn crclpen(&mut self) -> CRCLPEN_W<AHB1LPENRrs> {
CRCLPEN_W::new(self, 9)
}
#[inline(always)]
pub fn usb1otglpen(&mut self) -> USB1OTGLPEN_W<AHB1LPENRrs> {
USB1OTGLPEN_W::new(self, 25)
}
#[inline(always)]
pub fn usb1otgulpilpen(&mut self) -> USB1OTGULPILPEN_W<AHB1LPENRrs> {
USB1OTGULPILPEN_W::new(self, 26)
}
}
pub struct AHB1LPENRrs;
impl crate::RegisterSpec for AHB1LPENRrs {
type Ux = u32;
}
impl crate::Readable for AHB1LPENRrs {}
impl crate::Writable for AHB1LPENRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for AHB1LPENRrs {
const RESET_VALUE: u32 = 0x0600_0223;
}