stm32f7/stm32f7x3/rcc/
csr.rs1#[doc = "Register `CSR` reader"]
2pub struct R(crate::R<CSR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CSR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CSR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CSR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CSR` writer"]
17pub struct W(crate::W<CSR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CSR_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<CSR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CSR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Low-power reset flag"]
38pub use BORRSTF_A as LPWRRSTF_A;
39#[doc = "Window watchdog reset flag"]
40pub use BORRSTF_A as WWDGRSTF_A;
41#[doc = "Independent watchdog reset flag"]
42pub use BORRSTF_A as WDGRSTF_A;
43#[doc = "Software reset flag"]
44pub use BORRSTF_A as SFTRSTF_A;
45#[doc = "POR/PDR reset flag"]
46pub use BORRSTF_A as PORRSTF_A;
47#[doc = "PIN reset flag"]
48pub use BORRSTF_A as PADRSTF_A;
49#[doc = "Field `LPWRRSTF` reader - Low-power reset flag"]
50pub use BORRSTF_R as LPWRRSTF_R;
51#[doc = "Field `WWDGRSTF` reader - Window watchdog reset flag"]
52pub use BORRSTF_R as WWDGRSTF_R;
53#[doc = "Field `WDGRSTF` reader - Independent watchdog reset flag"]
54pub use BORRSTF_R as WDGRSTF_R;
55#[doc = "Field `SFTRSTF` reader - Software reset flag"]
56pub use BORRSTF_R as SFTRSTF_R;
57#[doc = "Field `PORRSTF` reader - POR/PDR reset flag"]
58pub use BORRSTF_R as PORRSTF_R;
59#[doc = "Field `PADRSTF` reader - PIN reset flag"]
60pub use BORRSTF_R as PADRSTF_R;
61#[doc = "Field `LPWRRSTF` writer - Low-power reset flag"]
62pub use BORRSTF_W as LPWRRSTF_W;
63#[doc = "Field `WWDGRSTF` writer - Window watchdog reset flag"]
64pub use BORRSTF_W as WWDGRSTF_W;
65#[doc = "Field `WDGRSTF` writer - Independent watchdog reset flag"]
66pub use BORRSTF_W as WDGRSTF_W;
67#[doc = "Field `SFTRSTF` writer - Software reset flag"]
68pub use BORRSTF_W as SFTRSTF_W;
69#[doc = "Field `PORRSTF` writer - POR/PDR reset flag"]
70pub use BORRSTF_W as PORRSTF_W;
71#[doc = "Field `PADRSTF` writer - PIN reset flag"]
72pub use BORRSTF_W as PADRSTF_W;
73#[doc = "BOR reset flag\n\nValue on reset: 1"]
74#[derive(Clone, Copy, Debug, PartialEq)]
75pub enum BORRSTF_A {
76 #[doc = "0: No reset has occured"]
77 NoReset = 0,
78 #[doc = "1: A reset has occured"]
79 Reset = 1,
80}
81impl From<BORRSTF_A> for bool {
82 #[inline(always)]
83 fn from(variant: BORRSTF_A) -> Self {
84 variant as u8 != 0
85 }
86}
87#[doc = "Field `BORRSTF` reader - BOR reset flag"]
88pub type BORRSTF_R = crate::BitReader<BORRSTF_A>;
89impl BORRSTF_R {
90 #[doc = "Get enumerated values variant"]
91 #[inline(always)]
92 pub fn variant(&self) -> BORRSTF_A {
93 match self.bits {
94 false => BORRSTF_A::NoReset,
95 true => BORRSTF_A::Reset,
96 }
97 }
98 #[doc = "Checks if the value of the field is `NoReset`"]
99 #[inline(always)]
100 pub fn is_no_reset(&self) -> bool {
101 *self == BORRSTF_A::NoReset
102 }
103 #[doc = "Checks if the value of the field is `Reset`"]
104 #[inline(always)]
105 pub fn is_reset(&self) -> bool {
106 *self == BORRSTF_A::Reset
107 }
108}
109#[doc = "Field `BORRSTF` writer - BOR reset flag"]
110pub type BORRSTF_W<'a, const O: u8> = crate::BitWriter<'a, u32, CSR_SPEC, BORRSTF_A, O>;
111impl<'a, const O: u8> BORRSTF_W<'a, O> {
112 #[doc = "No reset has occured"]
113 #[inline(always)]
114 pub fn no_reset(self) -> &'a mut W {
115 self.variant(BORRSTF_A::NoReset)
116 }
117 #[doc = "A reset has occured"]
118 #[inline(always)]
119 pub fn reset(self) -> &'a mut W {
120 self.variant(BORRSTF_A::Reset)
121 }
122}
123#[doc = "Remove reset flag\n\nValue on reset: 0"]
124#[derive(Clone, Copy, Debug, PartialEq)]
125pub enum RMVF_A {
126 #[doc = "1: Clears the reset flag"]
127 Clear = 1,
128}
129impl From<RMVF_A> for bool {
130 #[inline(always)]
131 fn from(variant: RMVF_A) -> Self {
132 variant as u8 != 0
133 }
134}
135#[doc = "Field `RMVF` reader - Remove reset flag"]
136pub type RMVF_R = crate::BitReader<RMVF_A>;
137impl RMVF_R {
138 #[doc = "Get enumerated values variant"]
139 #[inline(always)]
140 pub fn variant(&self) -> Option<RMVF_A> {
141 match self.bits {
142 true => Some(RMVF_A::Clear),
143 _ => None,
144 }
145 }
146 #[doc = "Checks if the value of the field is `Clear`"]
147 #[inline(always)]
148 pub fn is_clear(&self) -> bool {
149 *self == RMVF_A::Clear
150 }
151}
152#[doc = "Field `RMVF` writer - Remove reset flag"]
153pub type RMVF_W<'a, const O: u8> = crate::BitWriter<'a, u32, CSR_SPEC, RMVF_A, O>;
154impl<'a, const O: u8> RMVF_W<'a, O> {
155 #[doc = "Clears the reset flag"]
156 #[inline(always)]
157 pub fn clear(self) -> &'a mut W {
158 self.variant(RMVF_A::Clear)
159 }
160}
161#[doc = "Internal low-speed oscillator ready\n\nValue on reset: 0"]
162#[derive(Clone, Copy, Debug, PartialEq)]
163pub enum LSIRDY_A {
164 #[doc = "0: LSI oscillator not ready"]
165 NotReady = 0,
166 #[doc = "1: LSI oscillator ready"]
167 Ready = 1,
168}
169impl From<LSIRDY_A> for bool {
170 #[inline(always)]
171 fn from(variant: LSIRDY_A) -> Self {
172 variant as u8 != 0
173 }
174}
175#[doc = "Field `LSIRDY` reader - Internal low-speed oscillator ready"]
176pub type LSIRDY_R = crate::BitReader<LSIRDY_A>;
177impl LSIRDY_R {
178 #[doc = "Get enumerated values variant"]
179 #[inline(always)]
180 pub fn variant(&self) -> LSIRDY_A {
181 match self.bits {
182 false => LSIRDY_A::NotReady,
183 true => LSIRDY_A::Ready,
184 }
185 }
186 #[doc = "Checks if the value of the field is `NotReady`"]
187 #[inline(always)]
188 pub fn is_not_ready(&self) -> bool {
189 *self == LSIRDY_A::NotReady
190 }
191 #[doc = "Checks if the value of the field is `Ready`"]
192 #[inline(always)]
193 pub fn is_ready(&self) -> bool {
194 *self == LSIRDY_A::Ready
195 }
196}
197#[doc = "Internal low-speed oscillator enable\n\nValue on reset: 0"]
198#[derive(Clone, Copy, Debug, PartialEq)]
199pub enum LSION_A {
200 #[doc = "0: LSI oscillator Off"]
201 Off = 0,
202 #[doc = "1: LSI oscillator On"]
203 On = 1,
204}
205impl From<LSION_A> for bool {
206 #[inline(always)]
207 fn from(variant: LSION_A) -> Self {
208 variant as u8 != 0
209 }
210}
211#[doc = "Field `LSION` reader - Internal low-speed oscillator enable"]
212pub type LSION_R = crate::BitReader<LSION_A>;
213impl LSION_R {
214 #[doc = "Get enumerated values variant"]
215 #[inline(always)]
216 pub fn variant(&self) -> LSION_A {
217 match self.bits {
218 false => LSION_A::Off,
219 true => LSION_A::On,
220 }
221 }
222 #[doc = "Checks if the value of the field is `Off`"]
223 #[inline(always)]
224 pub fn is_off(&self) -> bool {
225 *self == LSION_A::Off
226 }
227 #[doc = "Checks if the value of the field is `On`"]
228 #[inline(always)]
229 pub fn is_on(&self) -> bool {
230 *self == LSION_A::On
231 }
232}
233#[doc = "Field `LSION` writer - Internal low-speed oscillator enable"]
234pub type LSION_W<'a, const O: u8> = crate::BitWriter<'a, u32, CSR_SPEC, LSION_A, O>;
235impl<'a, const O: u8> LSION_W<'a, O> {
236 #[doc = "LSI oscillator Off"]
237 #[inline(always)]
238 pub fn off(self) -> &'a mut W {
239 self.variant(LSION_A::Off)
240 }
241 #[doc = "LSI oscillator On"]
242 #[inline(always)]
243 pub fn on(self) -> &'a mut W {
244 self.variant(LSION_A::On)
245 }
246}
247impl R {
248 #[doc = "Bit 31 - Low-power reset flag"]
249 #[inline(always)]
250 pub fn lpwrrstf(&self) -> LPWRRSTF_R {
251 LPWRRSTF_R::new(((self.bits >> 31) & 1) != 0)
252 }
253 #[doc = "Bit 30 - Window watchdog reset flag"]
254 #[inline(always)]
255 pub fn wwdgrstf(&self) -> WWDGRSTF_R {
256 WWDGRSTF_R::new(((self.bits >> 30) & 1) != 0)
257 }
258 #[doc = "Bit 29 - Independent watchdog reset flag"]
259 #[inline(always)]
260 pub fn wdgrstf(&self) -> WDGRSTF_R {
261 WDGRSTF_R::new(((self.bits >> 29) & 1) != 0)
262 }
263 #[doc = "Bit 28 - Software reset flag"]
264 #[inline(always)]
265 pub fn sftrstf(&self) -> SFTRSTF_R {
266 SFTRSTF_R::new(((self.bits >> 28) & 1) != 0)
267 }
268 #[doc = "Bit 27 - POR/PDR reset flag"]
269 #[inline(always)]
270 pub fn porrstf(&self) -> PORRSTF_R {
271 PORRSTF_R::new(((self.bits >> 27) & 1) != 0)
272 }
273 #[doc = "Bit 26 - PIN reset flag"]
274 #[inline(always)]
275 pub fn padrstf(&self) -> PADRSTF_R {
276 PADRSTF_R::new(((self.bits >> 26) & 1) != 0)
277 }
278 #[doc = "Bit 25 - BOR reset flag"]
279 #[inline(always)]
280 pub fn borrstf(&self) -> BORRSTF_R {
281 BORRSTF_R::new(((self.bits >> 25) & 1) != 0)
282 }
283 #[doc = "Bit 24 - Remove reset flag"]
284 #[inline(always)]
285 pub fn rmvf(&self) -> RMVF_R {
286 RMVF_R::new(((self.bits >> 24) & 1) != 0)
287 }
288 #[doc = "Bit 1 - Internal low-speed oscillator ready"]
289 #[inline(always)]
290 pub fn lsirdy(&self) -> LSIRDY_R {
291 LSIRDY_R::new(((self.bits >> 1) & 1) != 0)
292 }
293 #[doc = "Bit 0 - Internal low-speed oscillator enable"]
294 #[inline(always)]
295 pub fn lsion(&self) -> LSION_R {
296 LSION_R::new((self.bits & 1) != 0)
297 }
298}
299impl W {
300 #[doc = "Bit 31 - Low-power reset flag"]
301 #[inline(always)]
302 pub fn lpwrrstf(&mut self) -> LPWRRSTF_W<31> {
303 LPWRRSTF_W::new(self)
304 }
305 #[doc = "Bit 30 - Window watchdog reset flag"]
306 #[inline(always)]
307 pub fn wwdgrstf(&mut self) -> WWDGRSTF_W<30> {
308 WWDGRSTF_W::new(self)
309 }
310 #[doc = "Bit 29 - Independent watchdog reset flag"]
311 #[inline(always)]
312 pub fn wdgrstf(&mut self) -> WDGRSTF_W<29> {
313 WDGRSTF_W::new(self)
314 }
315 #[doc = "Bit 28 - Software reset flag"]
316 #[inline(always)]
317 pub fn sftrstf(&mut self) -> SFTRSTF_W<28> {
318 SFTRSTF_W::new(self)
319 }
320 #[doc = "Bit 27 - POR/PDR reset flag"]
321 #[inline(always)]
322 pub fn porrstf(&mut self) -> PORRSTF_W<27> {
323 PORRSTF_W::new(self)
324 }
325 #[doc = "Bit 26 - PIN reset flag"]
326 #[inline(always)]
327 pub fn padrstf(&mut self) -> PADRSTF_W<26> {
328 PADRSTF_W::new(self)
329 }
330 #[doc = "Bit 25 - BOR reset flag"]
331 #[inline(always)]
332 pub fn borrstf(&mut self) -> BORRSTF_W<25> {
333 BORRSTF_W::new(self)
334 }
335 #[doc = "Bit 24 - Remove reset flag"]
336 #[inline(always)]
337 pub fn rmvf(&mut self) -> RMVF_W<24> {
338 RMVF_W::new(self)
339 }
340 #[doc = "Bit 0 - Internal low-speed oscillator enable"]
341 #[inline(always)]
342 pub fn lsion(&mut self) -> LSION_W<0> {
343 LSION_W::new(self)
344 }
345 #[doc = "Writes raw bits to the register."]
346 #[inline(always)]
347 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
348 self.0.bits(bits);
349 self
350 }
351}
352#[doc = "clock control & status register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [csr](index.html) module"]
353pub struct CSR_SPEC;
354impl crate::RegisterSpec for CSR_SPEC {
355 type Ux = u32;
356}
357#[doc = "`read()` method returns [csr::R](R) reader structure"]
358impl crate::Readable for CSR_SPEC {
359 type Reader = R;
360}
361#[doc = "`write(|w| ..)` method takes [csr::W](W) writer structure"]
362impl crate::Writable for CSR_SPEC {
363 type Writer = W;
364}
365#[doc = "`reset()` method sets CSR to value 0x0e00_0000"]
366impl crate::Resettable for CSR_SPEC {
367 #[inline(always)]
368 fn reset_value() -> Self::Ux {
369 0x0e00_0000
370 }
371}