pub type R = crate::R<APB1LPENRrs>;
pub type W = crate::W<APB1LPENRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TIM2LPEN {
DisabledInSleep = 0,
EnabledInSleep = 1,
}
impl From<TIM2LPEN> for bool {
#[inline(always)]
fn from(variant: TIM2LPEN) -> Self {
variant as u8 != 0
}
}
pub type TIM2LPEN_R = crate::BitReader<TIM2LPEN>;
impl TIM2LPEN_R {
#[inline(always)]
pub const fn variant(&self) -> TIM2LPEN {
match self.bits {
false => TIM2LPEN::DisabledInSleep,
true => TIM2LPEN::EnabledInSleep,
}
}
#[inline(always)]
pub fn is_disabled_in_sleep(&self) -> bool {
*self == TIM2LPEN::DisabledInSleep
}
#[inline(always)]
pub fn is_enabled_in_sleep(&self) -> bool {
*self == TIM2LPEN::EnabledInSleep
}
}
pub type TIM2LPEN_W<'a, REG> = crate::BitWriter<'a, REG, TIM2LPEN>;
impl<'a, REG> TIM2LPEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled_in_sleep(self) -> &'a mut crate::W<REG> {
self.variant(TIM2LPEN::DisabledInSleep)
}
#[inline(always)]
pub fn enabled_in_sleep(self) -> &'a mut crate::W<REG> {
self.variant(TIM2LPEN::EnabledInSleep)
}
}
pub use TIM2LPEN_R as TIM3LPEN_R;
pub use TIM2LPEN_R as TIM4LPEN_R;
pub use TIM2LPEN_R as TIM5LPEN_R;
pub use TIM2LPEN_R as WWDGLPEN_R;
pub use TIM2LPEN_R as SPI2LPEN_R;
pub use TIM2LPEN_R as SPI3LPEN_R;
pub use TIM2LPEN_R as USART2LPEN_R;
pub use TIM2LPEN_R as I2C1LPEN_R;
pub use TIM2LPEN_R as I2C2LPEN_R;
pub use TIM2LPEN_R as I2C3LPEN_R;
pub use TIM2LPEN_R as PWRLPEN_R;
pub use TIM2LPEN_W as TIM3LPEN_W;
pub use TIM2LPEN_W as TIM4LPEN_W;
pub use TIM2LPEN_W as TIM5LPEN_W;
pub use TIM2LPEN_W as WWDGLPEN_W;
pub use TIM2LPEN_W as SPI2LPEN_W;
pub use TIM2LPEN_W as SPI3LPEN_W;
pub use TIM2LPEN_W as USART2LPEN_W;
pub use TIM2LPEN_W as I2C1LPEN_W;
pub use TIM2LPEN_W as I2C2LPEN_W;
pub use TIM2LPEN_W as I2C3LPEN_W;
pub use TIM2LPEN_W as PWRLPEN_W;
impl R {
#[inline(always)]
pub fn tim2lpen(&self) -> TIM2LPEN_R {
TIM2LPEN_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn tim3lpen(&self) -> TIM3LPEN_R {
TIM3LPEN_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn tim4lpen(&self) -> TIM4LPEN_R {
TIM4LPEN_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn tim5lpen(&self) -> TIM5LPEN_R {
TIM5LPEN_R::new(((self.bits >> 3) & 1) != 0)
}
#[inline(always)]
pub fn wwdglpen(&self) -> WWDGLPEN_R {
WWDGLPEN_R::new(((self.bits >> 11) & 1) != 0)
}
#[inline(always)]
pub fn spi2lpen(&self) -> SPI2LPEN_R {
SPI2LPEN_R::new(((self.bits >> 14) & 1) != 0)
}
#[inline(always)]
pub fn spi3lpen(&self) -> SPI3LPEN_R {
SPI3LPEN_R::new(((self.bits >> 15) & 1) != 0)
}
#[inline(always)]
pub fn usart2lpen(&self) -> USART2LPEN_R {
USART2LPEN_R::new(((self.bits >> 17) & 1) != 0)
}
#[inline(always)]
pub fn i2c1lpen(&self) -> I2C1LPEN_R {
I2C1LPEN_R::new(((self.bits >> 21) & 1) != 0)
}
#[inline(always)]
pub fn i2c2lpen(&self) -> I2C2LPEN_R {
I2C2LPEN_R::new(((self.bits >> 22) & 1) != 0)
}
#[inline(always)]
pub fn i2c3lpen(&self) -> I2C3LPEN_R {
I2C3LPEN_R::new(((self.bits >> 23) & 1) != 0)
}
#[inline(always)]
pub fn pwrlpen(&self) -> PWRLPEN_R {
PWRLPEN_R::new(((self.bits >> 28) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("APB1LPENR")
.field("tim2lpen", &self.tim2lpen())
.field("pwrlpen", &self.pwrlpen())
.field("i2c3lpen", &self.i2c3lpen())
.field("i2c2lpen", &self.i2c2lpen())
.field("i2c1lpen", &self.i2c1lpen())
.field("usart2lpen", &self.usart2lpen())
.field("spi3lpen", &self.spi3lpen())
.field("spi2lpen", &self.spi2lpen())
.field("wwdglpen", &self.wwdglpen())
.field("tim5lpen", &self.tim5lpen())
.field("tim4lpen", &self.tim4lpen())
.field("tim3lpen", &self.tim3lpen())
.finish()
}
}
impl W {
#[inline(always)]
pub fn tim2lpen(&mut self) -> TIM2LPEN_W<APB1LPENRrs> {
TIM2LPEN_W::new(self, 0)
}
#[inline(always)]
pub fn tim3lpen(&mut self) -> TIM3LPEN_W<APB1LPENRrs> {
TIM3LPEN_W::new(self, 1)
}
#[inline(always)]
pub fn tim4lpen(&mut self) -> TIM4LPEN_W<APB1LPENRrs> {
TIM4LPEN_W::new(self, 2)
}
#[inline(always)]
pub fn tim5lpen(&mut self) -> TIM5LPEN_W<APB1LPENRrs> {
TIM5LPEN_W::new(self, 3)
}
#[inline(always)]
pub fn wwdglpen(&mut self) -> WWDGLPEN_W<APB1LPENRrs> {
WWDGLPEN_W::new(self, 11)
}
#[inline(always)]
pub fn spi2lpen(&mut self) -> SPI2LPEN_W<APB1LPENRrs> {
SPI2LPEN_W::new(self, 14)
}
#[inline(always)]
pub fn spi3lpen(&mut self) -> SPI3LPEN_W<APB1LPENRrs> {
SPI3LPEN_W::new(self, 15)
}
#[inline(always)]
pub fn usart2lpen(&mut self) -> USART2LPEN_W<APB1LPENRrs> {
USART2LPEN_W::new(self, 17)
}
#[inline(always)]
pub fn i2c1lpen(&mut self) -> I2C1LPEN_W<APB1LPENRrs> {
I2C1LPEN_W::new(self, 21)
}
#[inline(always)]
pub fn i2c2lpen(&mut self) -> I2C2LPEN_W<APB1LPENRrs> {
I2C2LPEN_W::new(self, 22)
}
#[inline(always)]
pub fn i2c3lpen(&mut self) -> I2C3LPEN_W<APB1LPENRrs> {
I2C3LPEN_W::new(self, 23)
}
#[inline(always)]
pub fn pwrlpen(&mut self) -> PWRLPEN_W<APB1LPENRrs> {
PWRLPEN_W::new(self, 28)
}
}
pub struct APB1LPENRrs;
impl crate::RegisterSpec for APB1LPENRrs {
type Ux = u32;
}
impl crate::Readable for APB1LPENRrs {}
impl crate::Writable for APB1LPENRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for APB1LPENRrs {
const RESET_VALUE: u32 = 0x36fe_c9ff;
}