pub type R = crate::R<APB2RSTRrs>;
pub type W = crate::W<APB2RSTRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SYSCFGRSTW {
Reset = 1,
}
impl From<SYSCFGRSTW> for bool {
#[inline(always)]
fn from(variant: SYSCFGRSTW) -> Self {
variant as u8 != 0
}
}
pub type SYSCFGRST_R = crate::BitReader<SYSCFGRSTW>;
impl SYSCFGRST_R {
#[inline(always)]
pub const fn variant(&self) -> Option<SYSCFGRSTW> {
match self.bits {
true => Some(SYSCFGRSTW::Reset),
_ => None,
}
}
#[inline(always)]
pub fn is_reset(&self) -> bool {
*self == SYSCFGRSTW::Reset
}
}
pub type SYSCFGRST_W<'a, REG> = crate::BitWriter<'a, REG, SYSCFGRSTW>;
impl<'a, REG> SYSCFGRST_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn reset(self) -> &'a mut crate::W<REG> {
self.variant(SYSCFGRSTW::Reset)
}
}
pub use SYSCFGRST_R as TIM21RST_R;
pub use SYSCFGRST_R as TIM22RST_R;
pub use SYSCFGRST_R as ADCRST_R;
pub use SYSCFGRST_R as SPI1RST_R;
pub use SYSCFGRST_R as USART1RST_R;
pub use SYSCFGRST_R as DBGRST_R;
pub use SYSCFGRST_W as TIM21RST_W;
pub use SYSCFGRST_W as TIM22RST_W;
pub use SYSCFGRST_W as ADCRST_W;
pub use SYSCFGRST_W as SPI1RST_W;
pub use SYSCFGRST_W as USART1RST_W;
pub use SYSCFGRST_W as DBGRST_W;
impl R {
#[inline(always)]
pub fn syscfgrst(&self) -> SYSCFGRST_R {
SYSCFGRST_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn tim21rst(&self) -> TIM21RST_R {
TIM21RST_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn tim22rst(&self) -> TIM22RST_R {
TIM22RST_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn adcrst(&self) -> ADCRST_R {
ADCRST_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn spi1rst(&self) -> SPI1RST_R {
SPI1RST_R::new(((self.bits >> 12) & 1) != 0)
}
#[inline(always)]
pub fn usart1rst(&self) -> USART1RST_R {
USART1RST_R::new(((self.bits >> 14) & 1) != 0)
}
#[inline(always)]
pub fn dbgrst(&self) -> DBGRST_R {
DBGRST_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("APB2RSTR")
.field("syscfgrst", &self.syscfgrst())
.field("dbgrst", &self.dbgrst())
.field("usart1rst", &self.usart1rst())
.field("spi1rst", &self.spi1rst())
.field("adcrst", &self.adcrst())
.field("tim22rst", &self.tim22rst())
.field("tim21rst", &self.tim21rst())
.finish()
}
}
impl W {
#[inline(always)]
pub fn syscfgrst(&mut self) -> SYSCFGRST_W<APB2RSTRrs> {
SYSCFGRST_W::new(self, 0)
}
#[inline(always)]
pub fn tim21rst(&mut self) -> TIM21RST_W<APB2RSTRrs> {
TIM21RST_W::new(self, 2)
}
#[inline(always)]
pub fn tim22rst(&mut self) -> TIM22RST_W<APB2RSTRrs> {
TIM22RST_W::new(self, 5)
}
#[inline(always)]
pub fn adcrst(&mut self) -> ADCRST_W<APB2RSTRrs> {
ADCRST_W::new(self, 9)
}
#[inline(always)]
pub fn spi1rst(&mut self) -> SPI1RST_W<APB2RSTRrs> {
SPI1RST_W::new(self, 12)
}
#[inline(always)]
pub fn usart1rst(&mut self) -> USART1RST_W<APB2RSTRrs> {
USART1RST_W::new(self, 14)
}
#[inline(always)]
pub fn dbgrst(&mut self) -> DBGRST_W<APB2RSTRrs> {
DBGRST_W::new(self, 22)
}
}
pub struct APB2RSTRrs;
impl crate::RegisterSpec for APB2RSTRrs {
type Ux = u32;
}
impl crate::Readable for APB2RSTRrs {}
impl crate::Writable for APB2RSTRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for APB2RSTRrs {}