lpc11xx/syscon/
sysrststat.rs

1#[doc = "Reader of register SYSRSTSTAT"]
2pub type R = crate::R<u32, super::SYSRSTSTAT>;
3#[doc = "POR reset status.\n\nValue on reset: 0"]
4#[derive(Clone, Copy, Debug, PartialEq)]
5pub enum POR_A {
6    #[doc = "0: No POR detected"]
7    NO_POR_DETECTED_,
8    #[doc = "1: POR detected. Writing a one clears this reset"]
9    POR_DETECTED_WRITIN,
10}
11impl From<POR_A> for bool {
12    #[inline(always)]
13    fn from(variant: POR_A) -> Self {
14        match variant {
15            POR_A::NO_POR_DETECTED_ => false,
16            POR_A::POR_DETECTED_WRITIN => true,
17        }
18    }
19}
20#[doc = "Reader of field `POR`"]
21pub type POR_R = crate::R<bool, POR_A>;
22impl POR_R {
23    #[doc = r"Get enumerated values variant"]
24    #[inline(always)]
25    pub fn variant(&self) -> POR_A {
26        match self.bits {
27            false => POR_A::NO_POR_DETECTED_,
28            true => POR_A::POR_DETECTED_WRITIN,
29        }
30    }
31    #[doc = "Checks if the value of the field is `NO_POR_DETECTED_`"]
32    #[inline(always)]
33    pub fn is_no_por_detected_(&self) -> bool {
34        *self == POR_A::NO_POR_DETECTED_
35    }
36    #[doc = "Checks if the value of the field is `POR_DETECTED_WRITIN`"]
37    #[inline(always)]
38    pub fn is_por_detected_writin(&self) -> bool {
39        *self == POR_A::POR_DETECTED_WRITIN
40    }
41}
42#[doc = "Status of the external RESET pin.\n\nValue on reset: 0"]
43#[derive(Clone, Copy, Debug, PartialEq)]
44pub enum EXTRST_A {
45    #[doc = "0: No RESET event detected"]
46    NO_RESET_EVENT_DETEC,
47    #[doc = "1: RESET detected. Writing a one clears this reset"]
48    RESET_DETECTED_WRIT,
49}
50impl From<EXTRST_A> for bool {
51    #[inline(always)]
52    fn from(variant: EXTRST_A) -> Self {
53        match variant {
54            EXTRST_A::NO_RESET_EVENT_DETEC => false,
55            EXTRST_A::RESET_DETECTED_WRIT => true,
56        }
57    }
58}
59#[doc = "Reader of field `EXTRST`"]
60pub type EXTRST_R = crate::R<bool, EXTRST_A>;
61impl EXTRST_R {
62    #[doc = r"Get enumerated values variant"]
63    #[inline(always)]
64    pub fn variant(&self) -> EXTRST_A {
65        match self.bits {
66            false => EXTRST_A::NO_RESET_EVENT_DETEC,
67            true => EXTRST_A::RESET_DETECTED_WRIT,
68        }
69    }
70    #[doc = "Checks if the value of the field is `NO_RESET_EVENT_DETEC`"]
71    #[inline(always)]
72    pub fn is_no_reset_event_detec(&self) -> bool {
73        *self == EXTRST_A::NO_RESET_EVENT_DETEC
74    }
75    #[doc = "Checks if the value of the field is `RESET_DETECTED_WRIT`"]
76    #[inline(always)]
77    pub fn is_reset_detected_writ(&self) -> bool {
78        *self == EXTRST_A::RESET_DETECTED_WRIT
79    }
80}
81#[doc = "Status of the Watchdog reset.\n\nValue on reset: 0"]
82#[derive(Clone, Copy, Debug, PartialEq)]
83pub enum WDT_A {
84    #[doc = "0: No WDT reset detected"]
85    NO_WDT_RESET_DETECTE,
86    #[doc = "1: WDT reset detected. Writing a one clears this reset"]
87    WDT_RESET_DETECTED_,
88}
89impl From<WDT_A> for bool {
90    #[inline(always)]
91    fn from(variant: WDT_A) -> Self {
92        match variant {
93            WDT_A::NO_WDT_RESET_DETECTE => false,
94            WDT_A::WDT_RESET_DETECTED_ => true,
95        }
96    }
97}
98#[doc = "Reader of field `WDT`"]
99pub type WDT_R = crate::R<bool, WDT_A>;
100impl WDT_R {
101    #[doc = r"Get enumerated values variant"]
102    #[inline(always)]
103    pub fn variant(&self) -> WDT_A {
104        match self.bits {
105            false => WDT_A::NO_WDT_RESET_DETECTE,
106            true => WDT_A::WDT_RESET_DETECTED_,
107        }
108    }
109    #[doc = "Checks if the value of the field is `NO_WDT_RESET_DETECTE`"]
110    #[inline(always)]
111    pub fn is_no_wdt_reset_detecte(&self) -> bool {
112        *self == WDT_A::NO_WDT_RESET_DETECTE
113    }
114    #[doc = "Checks if the value of the field is `WDT_RESET_DETECTED_`"]
115    #[inline(always)]
116    pub fn is_wdt_reset_detected_(&self) -> bool {
117        *self == WDT_A::WDT_RESET_DETECTED_
118    }
119}
120#[doc = "Status of the Brown-out detect reset.\n\nValue on reset: 0"]
121#[derive(Clone, Copy, Debug, PartialEq)]
122pub enum BOD_A {
123    #[doc = "0: No BOD reset detected"]
124    NO_BOD_RESET_DETECTE,
125    #[doc = "1: BOD reset detected. Writing a one clears this reset"]
126    BOD_RESET_DETECTED_,
127}
128impl From<BOD_A> for bool {
129    #[inline(always)]
130    fn from(variant: BOD_A) -> Self {
131        match variant {
132            BOD_A::NO_BOD_RESET_DETECTE => false,
133            BOD_A::BOD_RESET_DETECTED_ => true,
134        }
135    }
136}
137#[doc = "Reader of field `BOD`"]
138pub type BOD_R = crate::R<bool, BOD_A>;
139impl BOD_R {
140    #[doc = r"Get enumerated values variant"]
141    #[inline(always)]
142    pub fn variant(&self) -> BOD_A {
143        match self.bits {
144            false => BOD_A::NO_BOD_RESET_DETECTE,
145            true => BOD_A::BOD_RESET_DETECTED_,
146        }
147    }
148    #[doc = "Checks if the value of the field is `NO_BOD_RESET_DETECTE`"]
149    #[inline(always)]
150    pub fn is_no_bod_reset_detecte(&self) -> bool {
151        *self == BOD_A::NO_BOD_RESET_DETECTE
152    }
153    #[doc = "Checks if the value of the field is `BOD_RESET_DETECTED_`"]
154    #[inline(always)]
155    pub fn is_bod_reset_detected_(&self) -> bool {
156        *self == BOD_A::BOD_RESET_DETECTED_
157    }
158}
159#[doc = "Status of the software system reset.\n\nValue on reset: 0"]
160#[derive(Clone, Copy, Debug, PartialEq)]
161pub enum SYSRST_A {
162    #[doc = "0: No System reset detected"]
163    NO_SYSTEM_RESET_DETE,
164    #[doc = "1: System reset detected. Writing a one clears this reset"]
165    SYSTEM_RESET_DETECTE,
166}
167impl From<SYSRST_A> for bool {
168    #[inline(always)]
169    fn from(variant: SYSRST_A) -> Self {
170        match variant {
171            SYSRST_A::NO_SYSTEM_RESET_DETE => false,
172            SYSRST_A::SYSTEM_RESET_DETECTE => true,
173        }
174    }
175}
176#[doc = "Reader of field `SYSRST`"]
177pub type SYSRST_R = crate::R<bool, SYSRST_A>;
178impl SYSRST_R {
179    #[doc = r"Get enumerated values variant"]
180    #[inline(always)]
181    pub fn variant(&self) -> SYSRST_A {
182        match self.bits {
183            false => SYSRST_A::NO_SYSTEM_RESET_DETE,
184            true => SYSRST_A::SYSTEM_RESET_DETECTE,
185        }
186    }
187    #[doc = "Checks if the value of the field is `NO_SYSTEM_RESET_DETE`"]
188    #[inline(always)]
189    pub fn is_no_system_reset_dete(&self) -> bool {
190        *self == SYSRST_A::NO_SYSTEM_RESET_DETE
191    }
192    #[doc = "Checks if the value of the field is `SYSTEM_RESET_DETECTE`"]
193    #[inline(always)]
194    pub fn is_system_reset_detecte(&self) -> bool {
195        *self == SYSRST_A::SYSTEM_RESET_DETECTE
196    }
197}
198impl R {
199    #[doc = "Bit 0 - POR reset status."]
200    #[inline(always)]
201    pub fn por(&self) -> POR_R {
202        POR_R::new((self.bits & 0x01) != 0)
203    }
204    #[doc = "Bit 1 - Status of the external RESET pin."]
205    #[inline(always)]
206    pub fn extrst(&self) -> EXTRST_R {
207        EXTRST_R::new(((self.bits >> 1) & 0x01) != 0)
208    }
209    #[doc = "Bit 2 - Status of the Watchdog reset."]
210    #[inline(always)]
211    pub fn wdt(&self) -> WDT_R {
212        WDT_R::new(((self.bits >> 2) & 0x01) != 0)
213    }
214    #[doc = "Bit 3 - Status of the Brown-out detect reset."]
215    #[inline(always)]
216    pub fn bod(&self) -> BOD_R {
217        BOD_R::new(((self.bits >> 3) & 0x01) != 0)
218    }
219    #[doc = "Bit 4 - Status of the software system reset."]
220    #[inline(always)]
221    pub fn sysrst(&self) -> SYSRST_R {
222        SYSRST_R::new(((self.bits >> 4) & 0x01) != 0)
223    }
224}