stm32f4/stm32f413/rcc/
ahb2rstr.rs

1///Register `AHB2RSTR` reader
2pub type R = crate::R<AHB2RSTRrs>;
3///Register `AHB2RSTR` writer
4pub type W = crate::W<AHB2RSTRrs>;
5/**CRYP module reset
6
7Value on reset: 0*/
8#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum CRYPRST {
11    ///1: Reset the selected module
12    Reset = 1,
13}
14impl From<CRYPRST> for bool {
15    #[inline(always)]
16    fn from(variant: CRYPRST) -> Self {
17        variant as u8 != 0
18    }
19}
20///Field `CRYPRST` reader - CRYP module reset
21pub type CRYPRST_R = crate::BitReader<CRYPRST>;
22impl CRYPRST_R {
23    ///Get enumerated values variant
24    #[inline(always)]
25    pub const fn variant(&self) -> Option<CRYPRST> {
26        match self.bits {
27            true => Some(CRYPRST::Reset),
28            _ => None,
29        }
30    }
31    ///Reset the selected module
32    #[inline(always)]
33    pub fn is_reset(&self) -> bool {
34        *self == CRYPRST::Reset
35    }
36}
37///Field `CRYPRST` writer - CRYP module reset
38pub type CRYPRST_W<'a, REG> = crate::BitWriter<'a, REG, CRYPRST>;
39impl<'a, REG> CRYPRST_W<'a, REG>
40where
41    REG: crate::Writable + crate::RegisterSpec,
42{
43    ///Reset the selected module
44    #[inline(always)]
45    pub fn reset(self) -> &'a mut crate::W<REG> {
46        self.variant(CRYPRST::Reset)
47    }
48}
49///Field `RNGRST` reader - RNGRST
50pub use CRYPRST_R as RNGRST_R;
51///Field `OTGFSRST` reader - USB OTG FS module reset
52pub use CRYPRST_R as OTGFSRST_R;
53///Field `RNGRST` writer - RNGRST
54pub use CRYPRST_W as RNGRST_W;
55///Field `OTGFSRST` writer - USB OTG FS module reset
56pub use CRYPRST_W as OTGFSRST_W;
57impl R {
58    ///Bit 4 - CRYP module reset
59    #[inline(always)]
60    pub fn cryprst(&self) -> CRYPRST_R {
61        CRYPRST_R::new(((self.bits >> 4) & 1) != 0)
62    }
63    ///Bit 6 - RNGRST
64    #[inline(always)]
65    pub fn rngrst(&self) -> RNGRST_R {
66        RNGRST_R::new(((self.bits >> 6) & 1) != 0)
67    }
68    ///Bit 7 - USB OTG FS module reset
69    #[inline(always)]
70    pub fn otgfsrst(&self) -> OTGFSRST_R {
71        OTGFSRST_R::new(((self.bits >> 7) & 1) != 0)
72    }
73}
74impl core::fmt::Debug for R {
75    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
76        f.debug_struct("AHB2RSTR")
77            .field("cryprst", &self.cryprst())
78            .field("otgfsrst", &self.otgfsrst())
79            .field("rngrst", &self.rngrst())
80            .finish()
81    }
82}
83impl W {
84    ///Bit 4 - CRYP module reset
85    #[inline(always)]
86    pub fn cryprst(&mut self) -> CRYPRST_W<AHB2RSTRrs> {
87        CRYPRST_W::new(self, 4)
88    }
89    ///Bit 6 - RNGRST
90    #[inline(always)]
91    pub fn rngrst(&mut self) -> RNGRST_W<AHB2RSTRrs> {
92        RNGRST_W::new(self, 6)
93    }
94    ///Bit 7 - USB OTG FS module reset
95    #[inline(always)]
96    pub fn otgfsrst(&mut self) -> OTGFSRST_W<AHB2RSTRrs> {
97        OTGFSRST_W::new(self, 7)
98    }
99}
100/**AHB2 peripheral reset register
101
102You can [`read`](crate::Reg::read) this register and get [`ahb2rstr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ahb2rstr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
103
104See register [structure](https://stm32-rs.github.io/stm32-rs/STM32F413.html#RCC:AHB2RSTR)*/
105pub struct AHB2RSTRrs;
106impl crate::RegisterSpec for AHB2RSTRrs {
107    type Ux = u32;
108}
109///`read()` method returns [`ahb2rstr::R`](R) reader structure
110impl crate::Readable for AHB2RSTRrs {}
111///`write(|w| ..)` method takes [`ahb2rstr::W`](W) writer structure
112impl crate::Writable for AHB2RSTRrs {
113    type Safety = crate::Unsafe;
114}
115///`reset()` method sets AHB2RSTR to value 0
116impl crate::Resettable for AHB2RSTRrs {}