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 `DIF` reader - Reset due to wake up from System OFF mode when wakeup is triggered from entering into debug interface mode"]
288pub type DIF_R = crate::BitReader<DIF_A>;
289#[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"]
290#[derive(Clone, Copy, Debug, PartialEq)]
291pub enum DIF_A {
292    #[doc = "0: Not detected"]
293    NOT_DETECTED = 0,
294    #[doc = "1: Detected"]
295    DETECTED = 1,
296}
297impl From<DIF_A> for bool {
298    #[inline(always)]
299    fn from(variant: DIF_A) -> Self {
300        variant as u8 != 0
301    }
302}
303impl DIF_R {
304    #[doc = "Get enumerated values variant"]
305    #[inline(always)]
306    pub fn variant(&self) -> DIF_A {
307        match self.bits {
308            false => DIF_A::NOT_DETECTED,
309            true => DIF_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 == DIF_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 == DIF_A::DETECTED
321    }
322}
323#[doc = "Field `DIF` writer - Reset due to wake up from System OFF mode when wakeup is triggered from entering into debug interface mode"]
324pub type DIF_W<'a, const O: u8> = crate::BitWriter<'a, u32, RESETREAS_SPEC, DIF_A, O>;
325impl<'a, const O: u8> DIF_W<'a, O> {
326    #[doc = "Not detected"]
327    #[inline(always)]
328    pub fn not_detected(self) -> &'a mut W {
329        self.variant(DIF_A::NOT_DETECTED)
330    }
331    #[doc = "Detected"]
332    #[inline(always)]
333    pub fn detected(self) -> &'a mut W {
334        self.variant(DIF_A::DETECTED)
335    }
336}
337impl R {
338    #[doc = "Bit 0 - Reset from pin-reset detected"]
339    #[inline(always)]
340    pub fn resetpin(&self) -> RESETPIN_R {
341        RESETPIN_R::new((self.bits & 1) != 0)
342    }
343    #[doc = "Bit 1 - Reset from watchdog detected"]
344    #[inline(always)]
345    pub fn dog(&self) -> DOG_R {
346        DOG_R::new(((self.bits >> 1) & 1) != 0)
347    }
348    #[doc = "Bit 2 - Reset from soft reset detected"]
349    #[inline(always)]
350    pub fn sreq(&self) -> SREQ_R {
351        SREQ_R::new(((self.bits >> 2) & 1) != 0)
352    }
353    #[doc = "Bit 3 - Reset from CPU lock-up detected"]
354    #[inline(always)]
355    pub fn lockup(&self) -> LOCKUP_R {
356        LOCKUP_R::new(((self.bits >> 3) & 1) != 0)
357    }
358    #[doc = "Bit 16 - Reset due to wake up from System OFF mode when wakeup is triggered from DETECT signal from GPIO"]
359    #[inline(always)]
360    pub fn off(&self) -> OFF_R {
361        OFF_R::new(((self.bits >> 16) & 1) != 0)
362    }
363    #[doc = "Bit 18 - Reset due to wake up from System OFF mode when wakeup is triggered from entering into debug interface mode"]
364    #[inline(always)]
365    pub fn dif(&self) -> DIF_R {
366        DIF_R::new(((self.bits >> 18) & 1) != 0)
367    }
368}
369impl W {
370    #[doc = "Bit 0 - Reset from pin-reset detected"]
371    #[inline(always)]
372    pub fn resetpin(&mut self) -> RESETPIN_W<0> {
373        RESETPIN_W::new(self)
374    }
375    #[doc = "Bit 1 - Reset from watchdog detected"]
376    #[inline(always)]
377    pub fn dog(&mut self) -> DOG_W<1> {
378        DOG_W::new(self)
379    }
380    #[doc = "Bit 2 - Reset from soft reset detected"]
381    #[inline(always)]
382    pub fn sreq(&mut self) -> SREQ_W<2> {
383        SREQ_W::new(self)
384    }
385    #[doc = "Bit 3 - Reset from CPU lock-up detected"]
386    #[inline(always)]
387    pub fn lockup(&mut self) -> LOCKUP_W<3> {
388        LOCKUP_W::new(self)
389    }
390    #[doc = "Bit 16 - Reset due to wake up from System OFF mode when wakeup is triggered from DETECT signal from GPIO"]
391    #[inline(always)]
392    pub fn off(&mut self) -> OFF_W<16> {
393        OFF_W::new(self)
394    }
395    #[doc = "Bit 18 - Reset due to wake up from System OFF mode when wakeup is triggered from entering into debug interface mode"]
396    #[inline(always)]
397    pub fn dif(&mut self) -> DIF_W<18> {
398        DIF_W::new(self)
399    }
400    #[doc = "Writes raw bits to the register."]
401    #[inline(always)]
402    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
403        self.0.bits(bits);
404        self
405    }
406}
407#[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"]
408pub struct RESETREAS_SPEC;
409impl crate::RegisterSpec for RESETREAS_SPEC {
410    type Ux = u32;
411}
412#[doc = "`read()` method returns [resetreas::R](R) reader structure"]
413impl crate::Readable for RESETREAS_SPEC {
414    type Reader = R;
415}
416#[doc = "`write(|w| ..)` method takes [resetreas::W](W) writer structure"]
417impl crate::Writable for RESETREAS_SPEC {
418    type Writer = W;
419}
420#[doc = "`reset()` method sets RESETREAS to value 0"]
421impl crate::Resettable for RESETREAS_SPEC {
422    #[inline(always)]
423    fn reset_value() -> Self::Ux {
424        0
425    }
426}