nrf52832_pac/power/
resetreas.rs

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 watchdog detected"]
88pub type DOG_R = crate::BitReader<DOG_A>;
89#[doc = "Reset from 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 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 `SREQ` reader - Reset from soft reset detected"]
138pub type SREQ_R = crate::BitReader<SREQ_A>;
139#[doc = "Reset from soft reset detected\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq)]
141pub enum SREQ_A {
142    #[doc = "0: Not detected"]
143    NOT_DETECTED = 0,
144    #[doc = "1: Detected"]
145    DETECTED = 1,
146}
147impl From<SREQ_A> for bool {
148    #[inline(always)]
149    fn from(variant: SREQ_A) -> Self {
150        variant as u8 != 0
151    }
152}
153impl SREQ_R {
154    #[doc = "Get enumerated values variant"]
155    #[inline(always)]
156    pub fn variant(&self) -> SREQ_A {
157        match self.bits {
158            false => SREQ_A::NOT_DETECTED,
159            true => SREQ_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 == SREQ_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 == SREQ_A::DETECTED
171    }
172}
173#[doc = "Field `SREQ` writer - Reset from soft reset detected"]
174pub type SREQ_W<'a, const O: u8> = crate::BitWriter<'a, u32, RESETREAS_SPEC, SREQ_A, O>;
175impl<'a, const O: u8> SREQ_W<'a, O> {
176    #[doc = "Not detected"]
177    #[inline(always)]
178    pub fn not_detected(self) -> &'a mut W {
179        self.variant(SREQ_A::NOT_DETECTED)
180    }
181    #[doc = "Detected"]
182    #[inline(always)]
183    pub fn detected(self) -> &'a mut W {
184        self.variant(SREQ_A::DETECTED)
185    }
186}
187#[doc = "Field `LOCKUP` reader - Reset from CPU lock-up detected"]
188pub type LOCKUP_R = crate::BitReader<LOCKUP_A>;
189#[doc = "Reset from CPU lock-up detected\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq)]
191pub enum LOCKUP_A {
192    #[doc = "0: Not detected"]
193    NOT_DETECTED = 0,
194    #[doc = "1: Detected"]
195    DETECTED = 1,
196}
197impl From<LOCKUP_A> for bool {
198    #[inline(always)]
199    fn from(variant: LOCKUP_A) -> Self {
200        variant as u8 != 0
201    }
202}
203impl LOCKUP_R {
204    #[doc = "Get enumerated values variant"]
205    #[inline(always)]
206    pub fn variant(&self) -> LOCKUP_A {
207        match self.bits {
208            false => LOCKUP_A::NOT_DETECTED,
209            true => LOCKUP_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 == LOCKUP_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 == LOCKUP_A::DETECTED
221    }
222}
223#[doc = "Field `LOCKUP` writer - Reset from CPU lock-up detected"]
224pub type LOCKUP_W<'a, const O: u8> = crate::BitWriter<'a, u32, RESETREAS_SPEC, LOCKUP_A, O>;
225impl<'a, const O: u8> LOCKUP_W<'a, O> {
226    #[doc = "Not detected"]
227    #[inline(always)]
228    pub fn not_detected(self) -> &'a mut W {
229        self.variant(LOCKUP_A::NOT_DETECTED)
230    }
231    #[doc = "Detected"]
232    #[inline(always)]
233    pub fn detected(self) -> &'a mut W {
234        self.variant(LOCKUP_A::DETECTED)
235    }
236}
237#[doc = "Field `OFF` reader - Reset due to wake up from System OFF mode when wakeup is triggered from DETECT signal from GPIO"]
238pub type OFF_R = crate::BitReader<OFF_A>;
239#[doc = "Reset due to wake up from System OFF mode when wakeup is triggered from DETECT signal from GPIO\n\nValue on reset: 0"]
240#[derive(Clone, Copy, Debug, PartialEq)]
241pub enum OFF_A {
242    #[doc = "0: Not detected"]
243    NOT_DETECTED = 0,
244    #[doc = "1: Detected"]
245    DETECTED = 1,
246}
247impl From<OFF_A> for bool {
248    #[inline(always)]
249    fn from(variant: OFF_A) -> Self {
250        variant as u8 != 0
251    }
252}
253impl OFF_R {
254    #[doc = "Get enumerated values variant"]
255    #[inline(always)]
256    pub fn variant(&self) -> OFF_A {
257        match self.bits {
258            false => OFF_A::NOT_DETECTED,
259            true => OFF_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 == OFF_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 == OFF_A::DETECTED
271    }
272}
273#[doc = "Field `OFF` writer - Reset due to wake up from System OFF mode when wakeup is triggered from DETECT signal from GPIO"]
274pub type OFF_W<'a, const O: u8> = crate::BitWriter<'a, u32, RESETREAS_SPEC, OFF_A, O>;
275impl<'a, const O: u8> OFF_W<'a, O> {
276    #[doc = "Not detected"]
277    #[inline(always)]
278    pub fn not_detected(self) -> &'a mut W {
279        self.variant(OFF_A::NOT_DETECTED)
280    }
281    #[doc = "Detected"]
282    #[inline(always)]
283    pub fn detected(self) -> &'a mut W {
284        self.variant(OFF_A::DETECTED)
285    }
286}
287#[doc = "Field `LPCOMP` reader - Reset due to wake up from System OFF mode when wakeup is triggered from ANADETECT signal from LPCOMP"]
288pub type LPCOMP_R = crate::BitReader<LPCOMP_A>;
289#[doc = "Reset due to wake up from System OFF mode when wakeup is triggered from ANADETECT signal from LPCOMP\n\nValue on reset: 0"]
290#[derive(Clone, Copy, Debug, PartialEq)]
291pub enum LPCOMP_A {
292    #[doc = "0: Not detected"]
293    NOT_DETECTED = 0,
294    #[doc = "1: Detected"]
295    DETECTED = 1,
296}
297impl From<LPCOMP_A> for bool {
298    #[inline(always)]
299    fn from(variant: LPCOMP_A) -> Self {
300        variant as u8 != 0
301    }
302}
303impl LPCOMP_R {
304    #[doc = "Get enumerated values variant"]
305    #[inline(always)]
306    pub fn variant(&self) -> LPCOMP_A {
307        match self.bits {
308            false => LPCOMP_A::NOT_DETECTED,
309            true => LPCOMP_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 == LPCOMP_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 == LPCOMP_A::DETECTED
321    }
322}
323#[doc = "Field `LPCOMP` writer - Reset due to wake up from System OFF mode when wakeup is triggered from ANADETECT signal from LPCOMP"]
324pub type LPCOMP_W<'a, const O: u8> = crate::BitWriter<'a, u32, RESETREAS_SPEC, LPCOMP_A, O>;
325impl<'a, const O: u8> LPCOMP_W<'a, O> {
326    #[doc = "Not detected"]
327    #[inline(always)]
328    pub fn not_detected(self) -> &'a mut W {
329        self.variant(LPCOMP_A::NOT_DETECTED)
330    }
331    #[doc = "Detected"]
332    #[inline(always)]
333    pub fn detected(self) -> &'a mut W {
334        self.variant(LPCOMP_A::DETECTED)
335    }
336}
337#[doc = "Field `DIF` reader - Reset due to wake up from System OFF mode when wakeup is triggered from entering into debug interface mode"]
338pub type DIF_R = crate::BitReader<DIF_A>;
339#[doc = "Reset due to wake up from System OFF mode when wakeup is triggered from entering into debug interface mode\n\nValue on reset: 0"]
340#[derive(Clone, Copy, Debug, PartialEq)]
341pub enum DIF_A {
342    #[doc = "0: Not detected"]
343    NOT_DETECTED = 0,
344    #[doc = "1: Detected"]
345    DETECTED = 1,
346}
347impl From<DIF_A> for bool {
348    #[inline(always)]
349    fn from(variant: DIF_A) -> Self {
350        variant as u8 != 0
351    }
352}
353impl DIF_R {
354    #[doc = "Get enumerated values variant"]
355    #[inline(always)]
356    pub fn variant(&self) -> DIF_A {
357        match self.bits {
358            false => DIF_A::NOT_DETECTED,
359            true => DIF_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 == DIF_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 == DIF_A::DETECTED
371    }
372}
373#[doc = "Field `DIF` writer - Reset due to wake up from System OFF mode when wakeup is triggered from entering into debug interface mode"]
374pub type DIF_W<'a, const O: u8> = crate::BitWriter<'a, u32, RESETREAS_SPEC, DIF_A, O>;
375impl<'a, const O: u8> DIF_W<'a, O> {
376    #[doc = "Not detected"]
377    #[inline(always)]
378    pub fn not_detected(self) -> &'a mut W {
379        self.variant(DIF_A::NOT_DETECTED)
380    }
381    #[doc = "Detected"]
382    #[inline(always)]
383    pub fn detected(self) -> &'a mut W {
384        self.variant(DIF_A::DETECTED)
385    }
386}
387#[doc = "Field `NFC` reader - Reset due to wake up from System OFF mode by NFC field detect"]
388pub type NFC_R = crate::BitReader<NFC_A>;
389#[doc = "Reset due to wake up from System OFF mode by NFC field detect\n\nValue on reset: 0"]
390#[derive(Clone, Copy, Debug, PartialEq)]
391pub enum NFC_A {
392    #[doc = "0: Not detected"]
393    NOT_DETECTED = 0,
394    #[doc = "1: Detected"]
395    DETECTED = 1,
396}
397impl From<NFC_A> for bool {
398    #[inline(always)]
399    fn from(variant: NFC_A) -> Self {
400        variant as u8 != 0
401    }
402}
403impl NFC_R {
404    #[doc = "Get enumerated values variant"]
405    #[inline(always)]
406    pub fn variant(&self) -> NFC_A {
407        match self.bits {
408            false => NFC_A::NOT_DETECTED,
409            true => NFC_A::DETECTED,
410        }
411    }
412    #[doc = "Checks if the value of the field is `NOT_DETECTED`"]
413    #[inline(always)]
414    pub fn is_not_detected(&self) -> bool {
415        *self == NFC_A::NOT_DETECTED
416    }
417    #[doc = "Checks if the value of the field is `DETECTED`"]
418    #[inline(always)]
419    pub fn is_detected(&self) -> bool {
420        *self == NFC_A::DETECTED
421    }
422}
423#[doc = "Field `NFC` writer - Reset due to wake up from System OFF mode by NFC field detect"]
424pub type NFC_W<'a, const O: u8> = crate::BitWriter<'a, u32, RESETREAS_SPEC, NFC_A, O>;
425impl<'a, const O: u8> NFC_W<'a, O> {
426    #[doc = "Not detected"]
427    #[inline(always)]
428    pub fn not_detected(self) -> &'a mut W {
429        self.variant(NFC_A::NOT_DETECTED)
430    }
431    #[doc = "Detected"]
432    #[inline(always)]
433    pub fn detected(self) -> &'a mut W {
434        self.variant(NFC_A::DETECTED)
435    }
436}
437impl R {
438    #[doc = "Bit 0 - Reset from pin-reset detected"]
439    #[inline(always)]
440    pub fn resetpin(&self) -> RESETPIN_R {
441        RESETPIN_R::new((self.bits & 1) != 0)
442    }
443    #[doc = "Bit 1 - Reset from watchdog detected"]
444    #[inline(always)]
445    pub fn dog(&self) -> DOG_R {
446        DOG_R::new(((self.bits >> 1) & 1) != 0)
447    }
448    #[doc = "Bit 2 - Reset from soft reset detected"]
449    #[inline(always)]
450    pub fn sreq(&self) -> SREQ_R {
451        SREQ_R::new(((self.bits >> 2) & 1) != 0)
452    }
453    #[doc = "Bit 3 - Reset from CPU lock-up detected"]
454    #[inline(always)]
455    pub fn lockup(&self) -> LOCKUP_R {
456        LOCKUP_R::new(((self.bits >> 3) & 1) != 0)
457    }
458    #[doc = "Bit 16 - Reset due to wake up from System OFF mode when wakeup is triggered from DETECT signal from GPIO"]
459    #[inline(always)]
460    pub fn off(&self) -> OFF_R {
461        OFF_R::new(((self.bits >> 16) & 1) != 0)
462    }
463    #[doc = "Bit 17 - Reset due to wake up from System OFF mode when wakeup is triggered from ANADETECT signal from LPCOMP"]
464    #[inline(always)]
465    pub fn lpcomp(&self) -> LPCOMP_R {
466        LPCOMP_R::new(((self.bits >> 17) & 1) != 0)
467    }
468    #[doc = "Bit 18 - Reset due to wake up from System OFF mode when wakeup is triggered from entering into debug interface mode"]
469    #[inline(always)]
470    pub fn dif(&self) -> DIF_R {
471        DIF_R::new(((self.bits >> 18) & 1) != 0)
472    }
473    #[doc = "Bit 19 - Reset due to wake up from System OFF mode by NFC field detect"]
474    #[inline(always)]
475    pub fn nfc(&self) -> NFC_R {
476        NFC_R::new(((self.bits >> 19) & 1) != 0)
477    }
478}
479impl W {
480    #[doc = "Bit 0 - Reset from pin-reset detected"]
481    #[inline(always)]
482    pub fn resetpin(&mut self) -> RESETPIN_W<0> {
483        RESETPIN_W::new(self)
484    }
485    #[doc = "Bit 1 - Reset from watchdog detected"]
486    #[inline(always)]
487    pub fn dog(&mut self) -> DOG_W<1> {
488        DOG_W::new(self)
489    }
490    #[doc = "Bit 2 - Reset from soft reset detected"]
491    #[inline(always)]
492    pub fn sreq(&mut self) -> SREQ_W<2> {
493        SREQ_W::new(self)
494    }
495    #[doc = "Bit 3 - Reset from CPU lock-up detected"]
496    #[inline(always)]
497    pub fn lockup(&mut self) -> LOCKUP_W<3> {
498        LOCKUP_W::new(self)
499    }
500    #[doc = "Bit 16 - Reset due to wake up from System OFF mode when wakeup is triggered from DETECT signal from GPIO"]
501    #[inline(always)]
502    pub fn off(&mut self) -> OFF_W<16> {
503        OFF_W::new(self)
504    }
505    #[doc = "Bit 17 - Reset due to wake up from System OFF mode when wakeup is triggered from ANADETECT signal from LPCOMP"]
506    #[inline(always)]
507    pub fn lpcomp(&mut self) -> LPCOMP_W<17> {
508        LPCOMP_W::new(self)
509    }
510    #[doc = "Bit 18 - Reset due to wake up from System OFF mode when wakeup is triggered from entering into debug interface mode"]
511    #[inline(always)]
512    pub fn dif(&mut self) -> DIF_W<18> {
513        DIF_W::new(self)
514    }
515    #[doc = "Bit 19 - Reset due to wake up from System OFF mode by NFC field detect"]
516    #[inline(always)]
517    pub fn nfc(&mut self) -> NFC_W<19> {
518        NFC_W::new(self)
519    }
520    #[doc = "Writes raw bits to the register."]
521    #[inline(always)]
522    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
523        self.0.bits(bits);
524        self
525    }
526}
527#[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"]
528pub struct RESETREAS_SPEC;
529impl crate::RegisterSpec for RESETREAS_SPEC {
530    type Ux = u32;
531}
532#[doc = "`read()` method returns [resetreas::R](R) reader structure"]
533impl crate::Readable for RESETREAS_SPEC {
534    type Reader = R;
535}
536#[doc = "`write(|w| ..)` method takes [resetreas::W](W) writer structure"]
537impl crate::Writable for RESETREAS_SPEC {
538    type Writer = W;
539}
540#[doc = "`reset()` method sets RESETREAS to value 0"]
541impl crate::Resettable for RESETREAS_SPEC {
542    #[inline(always)]
543    fn reset_value() -> Self::Ux {
544        0
545    }
546}