tm4c129x/sysctl/
resbehavctl.rs

1#[doc = "Reader of register RESBEHAVCTL"]
2pub type R = crate::R<u32, super::RESBEHAVCTL>;
3#[doc = "Writer for register RESBEHAVCTL"]
4pub type W = crate::W<u32, super::RESBEHAVCTL>;
5#[doc = "Register RESBEHAVCTL `reset()`'s with value 0"]
6impl crate::ResetValue for super::RESBEHAVCTL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "External RST Pin Operation\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum EXTRES_A {
17    #[doc = "2: External RST assertion issues a system reset. The application starts within 10 us"]
18    SYSRST = 2,
19    #[doc = "3: External RST assertion issues a simulated POR sequence. Application starts less than 500 us after deassertion (Default)"]
20    POR = 3,
21}
22impl From<EXTRES_A> for u8 {
23    #[inline(always)]
24    fn from(variant: EXTRES_A) -> Self {
25        variant as _
26    }
27}
28#[doc = "Reader of field `EXTRES`"]
29pub type EXTRES_R = crate::R<u8, EXTRES_A>;
30impl EXTRES_R {
31    #[doc = r"Get enumerated values variant"]
32    #[inline(always)]
33    pub fn variant(&self) -> crate::Variant<u8, EXTRES_A> {
34        use crate::Variant::*;
35        match self.bits {
36            2 => Val(EXTRES_A::SYSRST),
37            3 => Val(EXTRES_A::POR),
38            i => Res(i),
39        }
40    }
41    #[doc = "Checks if the value of the field is `SYSRST`"]
42    #[inline(always)]
43    pub fn is_sysrst(&self) -> bool {
44        *self == EXTRES_A::SYSRST
45    }
46    #[doc = "Checks if the value of the field is `POR`"]
47    #[inline(always)]
48    pub fn is_por(&self) -> bool {
49        *self == EXTRES_A::POR
50    }
51}
52#[doc = "Write proxy for field `EXTRES`"]
53pub struct EXTRES_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> EXTRES_W<'a> {
57    #[doc = r"Writes `variant` to the field"]
58    #[inline(always)]
59    pub fn variant(self, variant: EXTRES_A) -> &'a mut W {
60        unsafe { self.bits(variant.into()) }
61    }
62    #[doc = "External RST assertion issues a system reset. The application starts within 10 us"]
63    #[inline(always)]
64    pub fn sysrst(self) -> &'a mut W {
65        self.variant(EXTRES_A::SYSRST)
66    }
67    #[doc = "External RST assertion issues a simulated POR sequence. Application starts less than 500 us after deassertion (Default)"]
68    #[inline(always)]
69    pub fn por(self) -> &'a mut W {
70        self.variant(EXTRES_A::POR)
71    }
72    #[doc = r"Writes raw bits to the field"]
73    #[inline(always)]
74    pub unsafe fn bits(self, value: u8) -> &'a mut W {
75        self.w.bits = (self.w.bits & !0x03) | ((value as u32) & 0x03);
76        self.w
77    }
78}
79#[doc = "BOR Reset operation\n\nValue on reset: 0"]
80#[derive(Clone, Copy, Debug, PartialEq)]
81#[repr(u8)]
82pub enum BOR_A {
83    #[doc = "2: Brown Out Reset issues system reset. The application starts within 10 us"]
84    SYSRST = 2,
85    #[doc = "3: Brown Out Reset issues a simulated POR sequence. The application starts less than 500 us after deassertion (Default)"]
86    POR = 3,
87}
88impl From<BOR_A> for u8 {
89    #[inline(always)]
90    fn from(variant: BOR_A) -> Self {
91        variant as _
92    }
93}
94#[doc = "Reader of field `BOR`"]
95pub type BOR_R = crate::R<u8, BOR_A>;
96impl BOR_R {
97    #[doc = r"Get enumerated values variant"]
98    #[inline(always)]
99    pub fn variant(&self) -> crate::Variant<u8, BOR_A> {
100        use crate::Variant::*;
101        match self.bits {
102            2 => Val(BOR_A::SYSRST),
103            3 => Val(BOR_A::POR),
104            i => Res(i),
105        }
106    }
107    #[doc = "Checks if the value of the field is `SYSRST`"]
108    #[inline(always)]
109    pub fn is_sysrst(&self) -> bool {
110        *self == BOR_A::SYSRST
111    }
112    #[doc = "Checks if the value of the field is `POR`"]
113    #[inline(always)]
114    pub fn is_por(&self) -> bool {
115        *self == BOR_A::POR
116    }
117}
118#[doc = "Write proxy for field `BOR`"]
119pub struct BOR_W<'a> {
120    w: &'a mut W,
121}
122impl<'a> BOR_W<'a> {
123    #[doc = r"Writes `variant` to the field"]
124    #[inline(always)]
125    pub fn variant(self, variant: BOR_A) -> &'a mut W {
126        unsafe { self.bits(variant.into()) }
127    }
128    #[doc = "Brown Out Reset issues system reset. The application starts within 10 us"]
129    #[inline(always)]
130    pub fn sysrst(self) -> &'a mut W {
131        self.variant(BOR_A::SYSRST)
132    }
133    #[doc = "Brown Out Reset issues a simulated POR sequence. The application starts less than 500 us after deassertion (Default)"]
134    #[inline(always)]
135    pub fn por(self) -> &'a mut W {
136        self.variant(BOR_A::POR)
137    }
138    #[doc = r"Writes raw bits to the field"]
139    #[inline(always)]
140    pub unsafe fn bits(self, value: u8) -> &'a mut W {
141        self.w.bits = (self.w.bits & !(0x03 << 2)) | (((value as u32) & 0x03) << 2);
142        self.w
143    }
144}
145#[doc = "Watchdog 0 Reset Operation\n\nValue on reset: 0"]
146#[derive(Clone, Copy, Debug, PartialEq)]
147#[repr(u8)]
148pub enum WDOG0_A {
149    #[doc = "2: Watchdog 0 issues a system reset. The application starts within 10 us"]
150    SYSRST = 2,
151    #[doc = "3: Watchdog 0 issues a simulated POR sequence. Application starts less than 500 us after deassertion (Default)"]
152    POR = 3,
153}
154impl From<WDOG0_A> for u8 {
155    #[inline(always)]
156    fn from(variant: WDOG0_A) -> Self {
157        variant as _
158    }
159}
160#[doc = "Reader of field `WDOG0`"]
161pub type WDOG0_R = crate::R<u8, WDOG0_A>;
162impl WDOG0_R {
163    #[doc = r"Get enumerated values variant"]
164    #[inline(always)]
165    pub fn variant(&self) -> crate::Variant<u8, WDOG0_A> {
166        use crate::Variant::*;
167        match self.bits {
168            2 => Val(WDOG0_A::SYSRST),
169            3 => Val(WDOG0_A::POR),
170            i => Res(i),
171        }
172    }
173    #[doc = "Checks if the value of the field is `SYSRST`"]
174    #[inline(always)]
175    pub fn is_sysrst(&self) -> bool {
176        *self == WDOG0_A::SYSRST
177    }
178    #[doc = "Checks if the value of the field is `POR`"]
179    #[inline(always)]
180    pub fn is_por(&self) -> bool {
181        *self == WDOG0_A::POR
182    }
183}
184#[doc = "Write proxy for field `WDOG0`"]
185pub struct WDOG0_W<'a> {
186    w: &'a mut W,
187}
188impl<'a> WDOG0_W<'a> {
189    #[doc = r"Writes `variant` to the field"]
190    #[inline(always)]
191    pub fn variant(self, variant: WDOG0_A) -> &'a mut W {
192        unsafe { self.bits(variant.into()) }
193    }
194    #[doc = "Watchdog 0 issues a system reset. The application starts within 10 us"]
195    #[inline(always)]
196    pub fn sysrst(self) -> &'a mut W {
197        self.variant(WDOG0_A::SYSRST)
198    }
199    #[doc = "Watchdog 0 issues a simulated POR sequence. Application starts less than 500 us after deassertion (Default)"]
200    #[inline(always)]
201    pub fn por(self) -> &'a mut W {
202        self.variant(WDOG0_A::POR)
203    }
204    #[doc = r"Writes raw bits to the field"]
205    #[inline(always)]
206    pub unsafe fn bits(self, value: u8) -> &'a mut W {
207        self.w.bits = (self.w.bits & !(0x03 << 4)) | (((value as u32) & 0x03) << 4);
208        self.w
209    }
210}
211#[doc = "Watchdog 1 Reset Operation\n\nValue on reset: 0"]
212#[derive(Clone, Copy, Debug, PartialEq)]
213#[repr(u8)]
214pub enum WDOG1_A {
215    #[doc = "2: Watchdog 1 issues a system reset. The application starts within 10 us"]
216    SYSRST = 2,
217    #[doc = "3: Watchdog 1 issues a simulated POR sequence. Application starts less than 500 us after deassertion (Default)"]
218    POR = 3,
219}
220impl From<WDOG1_A> for u8 {
221    #[inline(always)]
222    fn from(variant: WDOG1_A) -> Self {
223        variant as _
224    }
225}
226#[doc = "Reader of field `WDOG1`"]
227pub type WDOG1_R = crate::R<u8, WDOG1_A>;
228impl WDOG1_R {
229    #[doc = r"Get enumerated values variant"]
230    #[inline(always)]
231    pub fn variant(&self) -> crate::Variant<u8, WDOG1_A> {
232        use crate::Variant::*;
233        match self.bits {
234            2 => Val(WDOG1_A::SYSRST),
235            3 => Val(WDOG1_A::POR),
236            i => Res(i),
237        }
238    }
239    #[doc = "Checks if the value of the field is `SYSRST`"]
240    #[inline(always)]
241    pub fn is_sysrst(&self) -> bool {
242        *self == WDOG1_A::SYSRST
243    }
244    #[doc = "Checks if the value of the field is `POR`"]
245    #[inline(always)]
246    pub fn is_por(&self) -> bool {
247        *self == WDOG1_A::POR
248    }
249}
250#[doc = "Write proxy for field `WDOG1`"]
251pub struct WDOG1_W<'a> {
252    w: &'a mut W,
253}
254impl<'a> WDOG1_W<'a> {
255    #[doc = r"Writes `variant` to the field"]
256    #[inline(always)]
257    pub fn variant(self, variant: WDOG1_A) -> &'a mut W {
258        unsafe { self.bits(variant.into()) }
259    }
260    #[doc = "Watchdog 1 issues a system reset. The application starts within 10 us"]
261    #[inline(always)]
262    pub fn sysrst(self) -> &'a mut W {
263        self.variant(WDOG1_A::SYSRST)
264    }
265    #[doc = "Watchdog 1 issues a simulated POR sequence. Application starts less than 500 us after deassertion (Default)"]
266    #[inline(always)]
267    pub fn por(self) -> &'a mut W {
268        self.variant(WDOG1_A::POR)
269    }
270    #[doc = r"Writes raw bits to the field"]
271    #[inline(always)]
272    pub unsafe fn bits(self, value: u8) -> &'a mut W {
273        self.w.bits = (self.w.bits & !(0x03 << 6)) | (((value as u32) & 0x03) << 6);
274        self.w
275    }
276}
277impl R {
278    #[doc = "Bits 0:1 - External RST Pin Operation"]
279    #[inline(always)]
280    pub fn extres(&self) -> EXTRES_R {
281        EXTRES_R::new((self.bits & 0x03) as u8)
282    }
283    #[doc = "Bits 2:3 - BOR Reset operation"]
284    #[inline(always)]
285    pub fn bor(&self) -> BOR_R {
286        BOR_R::new(((self.bits >> 2) & 0x03) as u8)
287    }
288    #[doc = "Bits 4:5 - Watchdog 0 Reset Operation"]
289    #[inline(always)]
290    pub fn wdog0(&self) -> WDOG0_R {
291        WDOG0_R::new(((self.bits >> 4) & 0x03) as u8)
292    }
293    #[doc = "Bits 6:7 - Watchdog 1 Reset Operation"]
294    #[inline(always)]
295    pub fn wdog1(&self) -> WDOG1_R {
296        WDOG1_R::new(((self.bits >> 6) & 0x03) as u8)
297    }
298}
299impl W {
300    #[doc = "Bits 0:1 - External RST Pin Operation"]
301    #[inline(always)]
302    pub fn extres(&mut self) -> EXTRES_W {
303        EXTRES_W { w: self }
304    }
305    #[doc = "Bits 2:3 - BOR Reset operation"]
306    #[inline(always)]
307    pub fn bor(&mut self) -> BOR_W {
308        BOR_W { w: self }
309    }
310    #[doc = "Bits 4:5 - Watchdog 0 Reset Operation"]
311    #[inline(always)]
312    pub fn wdog0(&mut self) -> WDOG0_W {
313        WDOG0_W { w: self }
314    }
315    #[doc = "Bits 6:7 - Watchdog 1 Reset Operation"]
316    #[inline(always)]
317    pub fn wdog1(&mut self) -> WDOG1_W {
318        WDOG1_W { w: self }
319    }
320}