pub type R = crate::R<APB2ENRrs>;
pub type W = crate::W<APB2ENRrs>;
pub type SYSCFGEN_R = crate::BitReader;
pub type SYSCFGEN_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type FIREWALLEN_R = crate::BitReader;
pub type FIREWALLEN_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type SDMMCEN_R = crate::BitReader;
pub type SDMMCEN_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type TIM1EN_R = crate::BitReader;
pub type TIM1EN_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type SPI1EN_R = crate::BitReader;
pub type SPI1EN_W<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum USART1EN {
Disabled = 0,
Enabled = 1,
}
impl From<USART1EN> for bool {
#[inline(always)]
fn from(variant: USART1EN) -> Self {
variant as u8 != 0
}
}
pub type USART1EN_R = crate::BitReader<USART1EN>;
impl USART1EN_R {
#[inline(always)]
pub const fn variant(&self) -> USART1EN {
match self.bits {
false => USART1EN::Disabled,
true => USART1EN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == USART1EN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == USART1EN::Enabled
}
}
pub type USART1EN_W<'a, REG> = crate::BitWriter<'a, REG, USART1EN>;
impl<'a, REG> USART1EN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(USART1EN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(USART1EN::Enabled)
}
}
pub type TIM15EN_R = crate::BitReader;
pub type TIM15EN_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type TIM16EN_R = crate::BitReader;
pub type TIM16EN_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type SAI1EN_R = crate::BitReader;
pub type SAI1EN_W<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[inline(always)]
pub fn syscfgen(&self) -> SYSCFGEN_R {
SYSCFGEN_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn firewallen(&self) -> FIREWALLEN_R {
FIREWALLEN_R::new(((self.bits >> 7) & 1) != 0)
}
#[inline(always)]
pub fn sdmmcen(&self) -> SDMMCEN_R {
SDMMCEN_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn tim1en(&self) -> TIM1EN_R {
TIM1EN_R::new(((self.bits >> 11) & 1) != 0)
}
#[inline(always)]
pub fn spi1en(&self) -> SPI1EN_R {
SPI1EN_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn usart1en(&self) -> USART1EN_R {
USART1EN_R::new(((self.bits >> 14) & 1) != 0)
}
#[inline(always)]
pub fn tim15en(&self) -> TIM15EN_R {
TIM15EN_R::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn tim16en(&self) -> TIM16EN_R {
TIM16EN_R::new(((self.bits >> 17) & 1) != 0)
}
#[inline(always)]
pub fn sai1en(&self) -> SAI1EN_R {
SAI1EN_R::new(((self.bits >> 21) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("APB2ENR")
.field("sai1en", &self.sai1en())
.field("tim16en", &self.tim16en())
.field("tim15en", &self.tim15en())
.field("usart1en", &self.usart1en())
.field("spi1en", &self.spi1en())
.field("tim1en", &self.tim1en())
.field("sdmmcen", &self.sdmmcen())
.field("firewallen", &self.firewallen())
.field("syscfgen", &self.syscfgen())
.finish()
}
}
impl W {
#[inline(always)]
pub fn syscfgen(&mut self) -> SYSCFGEN_W<APB2ENRrs> {
SYSCFGEN_W::new(self, 0)
}
#[inline(always)]
pub fn firewallen(&mut self) -> FIREWALLEN_W<APB2ENRrs> {
FIREWALLEN_W::new(self, 7)
}
#[inline(always)]
pub fn sdmmcen(&mut self) -> SDMMCEN_W<APB2ENRrs> {
SDMMCEN_W::new(self, 10)
}
#[inline(always)]
pub fn tim1en(&mut self) -> TIM1EN_W<APB2ENRrs> {
TIM1EN_W::new(self, 11)
}
#[inline(always)]
pub fn spi1en(&mut self) -> SPI1EN_W<APB2ENRrs> {
SPI1EN_W::new(self, 12)
}
#[inline(always)]
pub fn usart1en(&mut self) -> USART1EN_W<APB2ENRrs> {
USART1EN_W::new(self, 14)
}
#[inline(always)]
pub fn tim15en(&mut self) -> TIM15EN_W<APB2ENRrs> {
TIM15EN_W::new(self, 16)
}
#[inline(always)]
pub fn tim16en(&mut self) -> TIM16EN_W<APB2ENRrs> {
TIM16EN_W::new(self, 17)
}
#[inline(always)]
pub fn sai1en(&mut self) -> SAI1EN_W<APB2ENRrs> {
SAI1EN_W::new(self, 21)
}
}
pub struct APB2ENRrs;
impl crate::RegisterSpec for APB2ENRrs {
type Ux = u32;
}
impl crate::Readable for APB2ENRrs {}
impl crate::Writable for APB2ENRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for APB2ENRrs {}