pub type R = crate::R<APB1ENR2rs>;
pub type W = crate::W<APB1ENR2rs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LPUART1EN {
Disabled = 0,
Enabled = 1,
}
impl From<LPUART1EN> for bool {
#[inline(always)]
fn from(variant: LPUART1EN) -> Self {
variant as u8 != 0
}
}
pub type LPUART1EN_R = crate::BitReader<LPUART1EN>;
impl LPUART1EN_R {
#[inline(always)]
pub const fn variant(&self) -> LPUART1EN {
match self.bits {
false => LPUART1EN::Disabled,
true => LPUART1EN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == LPUART1EN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == LPUART1EN::Enabled
}
}
pub type LPUART1EN_W<'a, REG> = crate::BitWriter<'a, REG, LPUART1EN>;
impl<'a, REG> LPUART1EN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(LPUART1EN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(LPUART1EN::Enabled)
}
}
pub type I2C4EN_R = crate::BitReader;
pub type I2C4EN_W<'a, REG> = crate::BitWriter<'a, REG>;
pub type SWPMI1EN_R = crate::BitReader;
pub type SWPMI1EN_W<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LPTIM2EN {
Disabled = 0,
Enabled = 1,
}
impl From<LPTIM2EN> for bool {
#[inline(always)]
fn from(variant: LPTIM2EN) -> Self {
variant as u8 != 0
}
}
pub type LPTIM2EN_R = crate::BitReader<LPTIM2EN>;
impl LPTIM2EN_R {
#[inline(always)]
pub const fn variant(&self) -> LPTIM2EN {
match self.bits {
false => LPTIM2EN::Disabled,
true => LPTIM2EN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == LPTIM2EN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == LPTIM2EN::Enabled
}
}
pub type LPTIM2EN_W<'a, REG> = crate::BitWriter<'a, REG, LPTIM2EN>;
impl<'a, REG> LPTIM2EN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(LPTIM2EN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(LPTIM2EN::Enabled)
}
}
pub type DFSDMEN_R = crate::BitReader;
pub type DFSDMEN_W<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
#[inline(always)]
pub fn lpuart1en(&self) -> LPUART1EN_R {
LPUART1EN_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn i2c4en(&self) -> I2C4EN_R {
I2C4EN_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn swpmi1en(&self) -> SWPMI1EN_R {
SWPMI1EN_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn lptim2en(&self) -> LPTIM2EN_R {
LPTIM2EN_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn dfsdmen(&self) -> DFSDMEN_R {
DFSDMEN_R::new(((self.bits >> 24) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("APB1ENR2")
.field("lptim2en", &self.lptim2en())
.field("swpmi1en", &self.swpmi1en())
.field("lpuart1en", &self.lpuart1en())
.field("dfsdmen", &self.dfsdmen())
.field("i2c4en", &self.i2c4en())
.finish()
}
}
impl W {
#[inline(always)]
pub fn lpuart1en(&mut self) -> LPUART1EN_W<APB1ENR2rs> {
LPUART1EN_W::new(self, 0)
}
#[inline(always)]
pub fn i2c4en(&mut self) -> I2C4EN_W<APB1ENR2rs> {
I2C4EN_W::new(self, 1)
}
#[inline(always)]
pub fn swpmi1en(&mut self) -> SWPMI1EN_W<APB1ENR2rs> {
SWPMI1EN_W::new(self, 2)
}
#[inline(always)]
pub fn lptim2en(&mut self) -> LPTIM2EN_W<APB1ENR2rs> {
LPTIM2EN_W::new(self, 5)
}
#[inline(always)]
pub fn dfsdmen(&mut self) -> DFSDMEN_W<APB1ENR2rs> {
DFSDMEN_W::new(self, 24)
}
}
pub struct APB1ENR2rs;
impl crate::RegisterSpec for APB1ENR2rs {
type Ux = u32;
}
impl crate::Readable for APB1ENR2rs {}
impl crate::Writable for APB1ENR2rs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for APB1ENR2rs {}