pub type R = crate::R<APB2SMENRrs>;
pub type W = crate::W<APB2SMENRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SYSCFGSMEN {
Disabled = 0,
Enabled = 1,
}
impl From<SYSCFGSMEN> for bool {
#[inline(always)]
fn from(variant: SYSCFGSMEN) -> Self {
variant as u8 != 0
}
}
pub type SYSCFGSMEN_R = crate::BitReader<SYSCFGSMEN>;
impl SYSCFGSMEN_R {
#[inline(always)]
pub const fn variant(&self) -> SYSCFGSMEN {
match self.bits {
false => SYSCFGSMEN::Disabled,
true => SYSCFGSMEN::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == SYSCFGSMEN::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == SYSCFGSMEN::Enabled
}
}
pub type SYSCFGSMEN_W<'a, REG> = crate::BitWriter<'a, REG, SYSCFGSMEN>;
impl<'a, REG> SYSCFGSMEN_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(SYSCFGSMEN::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(SYSCFGSMEN::Enabled)
}
}
pub use SYSCFGSMEN_R as TIM21SMEN_R;
pub use SYSCFGSMEN_R as TIM22SMEN_R;
pub use SYSCFGSMEN_R as ADCSMEN_R;
pub use SYSCFGSMEN_R as SPI1SMEN_R;
pub use SYSCFGSMEN_R as USART1SMEN_R;
pub use SYSCFGSMEN_R as DBGSMEN_R;
pub use SYSCFGSMEN_W as TIM21SMEN_W;
pub use SYSCFGSMEN_W as TIM22SMEN_W;
pub use SYSCFGSMEN_W as ADCSMEN_W;
pub use SYSCFGSMEN_W as SPI1SMEN_W;
pub use SYSCFGSMEN_W as USART1SMEN_W;
pub use SYSCFGSMEN_W as DBGSMEN_W;
impl R {
#[inline(always)]
pub fn syscfgsmen(&self) -> SYSCFGSMEN_R {
SYSCFGSMEN_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn tim21smen(&self) -> TIM21SMEN_R {
TIM21SMEN_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn tim22smen(&self) -> TIM22SMEN_R {
TIM22SMEN_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn adcsmen(&self) -> ADCSMEN_R {
ADCSMEN_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn spi1smen(&self) -> SPI1SMEN_R {
SPI1SMEN_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn usart1smen(&self) -> USART1SMEN_R {
USART1SMEN_R::new(((self.bits >> 14) & 1) != 0)
}
#[inline(always)]
pub fn dbgsmen(&self) -> DBGSMEN_R {
DBGSMEN_R::new(((self.bits >> 22) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("APB2SMENR")
.field("syscfgsmen", &self.syscfgsmen())
.field("dbgsmen", &self.dbgsmen())
.field("usart1smen", &self.usart1smen())
.field("spi1smen", &self.spi1smen())
.field("adcsmen", &self.adcsmen())
.field("tim22smen", &self.tim22smen())
.field("tim21smen", &self.tim21smen())
.finish()
}
}
impl W {
#[inline(always)]
pub fn syscfgsmen(&mut self) -> SYSCFGSMEN_W<APB2SMENRrs> {
SYSCFGSMEN_W::new(self, 0)
}
#[inline(always)]
pub fn tim21smen(&mut self) -> TIM21SMEN_W<APB2SMENRrs> {
TIM21SMEN_W::new(self, 2)
}
#[inline(always)]
pub fn tim22smen(&mut self) -> TIM22SMEN_W<APB2SMENRrs> {
TIM22SMEN_W::new(self, 5)
}
#[inline(always)]
pub fn adcsmen(&mut self) -> ADCSMEN_W<APB2SMENRrs> {
ADCSMEN_W::new(self, 9)
}
#[inline(always)]
pub fn spi1smen(&mut self) -> SPI1SMEN_W<APB2SMENRrs> {
SPI1SMEN_W::new(self, 12)
}
#[inline(always)]
pub fn usart1smen(&mut self) -> USART1SMEN_W<APB2SMENRrs> {
USART1SMEN_W::new(self, 14)
}
#[inline(always)]
pub fn dbgsmen(&mut self) -> DBGSMEN_W<APB2SMENRrs> {
DBGSMEN_W::new(self, 22)
}
}
pub struct APB2SMENRrs;
impl crate::RegisterSpec for APB2SMENRrs {
type Ux = u32;
}
impl crate::Readable for APB2SMENRrs {}
impl crate::Writable for APB2SMENRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for APB2SMENRrs {
const RESET_VALUE: u32 = 0x0040_5225;
}