pub type R = crate::R<AHB1RSTRrs>;
pub type W = crate::W<AHB1RSTRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DMA1RST {
Reset = 1,
}
impl From<DMA1RST> for bool {
#[inline(always)]
fn from(variant: DMA1RST) -> Self {
variant as u8 != 0
}
}
pub type DMA1RST_R = crate::BitReader<DMA1RST>;
impl DMA1RST_R {
#[inline(always)]
pub const fn variant(&self) -> Option<DMA1RST> {
match self.bits {
true => Some(DMA1RST::Reset),
_ => None,
}
}
#[inline(always)]
pub fn is_reset(&self) -> bool {
*self == DMA1RST::Reset
}
}
pub type DMA1RST_W<'a, REG> = crate::BitWriter<'a, REG, DMA1RST>;
impl<'a, REG> DMA1RST_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn reset(self) -> &'a mut crate::W<REG> {
self.variant(DMA1RST::Reset)
}
}
pub use DMA1RST_R as DMA2RST_R;
pub use DMA1RST_R as ADC12RST_R;
pub use DMA1RST_R as CRCRST_R;
pub use DMA1RST_R as USB1OTGRST_R;
pub use DMA1RST_W as DMA2RST_W;
pub use DMA1RST_W as ADC12RST_W;
pub use DMA1RST_W as CRCRST_W;
pub use DMA1RST_W as USB1OTGRST_W;
impl R {
#[inline(always)]
pub fn dma1rst(&self) -> DMA1RST_R {
DMA1RST_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn dma2rst(&self) -> DMA2RST_R {
DMA2RST_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn adc12rst(&self) -> ADC12RST_R {
ADC12RST_R::new(((self.bits >> 5) & 1) != 0)
}
#[inline(always)]
pub fn crcrst(&self) -> CRCRST_R {
CRCRST_R::new(((self.bits >> 9) & 1) != 0)
}
#[inline(always)]
pub fn usb1otgrst(&self) -> USB1OTGRST_R {
USB1OTGRST_R::new(((self.bits >> 25) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("AHB1RSTR")
.field("dma1rst", &self.dma1rst())
.field("dma2rst", &self.dma2rst())
.field("adc12rst", &self.adc12rst())
.field("crcrst", &self.crcrst())
.field("usb1otgrst", &self.usb1otgrst())
.finish()
}
}
impl W {
#[inline(always)]
pub fn dma1rst(&mut self) -> DMA1RST_W<AHB1RSTRrs> {
DMA1RST_W::new(self, 0)
}
#[inline(always)]
pub fn dma2rst(&mut self) -> DMA2RST_W<AHB1RSTRrs> {
DMA2RST_W::new(self, 1)
}
#[inline(always)]
pub fn adc12rst(&mut self) -> ADC12RST_W<AHB1RSTRrs> {
ADC12RST_W::new(self, 5)
}
#[inline(always)]
pub fn crcrst(&mut self) -> CRCRST_W<AHB1RSTRrs> {
CRCRST_W::new(self, 9)
}
#[inline(always)]
pub fn usb1otgrst(&mut self) -> USB1OTGRST_W<AHB1RSTRrs> {
USB1OTGRST_W::new(self, 25)
}
}
pub struct AHB1RSTRrs;
impl crate::RegisterSpec for AHB1RSTRrs {
type Ux = u32;
}
impl crate::Readable for AHB1RSTRrs {}
impl crate::Writable for AHB1RSTRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for AHB1RSTRrs {}