pub type R = crate::R<APB2LPENRrs>;
pub type W = crate::W<APB2LPENRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TIM1LPEN {
DisabledInSleep = 0,
EnabledInSleep = 1,
}
impl From<TIM1LPEN> for bool {
#[inline(always)]
fn from(variant: TIM1LPEN) -> Self {
variant as u8 != 0
}
}
pub type TIM1LPEN_R = crate::BitReader<TIM1LPEN>;
impl TIM1LPEN_R {
#[inline(always)]
pub const fn variant(&self) -> TIM1LPEN {
match self.bits {
false => TIM1LPEN::DisabledInSleep,
true => TIM1LPEN::EnabledInSleep,
}
}
#[inline(always)]
pub fn is_disabled_in_sleep(&self) -> bool {
*self == TIM1LPEN::DisabledInSleep
}
#[inline(always)]
pub fn is_enabled_in_sleep(&self) -> bool {
*self == TIM1LPEN::EnabledInSleep
}
}
pub type TIM1LPEN_W<'a, REG> = crate::BitWriter<'a, REG, TIM1LPEN>;
impl<'a, REG> TIM1LPEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled_in_sleep(self) -> &'a mut crate::W<REG> {
self.variant(TIM1LPEN::DisabledInSleep)
}
#[inline(always)]
pub fn enabled_in_sleep(self) -> &'a mut crate::W<REG> {
self.variant(TIM1LPEN::EnabledInSleep)
}
}
pub use TIM1LPEN_R as TIM8LPEN_R;
pub use TIM1LPEN_R as USART1LPEN_R;
pub use TIM1LPEN_R as USART6LPEN_R;
pub use TIM1LPEN_R as ADC1LPEN_R;
pub use TIM1LPEN_R as ADC2LPEN_R;
pub use TIM1LPEN_R as ADC3LPEN_R;
pub use TIM1LPEN_R as SDIOLPEN_R;
pub use TIM1LPEN_R as SPI1LPEN_R;
pub use TIM1LPEN_R as SPI4LPEN_R;
pub use TIM1LPEN_R as SYSCFGLPEN_R;
pub use TIM1LPEN_R as TIM9LPEN_R;
pub use TIM1LPEN_R as TIM10LPEN_R;
pub use TIM1LPEN_R as TIM11LPEN_R;
pub use TIM1LPEN_R as SAI1LPEN_R;
pub use TIM1LPEN_R as SAI2LPEN_R;
pub use TIM1LPEN_W as TIM8LPEN_W;
pub use TIM1LPEN_W as USART1LPEN_W;
pub use TIM1LPEN_W as USART6LPEN_W;
pub use TIM1LPEN_W as ADC1LPEN_W;
pub use TIM1LPEN_W as ADC2LPEN_W;
pub use TIM1LPEN_W as ADC3LPEN_W;
pub use TIM1LPEN_W as SDIOLPEN_W;
pub use TIM1LPEN_W as SPI1LPEN_W;
pub use TIM1LPEN_W as SPI4LPEN_W;
pub use TIM1LPEN_W as SYSCFGLPEN_W;
pub use TIM1LPEN_W as TIM9LPEN_W;
pub use TIM1LPEN_W as TIM10LPEN_W;
pub use TIM1LPEN_W as TIM11LPEN_W;
pub use TIM1LPEN_W as SAI1LPEN_W;
pub use TIM1LPEN_W as SAI2LPEN_W;
impl R {
#[inline(always)]
pub fn tim1lpen(&self) -> TIM1LPEN_R {
TIM1LPEN_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn tim8lpen(&self) -> TIM8LPEN_R {
TIM8LPEN_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn usart1lpen(&self) -> USART1LPEN_R {
USART1LPEN_R::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn usart6lpen(&self) -> USART6LPEN_R {
USART6LPEN_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn adc1lpen(&self) -> ADC1LPEN_R {
ADC1LPEN_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn adc2lpen(&self) -> ADC2LPEN_R {
ADC2LPEN_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn adc3lpen(&self) -> ADC3LPEN_R {
ADC3LPEN_R::new(((self.bits >> 10) & 1) != 0)
}
#[inline(always)]
pub fn sdiolpen(&self) -> SDIOLPEN_R {
SDIOLPEN_R::new(((self.bits >> 11) & 1) != 0)
}
#[inline(always)]
pub fn spi1lpen(&self) -> SPI1LPEN_R {
SPI1LPEN_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn spi4lpen(&self) -> SPI4LPEN_R {
SPI4LPEN_R::new(((self.bits >> 13) & 1) != 0)
}
#[inline(always)]
pub fn syscfglpen(&self) -> SYSCFGLPEN_R {
SYSCFGLPEN_R::new(((self.bits >> 14) & 1) != 0)
}
#[inline(always)]
pub fn tim9lpen(&self) -> TIM9LPEN_R {
TIM9LPEN_R::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn tim10lpen(&self) -> TIM10LPEN_R {
TIM10LPEN_R::new(((self.bits >> 17) & 1) != 0)
}
#[inline(always)]
pub fn tim11lpen(&self) -> TIM11LPEN_R {
TIM11LPEN_R::new(((self.bits >> 18) & 1) != 0)
}
#[inline(always)]
pub fn sai1lpen(&self) -> SAI1LPEN_R {
SAI1LPEN_R::new(((self.bits >> 22) & 1) != 0)
}
#[inline(always)]
pub fn sai2lpen(&self) -> SAI2LPEN_R {
SAI2LPEN_R::new(((self.bits >> 23) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("APB2LPENR")
.field("tim1lpen", &self.tim1lpen())
.field("tim8lpen", &self.tim8lpen())
.field("usart1lpen", &self.usart1lpen())
.field("usart6lpen", &self.usart6lpen())
.field("adc1lpen", &self.adc1lpen())
.field("adc2lpen", &self.adc2lpen())
.field("adc3lpen", &self.adc3lpen())
.field("sdiolpen", &self.sdiolpen())
.field("spi1lpen", &self.spi1lpen())
.field("spi4lpen", &self.spi4lpen())
.field("syscfglpen", &self.syscfglpen())
.field("tim9lpen", &self.tim9lpen())
.field("tim10lpen", &self.tim10lpen())
.field("tim11lpen", &self.tim11lpen())
.field("sai1lpen", &self.sai1lpen())
.field("sai2lpen", &self.sai2lpen())
.finish()
}
}
impl W {
#[inline(always)]
pub fn tim1lpen(&mut self) -> TIM1LPEN_W<APB2LPENRrs> {
TIM1LPEN_W::new(self, 0)
}
#[inline(always)]
pub fn tim8lpen(&mut self) -> TIM8LPEN_W<APB2LPENRrs> {
TIM8LPEN_W::new(self, 1)
}
#[inline(always)]
pub fn usart1lpen(&mut self) -> USART1LPEN_W<APB2LPENRrs> {
USART1LPEN_W::new(self, 4)
}
#[inline(always)]
pub fn usart6lpen(&mut self) -> USART6LPEN_W<APB2LPENRrs> {
USART6LPEN_W::new(self, 5)
}
#[inline(always)]
pub fn adc1lpen(&mut self) -> ADC1LPEN_W<APB2LPENRrs> {
ADC1LPEN_W::new(self, 8)
}
#[inline(always)]
pub fn adc2lpen(&mut self) -> ADC2LPEN_W<APB2LPENRrs> {
ADC2LPEN_W::new(self, 9)
}
#[inline(always)]
pub fn adc3lpen(&mut self) -> ADC3LPEN_W<APB2LPENRrs> {
ADC3LPEN_W::new(self, 10)
}
#[inline(always)]
pub fn sdiolpen(&mut self) -> SDIOLPEN_W<APB2LPENRrs> {
SDIOLPEN_W::new(self, 11)
}
#[inline(always)]
pub fn spi1lpen(&mut self) -> SPI1LPEN_W<APB2LPENRrs> {
SPI1LPEN_W::new(self, 12)
}
#[inline(always)]
pub fn spi4lpen(&mut self) -> SPI4LPEN_W<APB2LPENRrs> {
SPI4LPEN_W::new(self, 13)
}
#[inline(always)]
pub fn syscfglpen(&mut self) -> SYSCFGLPEN_W<APB2LPENRrs> {
SYSCFGLPEN_W::new(self, 14)
}
#[inline(always)]
pub fn tim9lpen(&mut self) -> TIM9LPEN_W<APB2LPENRrs> {
TIM9LPEN_W::new(self, 16)
}
#[inline(always)]
pub fn tim10lpen(&mut self) -> TIM10LPEN_W<APB2LPENRrs> {
TIM10LPEN_W::new(self, 17)
}
#[inline(always)]
pub fn tim11lpen(&mut self) -> TIM11LPEN_W<APB2LPENRrs> {
TIM11LPEN_W::new(self, 18)
}
#[inline(always)]
pub fn sai1lpen(&mut self) -> SAI1LPEN_W<APB2LPENRrs> {
SAI1LPEN_W::new(self, 22)
}
#[inline(always)]
pub fn sai2lpen(&mut self) -> SAI2LPEN_W<APB2LPENRrs> {
SAI2LPEN_W::new(self, 23)
}
}
pub struct APB2LPENRrs;
impl crate::RegisterSpec for APB2LPENRrs {
type Ux = u32;
}
impl crate::Readable for APB2LPENRrs {}
impl crate::Writable for APB2LPENRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for APB2LPENRrs {
const RESET_VALUE: u32 = 0x0007_5f33;
}