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 use LPUART1EN_R as I2C4EN_R;
pub use LPUART1EN_R as UCPD1EN_R;
pub use LPUART1EN_W as I2C4EN_W;
pub use LPUART1EN_W as UCPD1EN_W;
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 ucpd1en(&self) -> UCPD1EN_R {
UCPD1EN_R::new(((self.bits >> 8) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("APB1ENR2")
.field("lpuart1en", &self.lpuart1en())
.field("i2c4en", &self.i2c4en())
.field("ucpd1en", &self.ucpd1en())
.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 ucpd1en(&mut self) -> UCPD1EN_W<APB1ENR2rs> {
UCPD1EN_W::new(self, 8)
}
}
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 {}