1#[doc = "Register `RESETREAS` reader"]
2pub struct R(crate::R<RESETREAS_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<RESETREAS_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<RESETREAS_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<RESETREAS_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `RESETREAS` writer"]
17pub struct W(crate::W<RESETREAS_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<RESETREAS_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<RESETREAS_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<RESETREAS_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `RESETPIN` reader - Reset from pin reset detected"]
38pub type RESETPIN_R = crate::BitReader<RESETPIN_A>;
39#[doc = "Reset from pin reset detected\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum RESETPIN_A {
42 #[doc = "0: Not detected"]
43 NOT_DETECTED = 0,
44 #[doc = "1: Detected"]
45 DETECTED = 1,
46}
47impl From<RESETPIN_A> for bool {
48 #[inline(always)]
49 fn from(variant: RESETPIN_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl RESETPIN_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> RESETPIN_A {
57 match self.bits {
58 false => RESETPIN_A::NOT_DETECTED,
59 true => RESETPIN_A::DETECTED,
60 }
61 }
62 #[doc = "Checks if the value of the field is `NOT_DETECTED`"]
63 #[inline(always)]
64 pub fn is_not_detected(&self) -> bool {
65 *self == RESETPIN_A::NOT_DETECTED
66 }
67 #[doc = "Checks if the value of the field is `DETECTED`"]
68 #[inline(always)]
69 pub fn is_detected(&self) -> bool {
70 *self == RESETPIN_A::DETECTED
71 }
72}
73#[doc = "Field `RESETPIN` writer - Reset from pin reset detected"]
74pub type RESETPIN_W<'a, const O: u8> = crate::BitWriter<'a, u32, RESETREAS_SPEC, RESETPIN_A, O>;
75impl<'a, const O: u8> RESETPIN_W<'a, O> {
76 #[doc = "Not detected"]
77 #[inline(always)]
78 pub fn not_detected(self) -> &'a mut W {
79 self.variant(RESETPIN_A::NOT_DETECTED)
80 }
81 #[doc = "Detected"]
82 #[inline(always)]
83 pub fn detected(self) -> &'a mut W {
84 self.variant(RESETPIN_A::DETECTED)
85 }
86}
87#[doc = "Field `DOG` reader - Reset from global watchdog detected"]
88pub type DOG_R = crate::BitReader<DOG_A>;
89#[doc = "Reset from global watchdog detected\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq)]
91pub enum DOG_A {
92 #[doc = "0: Not detected"]
93 NOT_DETECTED = 0,
94 #[doc = "1: Detected"]
95 DETECTED = 1,
96}
97impl From<DOG_A> for bool {
98 #[inline(always)]
99 fn from(variant: DOG_A) -> Self {
100 variant as u8 != 0
101 }
102}
103impl DOG_R {
104 #[doc = "Get enumerated values variant"]
105 #[inline(always)]
106 pub fn variant(&self) -> DOG_A {
107 match self.bits {
108 false => DOG_A::NOT_DETECTED,
109 true => DOG_A::DETECTED,
110 }
111 }
112 #[doc = "Checks if the value of the field is `NOT_DETECTED`"]
113 #[inline(always)]
114 pub fn is_not_detected(&self) -> bool {
115 *self == DOG_A::NOT_DETECTED
116 }
117 #[doc = "Checks if the value of the field is `DETECTED`"]
118 #[inline(always)]
119 pub fn is_detected(&self) -> bool {
120 *self == DOG_A::DETECTED
121 }
122}
123#[doc = "Field `DOG` writer - Reset from global watchdog detected"]
124pub type DOG_W<'a, const O: u8> = crate::BitWriter<'a, u32, RESETREAS_SPEC, DOG_A, O>;
125impl<'a, const O: u8> DOG_W<'a, O> {
126 #[doc = "Not detected"]
127 #[inline(always)]
128 pub fn not_detected(self) -> &'a mut W {
129 self.variant(DOG_A::NOT_DETECTED)
130 }
131 #[doc = "Detected"]
132 #[inline(always)]
133 pub fn detected(self) -> &'a mut W {
134 self.variant(DOG_A::DETECTED)
135 }
136}
137#[doc = "Field `OFF` reader - Reset due to wakeup from System OFF mode, when wakeup is triggered by DETECT signal from GPIO"]
138pub type OFF_R = crate::BitReader<OFF_A>;
139#[doc = "Reset due to wakeup from System OFF mode, when wakeup is triggered by DETECT signal from GPIO\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq)]
141pub enum OFF_A {
142 #[doc = "0: Not detected"]
143 NOT_DETECTED = 0,
144 #[doc = "1: Detected"]
145 DETECTED = 1,
146}
147impl From<OFF_A> for bool {
148 #[inline(always)]
149 fn from(variant: OFF_A) -> Self {
150 variant as u8 != 0
151 }
152}
153impl OFF_R {
154 #[doc = "Get enumerated values variant"]
155 #[inline(always)]
156 pub fn variant(&self) -> OFF_A {
157 match self.bits {
158 false => OFF_A::NOT_DETECTED,
159 true => OFF_A::DETECTED,
160 }
161 }
162 #[doc = "Checks if the value of the field is `NOT_DETECTED`"]
163 #[inline(always)]
164 pub fn is_not_detected(&self) -> bool {
165 *self == OFF_A::NOT_DETECTED
166 }
167 #[doc = "Checks if the value of the field is `DETECTED`"]
168 #[inline(always)]
169 pub fn is_detected(&self) -> bool {
170 *self == OFF_A::DETECTED
171 }
172}
173#[doc = "Field `OFF` writer - Reset due to wakeup from System OFF mode, when wakeup is triggered by DETECT signal from GPIO"]
174pub type OFF_W<'a, const O: u8> = crate::BitWriter<'a, u32, RESETREAS_SPEC, OFF_A, O>;
175impl<'a, const O: u8> OFF_W<'a, O> {
176 #[doc = "Not detected"]
177 #[inline(always)]
178 pub fn not_detected(self) -> &'a mut W {
179 self.variant(OFF_A::NOT_DETECTED)
180 }
181 #[doc = "Detected"]
182 #[inline(always)]
183 pub fn detected(self) -> &'a mut W {
184 self.variant(OFF_A::DETECTED)
185 }
186}
187#[doc = "Field `DIF` reader - Reset due to wakeup from System OFF mode, when wakeup is triggered by entering debug interface mode"]
188pub type DIF_R = crate::BitReader<DIF_A>;
189#[doc = "Reset due to wakeup from System OFF mode, when wakeup is triggered by entering debug interface mode\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq)]
191pub enum DIF_A {
192 #[doc = "0: Not detected"]
193 NOT_DETECTED = 0,
194 #[doc = "1: Detected"]
195 DETECTED = 1,
196}
197impl From<DIF_A> for bool {
198 #[inline(always)]
199 fn from(variant: DIF_A) -> Self {
200 variant as u8 != 0
201 }
202}
203impl DIF_R {
204 #[doc = "Get enumerated values variant"]
205 #[inline(always)]
206 pub fn variant(&self) -> DIF_A {
207 match self.bits {
208 false => DIF_A::NOT_DETECTED,
209 true => DIF_A::DETECTED,
210 }
211 }
212 #[doc = "Checks if the value of the field is `NOT_DETECTED`"]
213 #[inline(always)]
214 pub fn is_not_detected(&self) -> bool {
215 *self == DIF_A::NOT_DETECTED
216 }
217 #[doc = "Checks if the value of the field is `DETECTED`"]
218 #[inline(always)]
219 pub fn is_detected(&self) -> bool {
220 *self == DIF_A::DETECTED
221 }
222}
223#[doc = "Field `DIF` writer - Reset due to wakeup from System OFF mode, when wakeup is triggered by entering debug interface mode"]
224pub type DIF_W<'a, const O: u8> = crate::BitWriter<'a, u32, RESETREAS_SPEC, DIF_A, O>;
225impl<'a, const O: u8> DIF_W<'a, O> {
226 #[doc = "Not detected"]
227 #[inline(always)]
228 pub fn not_detected(self) -> &'a mut W {
229 self.variant(DIF_A::NOT_DETECTED)
230 }
231 #[doc = "Detected"]
232 #[inline(always)]
233 pub fn detected(self) -> &'a mut W {
234 self.variant(DIF_A::DETECTED)
235 }
236}
237#[doc = "Field `SREQ` reader - Reset from AIRCR.SYSRESETREQ detected"]
238pub type SREQ_R = crate::BitReader<SREQ_A>;
239#[doc = "Reset from AIRCR.SYSRESETREQ detected\n\nValue on reset: 0"]
240#[derive(Clone, Copy, Debug, PartialEq)]
241pub enum SREQ_A {
242 #[doc = "0: Not detected"]
243 NOT_DETECTED = 0,
244 #[doc = "1: Detected"]
245 DETECTED = 1,
246}
247impl From<SREQ_A> for bool {
248 #[inline(always)]
249 fn from(variant: SREQ_A) -> Self {
250 variant as u8 != 0
251 }
252}
253impl SREQ_R {
254 #[doc = "Get enumerated values variant"]
255 #[inline(always)]
256 pub fn variant(&self) -> SREQ_A {
257 match self.bits {
258 false => SREQ_A::NOT_DETECTED,
259 true => SREQ_A::DETECTED,
260 }
261 }
262 #[doc = "Checks if the value of the field is `NOT_DETECTED`"]
263 #[inline(always)]
264 pub fn is_not_detected(&self) -> bool {
265 *self == SREQ_A::NOT_DETECTED
266 }
267 #[doc = "Checks if the value of the field is `DETECTED`"]
268 #[inline(always)]
269 pub fn is_detected(&self) -> bool {
270 *self == SREQ_A::DETECTED
271 }
272}
273#[doc = "Field `SREQ` writer - Reset from AIRCR.SYSRESETREQ detected"]
274pub type SREQ_W<'a, const O: u8> = crate::BitWriter<'a, u32, RESETREAS_SPEC, SREQ_A, O>;
275impl<'a, const O: u8> SREQ_W<'a, O> {
276 #[doc = "Not detected"]
277 #[inline(always)]
278 pub fn not_detected(self) -> &'a mut W {
279 self.variant(SREQ_A::NOT_DETECTED)
280 }
281 #[doc = "Detected"]
282 #[inline(always)]
283 pub fn detected(self) -> &'a mut W {
284 self.variant(SREQ_A::DETECTED)
285 }
286}
287#[doc = "Field `LOCKUP` reader - Reset from CPU lock-up detected"]
288pub type LOCKUP_R = crate::BitReader<LOCKUP_A>;
289#[doc = "Reset from CPU lock-up detected\n\nValue on reset: 0"]
290#[derive(Clone, Copy, Debug, PartialEq)]
291pub enum LOCKUP_A {
292 #[doc = "0: Not detected"]
293 NOT_DETECTED = 0,
294 #[doc = "1: Detected"]
295 DETECTED = 1,
296}
297impl From<LOCKUP_A> for bool {
298 #[inline(always)]
299 fn from(variant: LOCKUP_A) -> Self {
300 variant as u8 != 0
301 }
302}
303impl LOCKUP_R {
304 #[doc = "Get enumerated values variant"]
305 #[inline(always)]
306 pub fn variant(&self) -> LOCKUP_A {
307 match self.bits {
308 false => LOCKUP_A::NOT_DETECTED,
309 true => LOCKUP_A::DETECTED,
310 }
311 }
312 #[doc = "Checks if the value of the field is `NOT_DETECTED`"]
313 #[inline(always)]
314 pub fn is_not_detected(&self) -> bool {
315 *self == LOCKUP_A::NOT_DETECTED
316 }
317 #[doc = "Checks if the value of the field is `DETECTED`"]
318 #[inline(always)]
319 pub fn is_detected(&self) -> bool {
320 *self == LOCKUP_A::DETECTED
321 }
322}
323#[doc = "Field `LOCKUP` writer - Reset from CPU lock-up detected"]
324pub type LOCKUP_W<'a, const O: u8> = crate::BitWriter<'a, u32, RESETREAS_SPEC, LOCKUP_A, O>;
325impl<'a, const O: u8> LOCKUP_W<'a, O> {
326 #[doc = "Not detected"]
327 #[inline(always)]
328 pub fn not_detected(self) -> &'a mut W {
329 self.variant(LOCKUP_A::NOT_DETECTED)
330 }
331 #[doc = "Detected"]
332 #[inline(always)]
333 pub fn detected(self) -> &'a mut W {
334 self.variant(LOCKUP_A::DETECTED)
335 }
336}
337#[doc = "Field `CTRLAP` reader - Reset triggered through CTRL-AP"]
338pub type CTRLAP_R = crate::BitReader<CTRLAP_A>;
339#[doc = "Reset triggered through CTRL-AP\n\nValue on reset: 0"]
340#[derive(Clone, Copy, Debug, PartialEq)]
341pub enum CTRLAP_A {
342 #[doc = "0: Not detected"]
343 NOT_DETECTED = 0,
344 #[doc = "1: Detected"]
345 DETECTED = 1,
346}
347impl From<CTRLAP_A> for bool {
348 #[inline(always)]
349 fn from(variant: CTRLAP_A) -> Self {
350 variant as u8 != 0
351 }
352}
353impl CTRLAP_R {
354 #[doc = "Get enumerated values variant"]
355 #[inline(always)]
356 pub fn variant(&self) -> CTRLAP_A {
357 match self.bits {
358 false => CTRLAP_A::NOT_DETECTED,
359 true => CTRLAP_A::DETECTED,
360 }
361 }
362 #[doc = "Checks if the value of the field is `NOT_DETECTED`"]
363 #[inline(always)]
364 pub fn is_not_detected(&self) -> bool {
365 *self == CTRLAP_A::NOT_DETECTED
366 }
367 #[doc = "Checks if the value of the field is `DETECTED`"]
368 #[inline(always)]
369 pub fn is_detected(&self) -> bool {
370 *self == CTRLAP_A::DETECTED
371 }
372}
373#[doc = "Field `CTRLAP` writer - Reset triggered through CTRL-AP"]
374pub type CTRLAP_W<'a, const O: u8> = crate::BitWriter<'a, u32, RESETREAS_SPEC, CTRLAP_A, O>;
375impl<'a, const O: u8> CTRLAP_W<'a, O> {
376 #[doc = "Not detected"]
377 #[inline(always)]
378 pub fn not_detected(self) -> &'a mut W {
379 self.variant(CTRLAP_A::NOT_DETECTED)
380 }
381 #[doc = "Detected"]
382 #[inline(always)]
383 pub fn detected(self) -> &'a mut W {
384 self.variant(CTRLAP_A::DETECTED)
385 }
386}
387impl R {
388 #[doc = "Bit 0 - Reset from pin reset detected"]
389 #[inline(always)]
390 pub fn resetpin(&self) -> RESETPIN_R {
391 RESETPIN_R::new((self.bits & 1) != 0)
392 }
393 #[doc = "Bit 1 - Reset from global watchdog detected"]
394 #[inline(always)]
395 pub fn dog(&self) -> DOG_R {
396 DOG_R::new(((self.bits >> 1) & 1) != 0)
397 }
398 #[doc = "Bit 2 - Reset due to wakeup from System OFF mode, when wakeup is triggered by DETECT signal from GPIO"]
399 #[inline(always)]
400 pub fn off(&self) -> OFF_R {
401 OFF_R::new(((self.bits >> 2) & 1) != 0)
402 }
403 #[doc = "Bit 4 - Reset due to wakeup from System OFF mode, when wakeup is triggered by entering debug interface mode"]
404 #[inline(always)]
405 pub fn dif(&self) -> DIF_R {
406 DIF_R::new(((self.bits >> 4) & 1) != 0)
407 }
408 #[doc = "Bit 16 - Reset from AIRCR.SYSRESETREQ detected"]
409 #[inline(always)]
410 pub fn sreq(&self) -> SREQ_R {
411 SREQ_R::new(((self.bits >> 16) & 1) != 0)
412 }
413 #[doc = "Bit 17 - Reset from CPU lock-up detected"]
414 #[inline(always)]
415 pub fn lockup(&self) -> LOCKUP_R {
416 LOCKUP_R::new(((self.bits >> 17) & 1) != 0)
417 }
418 #[doc = "Bit 18 - Reset triggered through CTRL-AP"]
419 #[inline(always)]
420 pub fn ctrlap(&self) -> CTRLAP_R {
421 CTRLAP_R::new(((self.bits >> 18) & 1) != 0)
422 }
423}
424impl W {
425 #[doc = "Bit 0 - Reset from pin reset detected"]
426 #[inline(always)]
427 pub fn resetpin(&mut self) -> RESETPIN_W<0> {
428 RESETPIN_W::new(self)
429 }
430 #[doc = "Bit 1 - Reset from global watchdog detected"]
431 #[inline(always)]
432 pub fn dog(&mut self) -> DOG_W<1> {
433 DOG_W::new(self)
434 }
435 #[doc = "Bit 2 - Reset due to wakeup from System OFF mode, when wakeup is triggered by DETECT signal from GPIO"]
436 #[inline(always)]
437 pub fn off(&mut self) -> OFF_W<2> {
438 OFF_W::new(self)
439 }
440 #[doc = "Bit 4 - Reset due to wakeup from System OFF mode, when wakeup is triggered by entering debug interface mode"]
441 #[inline(always)]
442 pub fn dif(&mut self) -> DIF_W<4> {
443 DIF_W::new(self)
444 }
445 #[doc = "Bit 16 - Reset from AIRCR.SYSRESETREQ detected"]
446 #[inline(always)]
447 pub fn sreq(&mut self) -> SREQ_W<16> {
448 SREQ_W::new(self)
449 }
450 #[doc = "Bit 17 - Reset from CPU lock-up detected"]
451 #[inline(always)]
452 pub fn lockup(&mut self) -> LOCKUP_W<17> {
453 LOCKUP_W::new(self)
454 }
455 #[doc = "Bit 18 - Reset triggered through CTRL-AP"]
456 #[inline(always)]
457 pub fn ctrlap(&mut self) -> CTRLAP_W<18> {
458 CTRLAP_W::new(self)
459 }
460 #[doc = "Writes raw bits to the register."]
461 #[inline(always)]
462 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
463 self.0.bits(bits);
464 self
465 }
466}
467#[doc = "Reset reason\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 [resetreas](index.html) module"]
468pub struct RESETREAS_SPEC;
469impl crate::RegisterSpec for RESETREAS_SPEC {
470 type Ux = u32;
471}
472#[doc = "`read()` method returns [resetreas::R](R) reader structure"]
473impl crate::Readable for RESETREAS_SPEC {
474 type Reader = R;
475}
476#[doc = "`write(|w| ..)` method takes [resetreas::W](W) writer structure"]
477impl crate::Writable for RESETREAS_SPEC {
478 type Writer = W;
479}
480#[doc = "`reset()` method sets RESETREAS to value 0"]
481impl crate::Resettable for RESETREAS_SPEC {
482 #[inline(always)]
483 fn reset_value() -> Self::Ux {
484 0
485 }
486}