Skip to main content

lpc550x/pmc/
resetctrl.rs

1#[doc = "Register `RESETCTRL` reader"]
2pub struct R(crate::R<RESETCTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<RESETCTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<RESETCTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<RESETCTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `RESETCTRL` writer"]
17pub struct W(crate::W<RESETCTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<RESETCTRL_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<RESETCTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<RESETCTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `DPDWAKEUPRESETENABLE` reader - Wake-up from DEEP POWER DOWN reset event (either from wake up I/O or RTC or OS Event Timer)."]
38pub type DPDWAKEUPRESETENABLE_R = crate::BitReader<DPDWAKEUPRESETENABLE_A>;
39#[doc = "Wake-up from DEEP POWER DOWN reset event (either from wake up I/O or RTC or OS Event Timer).\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum DPDWAKEUPRESETENABLE_A {
42    #[doc = "0: Reset event from DEEP POWER DOWN mode is disable."]
43    DISABLE = 0,
44    #[doc = "1: Reset event from DEEP POWER DOWN mode is enable."]
45    ENABLE = 1,
46}
47impl From<DPDWAKEUPRESETENABLE_A> for bool {
48    #[inline(always)]
49    fn from(variant: DPDWAKEUPRESETENABLE_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl DPDWAKEUPRESETENABLE_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> DPDWAKEUPRESETENABLE_A {
57        match self.bits {
58            false => DPDWAKEUPRESETENABLE_A::DISABLE,
59            true => DPDWAKEUPRESETENABLE_A::ENABLE,
60        }
61    }
62    #[doc = "Checks if the value of the field is `DISABLE`"]
63    #[inline(always)]
64    pub fn is_disable(&self) -> bool {
65        *self == DPDWAKEUPRESETENABLE_A::DISABLE
66    }
67    #[doc = "Checks if the value of the field is `ENABLE`"]
68    #[inline(always)]
69    pub fn is_enable(&self) -> bool {
70        *self == DPDWAKEUPRESETENABLE_A::ENABLE
71    }
72}
73#[doc = "Field `DPDWAKEUPRESETENABLE` writer - Wake-up from DEEP POWER DOWN reset event (either from wake up I/O or RTC or OS Event Timer)."]
74pub type DPDWAKEUPRESETENABLE_W<'a, const O: u8> =
75    crate::BitWriter<'a, u32, RESETCTRL_SPEC, DPDWAKEUPRESETENABLE_A, O>;
76impl<'a, const O: u8> DPDWAKEUPRESETENABLE_W<'a, O> {
77    #[doc = "Reset event from DEEP POWER DOWN mode is disable."]
78    #[inline(always)]
79    pub fn disable(self) -> &'a mut W {
80        self.variant(DPDWAKEUPRESETENABLE_A::DISABLE)
81    }
82    #[doc = "Reset event from DEEP POWER DOWN mode is enable."]
83    #[inline(always)]
84    pub fn enable(self) -> &'a mut W {
85        self.variant(DPDWAKEUPRESETENABLE_A::ENABLE)
86    }
87}
88#[doc = "Field `SWRRESETENABLE` reader - Software reset enable."]
89pub type SWRRESETENABLE_R = crate::BitReader<SWRRESETENABLE_A>;
90#[doc = "Software reset enable.\n\nValue on reset: 0"]
91#[derive(Clone, Copy, Debug, PartialEq, Eq)]
92pub enum SWRRESETENABLE_A {
93    #[doc = "0: Software reset is disable."]
94    DISABLE = 0,
95    #[doc = "1: Software reset is enable."]
96    ENABLE = 1,
97}
98impl From<SWRRESETENABLE_A> for bool {
99    #[inline(always)]
100    fn from(variant: SWRRESETENABLE_A) -> Self {
101        variant as u8 != 0
102    }
103}
104impl SWRRESETENABLE_R {
105    #[doc = "Get enumerated values variant"]
106    #[inline(always)]
107    pub fn variant(&self) -> SWRRESETENABLE_A {
108        match self.bits {
109            false => SWRRESETENABLE_A::DISABLE,
110            true => SWRRESETENABLE_A::ENABLE,
111        }
112    }
113    #[doc = "Checks if the value of the field is `DISABLE`"]
114    #[inline(always)]
115    pub fn is_disable(&self) -> bool {
116        *self == SWRRESETENABLE_A::DISABLE
117    }
118    #[doc = "Checks if the value of the field is `ENABLE`"]
119    #[inline(always)]
120    pub fn is_enable(&self) -> bool {
121        *self == SWRRESETENABLE_A::ENABLE
122    }
123}
124#[doc = "Field `SWRRESETENABLE` writer - Software reset enable."]
125pub type SWRRESETENABLE_W<'a, const O: u8> =
126    crate::BitWriter<'a, u32, RESETCTRL_SPEC, SWRRESETENABLE_A, O>;
127impl<'a, const O: u8> SWRRESETENABLE_W<'a, O> {
128    #[doc = "Software reset is disable."]
129    #[inline(always)]
130    pub fn disable(self) -> &'a mut W {
131        self.variant(SWRRESETENABLE_A::DISABLE)
132    }
133    #[doc = "Software reset is enable."]
134    #[inline(always)]
135    pub fn enable(self) -> &'a mut W {
136        self.variant(SWRRESETENABLE_A::ENABLE)
137    }
138}
139#[doc = "Field `BODVBATRESETENA_SECURE` reader - BOD VBAT reset enable."]
140pub type BODVBATRESETENA_SECURE_R = crate::FieldReader<u8, BODVBATRESETENA_SECURE_A>;
141#[doc = "BOD VBAT reset enable.\n\nValue on reset: 1"]
142#[derive(Clone, Copy, Debug, PartialEq, Eq)]
143#[repr(u8)]
144pub enum BODVBATRESETENA_SECURE_A {
145    #[doc = "1: Any other value than b10, BOD VBAT reset is enable."]
146    ENABLE = 1,
147    #[doc = "2: BOD VBAT reset is disable."]
148    DISABLE = 2,
149}
150impl From<BODVBATRESETENA_SECURE_A> for u8 {
151    #[inline(always)]
152    fn from(variant: BODVBATRESETENA_SECURE_A) -> Self {
153        variant as _
154    }
155}
156impl BODVBATRESETENA_SECURE_R {
157    #[doc = "Get enumerated values variant"]
158    #[inline(always)]
159    pub fn variant(&self) -> Option<BODVBATRESETENA_SECURE_A> {
160        match self.bits {
161            1 => Some(BODVBATRESETENA_SECURE_A::ENABLE),
162            2 => Some(BODVBATRESETENA_SECURE_A::DISABLE),
163            _ => None,
164        }
165    }
166    #[doc = "Checks if the value of the field is `ENABLE`"]
167    #[inline(always)]
168    pub fn is_enable(&self) -> bool {
169        *self == BODVBATRESETENA_SECURE_A::ENABLE
170    }
171    #[doc = "Checks if the value of the field is `DISABLE`"]
172    #[inline(always)]
173    pub fn is_disable(&self) -> bool {
174        *self == BODVBATRESETENA_SECURE_A::DISABLE
175    }
176}
177#[doc = "Field `BODVBATRESETENA_SECURE` writer - BOD VBAT reset enable."]
178pub type BODVBATRESETENA_SECURE_W<'a, const O: u8> =
179    crate::FieldWriter<'a, u32, RESETCTRL_SPEC, u8, BODVBATRESETENA_SECURE_A, 2, O>;
180impl<'a, const O: u8> BODVBATRESETENA_SECURE_W<'a, O> {
181    #[doc = "Any other value than b10, BOD VBAT reset is enable."]
182    #[inline(always)]
183    pub fn enable(self) -> &'a mut W {
184        self.variant(BODVBATRESETENA_SECURE_A::ENABLE)
185    }
186    #[doc = "BOD VBAT reset is disable."]
187    #[inline(always)]
188    pub fn disable(self) -> &'a mut W {
189        self.variant(BODVBATRESETENA_SECURE_A::DISABLE)
190    }
191}
192#[doc = "Field `BODCORERESETENA_SECURE` reader - BOD Core reset enable."]
193pub type BODCORERESETENA_SECURE_R = crate::FieldReader<u8, BODCORERESETENA_SECURE_A>;
194#[doc = "BOD Core reset enable.\n\nValue on reset: 1"]
195#[derive(Clone, Copy, Debug, PartialEq, Eq)]
196#[repr(u8)]
197pub enum BODCORERESETENA_SECURE_A {
198    #[doc = "1: Any other value than b10, BOD Core reset is enable."]
199    ENABLE = 1,
200    #[doc = "2: BOD Core reset is disable."]
201    DISABLE = 2,
202}
203impl From<BODCORERESETENA_SECURE_A> for u8 {
204    #[inline(always)]
205    fn from(variant: BODCORERESETENA_SECURE_A) -> Self {
206        variant as _
207    }
208}
209impl BODCORERESETENA_SECURE_R {
210    #[doc = "Get enumerated values variant"]
211    #[inline(always)]
212    pub fn variant(&self) -> Option<BODCORERESETENA_SECURE_A> {
213        match self.bits {
214            1 => Some(BODCORERESETENA_SECURE_A::ENABLE),
215            2 => Some(BODCORERESETENA_SECURE_A::DISABLE),
216            _ => None,
217        }
218    }
219    #[doc = "Checks if the value of the field is `ENABLE`"]
220    #[inline(always)]
221    pub fn is_enable(&self) -> bool {
222        *self == BODCORERESETENA_SECURE_A::ENABLE
223    }
224    #[doc = "Checks if the value of the field is `DISABLE`"]
225    #[inline(always)]
226    pub fn is_disable(&self) -> bool {
227        *self == BODCORERESETENA_SECURE_A::DISABLE
228    }
229}
230#[doc = "Field `BODCORERESETENA_SECURE` writer - BOD Core reset enable."]
231pub type BODCORERESETENA_SECURE_W<'a, const O: u8> =
232    crate::FieldWriter<'a, u32, RESETCTRL_SPEC, u8, BODCORERESETENA_SECURE_A, 2, O>;
233impl<'a, const O: u8> BODCORERESETENA_SECURE_W<'a, O> {
234    #[doc = "Any other value than b10, BOD Core reset is enable."]
235    #[inline(always)]
236    pub fn enable(self) -> &'a mut W {
237        self.variant(BODCORERESETENA_SECURE_A::ENABLE)
238    }
239    #[doc = "BOD Core reset is disable."]
240    #[inline(always)]
241    pub fn disable(self) -> &'a mut W {
242        self.variant(BODCORERESETENA_SECURE_A::DISABLE)
243    }
244}
245#[doc = "Field `BODVBATRESETENA_SECURE_DP` reader - BOD VBAT reset enable."]
246pub type BODVBATRESETENA_SECURE_DP_R = crate::FieldReader<u8, BODVBATRESETENA_SECURE_DP_A>;
247#[doc = "BOD VBAT reset enable.\n\nValue on reset: 1"]
248#[derive(Clone, Copy, Debug, PartialEq, Eq)]
249#[repr(u8)]
250pub enum BODVBATRESETENA_SECURE_DP_A {
251    #[doc = "1: Any other value than b10, BOD VBAT reset is enable."]
252    ENABLE = 1,
253    #[doc = "2: BOD VBAT reset is disable."]
254    DISABLE = 2,
255}
256impl From<BODVBATRESETENA_SECURE_DP_A> for u8 {
257    #[inline(always)]
258    fn from(variant: BODVBATRESETENA_SECURE_DP_A) -> Self {
259        variant as _
260    }
261}
262impl BODVBATRESETENA_SECURE_DP_R {
263    #[doc = "Get enumerated values variant"]
264    #[inline(always)]
265    pub fn variant(&self) -> Option<BODVBATRESETENA_SECURE_DP_A> {
266        match self.bits {
267            1 => Some(BODVBATRESETENA_SECURE_DP_A::ENABLE),
268            2 => Some(BODVBATRESETENA_SECURE_DP_A::DISABLE),
269            _ => None,
270        }
271    }
272    #[doc = "Checks if the value of the field is `ENABLE`"]
273    #[inline(always)]
274    pub fn is_enable(&self) -> bool {
275        *self == BODVBATRESETENA_SECURE_DP_A::ENABLE
276    }
277    #[doc = "Checks if the value of the field is `DISABLE`"]
278    #[inline(always)]
279    pub fn is_disable(&self) -> bool {
280        *self == BODVBATRESETENA_SECURE_DP_A::DISABLE
281    }
282}
283#[doc = "Field `BODVBATRESETENA_SECURE_DP` writer - BOD VBAT reset enable."]
284pub type BODVBATRESETENA_SECURE_DP_W<'a, const O: u8> =
285    crate::FieldWriter<'a, u32, RESETCTRL_SPEC, u8, BODVBATRESETENA_SECURE_DP_A, 2, O>;
286impl<'a, const O: u8> BODVBATRESETENA_SECURE_DP_W<'a, O> {
287    #[doc = "Any other value than b10, BOD VBAT reset is enable."]
288    #[inline(always)]
289    pub fn enable(self) -> &'a mut W {
290        self.variant(BODVBATRESETENA_SECURE_DP_A::ENABLE)
291    }
292    #[doc = "BOD VBAT reset is disable."]
293    #[inline(always)]
294    pub fn disable(self) -> &'a mut W {
295        self.variant(BODVBATRESETENA_SECURE_DP_A::DISABLE)
296    }
297}
298#[doc = "Field `BODCORERESETENA_SECURE_DP` reader - BOD Core reset enable."]
299pub type BODCORERESETENA_SECURE_DP_R = crate::FieldReader<u8, BODCORERESETENA_SECURE_DP_A>;
300#[doc = "BOD Core reset enable.\n\nValue on reset: 1"]
301#[derive(Clone, Copy, Debug, PartialEq, Eq)]
302#[repr(u8)]
303pub enum BODCORERESETENA_SECURE_DP_A {
304    #[doc = "1: Any other value than b10, BOD Core reset is enable."]
305    ENABLE = 1,
306    #[doc = "2: BOD Core reset is disable."]
307    DISABLE = 2,
308}
309impl From<BODCORERESETENA_SECURE_DP_A> for u8 {
310    #[inline(always)]
311    fn from(variant: BODCORERESETENA_SECURE_DP_A) -> Self {
312        variant as _
313    }
314}
315impl BODCORERESETENA_SECURE_DP_R {
316    #[doc = "Get enumerated values variant"]
317    #[inline(always)]
318    pub fn variant(&self) -> Option<BODCORERESETENA_SECURE_DP_A> {
319        match self.bits {
320            1 => Some(BODCORERESETENA_SECURE_DP_A::ENABLE),
321            2 => Some(BODCORERESETENA_SECURE_DP_A::DISABLE),
322            _ => None,
323        }
324    }
325    #[doc = "Checks if the value of the field is `ENABLE`"]
326    #[inline(always)]
327    pub fn is_enable(&self) -> bool {
328        *self == BODCORERESETENA_SECURE_DP_A::ENABLE
329    }
330    #[doc = "Checks if the value of the field is `DISABLE`"]
331    #[inline(always)]
332    pub fn is_disable(&self) -> bool {
333        *self == BODCORERESETENA_SECURE_DP_A::DISABLE
334    }
335}
336#[doc = "Field `BODCORERESETENA_SECURE_DP` writer - BOD Core reset enable."]
337pub type BODCORERESETENA_SECURE_DP_W<'a, const O: u8> =
338    crate::FieldWriter<'a, u32, RESETCTRL_SPEC, u8, BODCORERESETENA_SECURE_DP_A, 2, O>;
339impl<'a, const O: u8> BODCORERESETENA_SECURE_DP_W<'a, O> {
340    #[doc = "Any other value than b10, BOD Core reset is enable."]
341    #[inline(always)]
342    pub fn enable(self) -> &'a mut W {
343        self.variant(BODCORERESETENA_SECURE_DP_A::ENABLE)
344    }
345    #[doc = "BOD Core reset is disable."]
346    #[inline(always)]
347    pub fn disable(self) -> &'a mut W {
348        self.variant(BODCORERESETENA_SECURE_DP_A::DISABLE)
349    }
350}
351impl R {
352    #[doc = "Bit 0 - Wake-up from DEEP POWER DOWN reset event (either from wake up I/O or RTC or OS Event Timer)."]
353    #[inline(always)]
354    pub fn dpdwakeupresetenable(&self) -> DPDWAKEUPRESETENABLE_R {
355        DPDWAKEUPRESETENABLE_R::new((self.bits & 1) != 0)
356    }
357    #[doc = "Bit 3 - Software reset enable."]
358    #[inline(always)]
359    pub fn swrresetenable(&self) -> SWRRESETENABLE_R {
360        SWRRESETENABLE_R::new(((self.bits >> 3) & 1) != 0)
361    }
362    #[doc = "Bits 4:5 - BOD VBAT reset enable."]
363    #[inline(always)]
364    pub fn bodvbatresetena_secure(&self) -> BODVBATRESETENA_SECURE_R {
365        BODVBATRESETENA_SECURE_R::new(((self.bits >> 4) & 3) as u8)
366    }
367    #[doc = "Bits 6:7 - BOD Core reset enable."]
368    #[inline(always)]
369    pub fn bodcoreresetena_secure(&self) -> BODCORERESETENA_SECURE_R {
370        BODCORERESETENA_SECURE_R::new(((self.bits >> 6) & 3) as u8)
371    }
372    #[doc = "Bits 28:29 - BOD VBAT reset enable."]
373    #[inline(always)]
374    pub fn bodvbatresetena_secure_dp(&self) -> BODVBATRESETENA_SECURE_DP_R {
375        BODVBATRESETENA_SECURE_DP_R::new(((self.bits >> 28) & 3) as u8)
376    }
377    #[doc = "Bits 30:31 - BOD Core reset enable."]
378    #[inline(always)]
379    pub fn bodcoreresetena_secure_dp(&self) -> BODCORERESETENA_SECURE_DP_R {
380        BODCORERESETENA_SECURE_DP_R::new(((self.bits >> 30) & 3) as u8)
381    }
382}
383impl W {
384    #[doc = "Bit 0 - Wake-up from DEEP POWER DOWN reset event (either from wake up I/O or RTC or OS Event Timer)."]
385    #[inline(always)]
386    pub fn dpdwakeupresetenable(&mut self) -> DPDWAKEUPRESETENABLE_W<0> {
387        DPDWAKEUPRESETENABLE_W::new(self)
388    }
389    #[doc = "Bit 3 - Software reset enable."]
390    #[inline(always)]
391    pub fn swrresetenable(&mut self) -> SWRRESETENABLE_W<3> {
392        SWRRESETENABLE_W::new(self)
393    }
394    #[doc = "Bits 4:5 - BOD VBAT reset enable."]
395    #[inline(always)]
396    pub fn bodvbatresetena_secure(&mut self) -> BODVBATRESETENA_SECURE_W<4> {
397        BODVBATRESETENA_SECURE_W::new(self)
398    }
399    #[doc = "Bits 6:7 - BOD Core reset enable."]
400    #[inline(always)]
401    pub fn bodcoreresetena_secure(&mut self) -> BODCORERESETENA_SECURE_W<6> {
402        BODCORERESETENA_SECURE_W::new(self)
403    }
404    #[doc = "Bits 28:29 - BOD VBAT reset enable."]
405    #[inline(always)]
406    pub fn bodvbatresetena_secure_dp(&mut self) -> BODVBATRESETENA_SECURE_DP_W<28> {
407        BODVBATRESETENA_SECURE_DP_W::new(self)
408    }
409    #[doc = "Bits 30:31 - BOD Core reset enable."]
410    #[inline(always)]
411    pub fn bodcoreresetena_secure_dp(&mut self) -> BODCORERESETENA_SECURE_DP_W<30> {
412        BODCORERESETENA_SECURE_DP_W::new(self)
413    }
414    #[doc = "Writes raw bits to the register."]
415    #[inline(always)]
416    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
417        self.0.bits(bits);
418        self
419    }
420}
421#[doc = "Reset Control \\[Reset by: PoR, Pin Reset, Brown Out Detectors Reset, Deep Power Down Reset, Software Reset\\]\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 [resetctrl](index.html) module"]
422pub struct RESETCTRL_SPEC;
423impl crate::RegisterSpec for RESETCTRL_SPEC {
424    type Ux = u32;
425}
426#[doc = "`read()` method returns [resetctrl::R](R) reader structure"]
427impl crate::Readable for RESETCTRL_SPEC {
428    type Reader = R;
429}
430#[doc = "`write(|w| ..)` method takes [resetctrl::W](W) writer structure"]
431impl crate::Writable for RESETCTRL_SPEC {
432    type Writer = W;
433}
434#[doc = "`reset()` method sets RESETCTRL to value 0x5000_0050"]
435impl crate::Resettable for RESETCTRL_SPEC {
436    #[inline(always)]
437    fn reset_value() -> Self::Ux {
438        0x5000_0050
439    }
440}