stm32f1_staging/stm32f102/rcc/
ahbenr.rspub type R = crate::R<AHBENRrs>;
pub type W = crate::W<AHBENRrs>;
#[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 SRAMEN_R;
pub use DMA1EN_R as FLITFEN_R;
pub use DMA1EN_R as CRCEN_R;
pub use DMA1EN_W as DMA2EN_W;
pub use DMA1EN_W as SRAMEN_W;
pub use DMA1EN_W as FLITFEN_W;
pub use DMA1EN_W as CRCEN_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 sramen(&self) -> SRAMEN_R {
SRAMEN_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn flitfen(&self) -> FLITFEN_R {
FLITFEN_R::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn crcen(&self) -> CRCEN_R {
CRCEN_R::new(((self.bits >> 6) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AHBENR")
.field("dma1en", &self.dma1en())
.field("dma2en", &self.dma2en())
.field("sramen", &self.sramen())
.field("flitfen", &self.flitfen())
.field("crcen", &self.crcen())
.finish()
}
}
impl W {
#[inline(always)]
#[must_use]
pub fn dma1en(&mut self) -> DMA1EN_W<AHBENRrs> {
DMA1EN_W::new(self, 0)
}
#[inline(always)]
#[must_use]
pub fn dma2en(&mut self) -> DMA2EN_W<AHBENRrs> {
DMA2EN_W::new(self, 1)
}
#[inline(always)]
#[must_use]
pub fn sramen(&mut self) -> SRAMEN_W<AHBENRrs> {
SRAMEN_W::new(self, 2)
}
#[inline(always)]
#[must_use]
pub fn flitfen(&mut self) -> FLITFEN_W<AHBENRrs> {
FLITFEN_W::new(self, 4)
}
#[inline(always)]
#[must_use]
pub fn crcen(&mut self) -> CRCEN_W<AHBENRrs> {
CRCEN_W::new(self, 6)
}
}
pub struct AHBENRrs;
impl crate::RegisterSpec for AHBENRrs {
type Ux = u32;
}
impl crate::Readable for AHBENRrs {}
impl crate::Writable for AHBENRrs {
type Safety = crate::Unsafe;
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
impl crate::Resettable for AHBENRrs {
const RESET_VALUE: u32 = 0x14;
}