pub type R = crate::R<APB1RSTR2rs>;
pub type W = crate::W<APB1RSTR2rs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LPUART1RST {
Reset = 1,
}
impl From<LPUART1RST> for bool {
#[inline(always)]
fn from(variant: LPUART1RST) -> Self {
variant as u8 != 0
}
}
pub type LPUART1RST_R = crate::BitReader<LPUART1RST>;
impl LPUART1RST_R {
#[inline(always)]
pub const fn variant(&self) -> Option<LPUART1RST> {
match self.bits {
true => Some(LPUART1RST::Reset),
_ => None,
}
}
#[inline(always)]
pub fn is_reset(&self) -> bool {
*self == LPUART1RST::Reset
}
}
pub type LPUART1RST_W<'a, REG> = crate::BitWriter<'a, REG, LPUART1RST>;
impl<'a, REG> LPUART1RST_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn reset(self) -> &'a mut crate::W<REG> {
self.variant(LPUART1RST::Reset)
}
}
pub use LPUART1RST_R as I2C4RST_R;
pub use LPUART1RST_R as UCPD1RST_R;
pub use LPUART1RST_W as I2C4RST_W;
pub use LPUART1RST_W as UCPD1RST_W;
impl R {
#[inline(always)]
pub fn lpuart1rst(&self) -> LPUART1RST_R {
LPUART1RST_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn i2c4rst(&self) -> I2C4RST_R {
I2C4RST_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn ucpd1rst(&self) -> UCPD1RST_R {
UCPD1RST_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("APB1RSTR2")
.field("lpuart1rst", &self.lpuart1rst())
.field("i2c4rst", &self.i2c4rst())
.field("ucpd1rst", &self.ucpd1rst())
.finish()
}
}
impl W {
#[inline(always)]
pub fn lpuart1rst(&mut self) -> LPUART1RST_W<APB1RSTR2rs> {
LPUART1RST_W::new(self, 0)
}
#[inline(always)]
pub fn i2c4rst(&mut self) -> I2C4RST_W<APB1RSTR2rs> {
I2C4RST_W::new(self, 1)
}
#[inline(always)]
pub fn ucpd1rst(&mut self) -> UCPD1RST_W<APB1RSTR2rs> {
UCPD1RST_W::new(self, 8)
}
}
pub struct APB1RSTR2rs;
impl crate::RegisterSpec for APB1RSTR2rs {
type Ux = u32;
}
impl crate::Readable for APB1RSTR2rs {}
impl crate::Writable for APB1RSTR2rs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for APB1RSTR2rs {}