pub type R = crate::R<AHB1ENRrs>;
pub type W = crate::W<AHB1ENRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DMA1EN {
Disabled = 0,
Enabled = 1,
}
impl From<DMA1EN> for bool {
#[inline(always)]
fn from(variant: DMA1EN) -> Self {
variant as u8 != 0
}
}
pub type DMA1EN_R = crate::BitReader<DMA1EN>;
impl DMA1EN_R {
#[inline(always)]
pub const fn variant(&self) -> DMA1EN {
match self.bits {
false => DMA1EN::Disabled,
true => DMA1EN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == DMA1EN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == DMA1EN::Enabled
}
}
pub type DMA1EN_W<'a, REG> = crate::BitWriter<'a, REG, DMA1EN>;
impl<'a, REG> DMA1EN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(DMA1EN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(DMA1EN::Enabled)
}
}
pub use DMA1EN_R as DMA2EN_R;
pub use DMA1EN_R as ADC12EN_R;
pub use DMA1EN_R as CRCEN_R;
pub use DMA1EN_R as USB1OTGEN_R;
pub use DMA1EN_R as USB1OTGULPIEN_R;
pub use DMA1EN_W as DMA2EN_W;
pub use DMA1EN_W as ADC12EN_W;
pub use DMA1EN_W as CRCEN_W;
pub use DMA1EN_W as USB1OTGEN_W;
pub use DMA1EN_W as USB1OTGULPIEN_W;
impl R {
#[inline(always)]
pub fn dma1en(&self) -> DMA1EN_R {
DMA1EN_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn dma2en(&self) -> DMA2EN_R {
DMA2EN_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn adc12en(&self) -> ADC12EN_R {
ADC12EN_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn crcen(&self) -> CRCEN_R {
CRCEN_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn usb1otgen(&self) -> USB1OTGEN_R {
USB1OTGEN_R::new(((self.bits >> 25) & 1) != 0)
}
#[inline(always)]
pub fn usb1otgulpien(&self) -> USB1OTGULPIEN_R {
USB1OTGULPIEN_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("AHB1ENR")
.field("dma1en", &self.dma1en())
.field("dma2en", &self.dma2en())
.field("adc12en", &self.adc12en())
.field("crcen", &self.crcen())
.field("usb1otgen", &self.usb1otgen())
.field("usb1otgulpien", &self.usb1otgulpien())
.finish()
}
}
impl W {
#[inline(always)]
pub fn dma1en(&mut self) -> DMA1EN_W<AHB1ENRrs> {
DMA1EN_W::new(self, 0)
}
#[inline(always)]
pub fn dma2en(&mut self) -> DMA2EN_W<AHB1ENRrs> {
DMA2EN_W::new(self, 1)
}
#[inline(always)]
pub fn adc12en(&mut self) -> ADC12EN_W<AHB1ENRrs> {
ADC12EN_W::new(self, 5)
}
#[inline(always)]
pub fn crcen(&mut self) -> CRCEN_W<AHB1ENRrs> {
CRCEN_W::new(self, 9)
}
#[inline(always)]
pub fn usb1otgen(&mut self) -> USB1OTGEN_W<AHB1ENRrs> {
USB1OTGEN_W::new(self, 25)
}
#[inline(always)]
pub fn usb1otgulpien(&mut self) -> USB1OTGULPIEN_W<AHB1ENRrs> {
USB1OTGULPIEN_W::new(self, 26)
}
}
pub struct AHB1ENRrs;
impl crate::RegisterSpec for AHB1ENRrs {
type Ux = u32;
}
impl crate::Readable for AHB1ENRrs {}
impl crate::Writable for AHB1ENRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for AHB1ENRrs {}