nrf5340_app_pac/wdt0_ns/
config.rs1#[doc = "Register `CONFIG` reader"]
2pub struct R(crate::R<CONFIG_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CONFIG_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CONFIG_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CONFIG_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CONFIG` writer"]
17pub struct W(crate::W<CONFIG_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CONFIG_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<CONFIG_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CONFIG_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `SLEEP` reader - Configure WDT to either be paused, or kept running, while the CPU is sleeping"]
38pub type SLEEP_R = crate::BitReader<SLEEP_A>;
39#[doc = "Configure WDT to either be paused, or kept running, while the CPU is sleeping\n\nValue on reset: 1"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum SLEEP_A {
42 #[doc = "0: Pause WDT while the CPU is sleeping"]
43 PAUSE = 0,
44 #[doc = "1: Keep WDT running while the CPU is sleeping"]
45 RUN = 1,
46}
47impl From<SLEEP_A> for bool {
48 #[inline(always)]
49 fn from(variant: SLEEP_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl SLEEP_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> SLEEP_A {
57 match self.bits {
58 false => SLEEP_A::PAUSE,
59 true => SLEEP_A::RUN,
60 }
61 }
62 #[doc = "Checks if the value of the field is `PAUSE`"]
63 #[inline(always)]
64 pub fn is_pause(&self) -> bool {
65 *self == SLEEP_A::PAUSE
66 }
67 #[doc = "Checks if the value of the field is `RUN`"]
68 #[inline(always)]
69 pub fn is_run(&self) -> bool {
70 *self == SLEEP_A::RUN
71 }
72}
73#[doc = "Field `SLEEP` writer - Configure WDT to either be paused, or kept running, while the CPU is sleeping"]
74pub type SLEEP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CONFIG_SPEC, SLEEP_A, O>;
75impl<'a, const O: u8> SLEEP_W<'a, O> {
76 #[doc = "Pause WDT while the CPU is sleeping"]
77 #[inline(always)]
78 pub fn pause(self) -> &'a mut W {
79 self.variant(SLEEP_A::PAUSE)
80 }
81 #[doc = "Keep WDT running while the CPU is sleeping"]
82 #[inline(always)]
83 pub fn run(self) -> &'a mut W {
84 self.variant(SLEEP_A::RUN)
85 }
86}
87#[doc = "Field `HALT` reader - Configure WDT to either be paused, or kept running, while the CPU is halted by the debugger"]
88pub type HALT_R = crate::BitReader<HALT_A>;
89#[doc = "Configure WDT to either be paused, or kept running, while the CPU is halted by the debugger\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq)]
91pub enum HALT_A {
92 #[doc = "0: Pause WDT while the CPU is halted by the debugger"]
93 PAUSE = 0,
94 #[doc = "1: Keep WDT running while the CPU is halted by the debugger"]
95 RUN = 1,
96}
97impl From<HALT_A> for bool {
98 #[inline(always)]
99 fn from(variant: HALT_A) -> Self {
100 variant as u8 != 0
101 }
102}
103impl HALT_R {
104 #[doc = "Get enumerated values variant"]
105 #[inline(always)]
106 pub fn variant(&self) -> HALT_A {
107 match self.bits {
108 false => HALT_A::PAUSE,
109 true => HALT_A::RUN,
110 }
111 }
112 #[doc = "Checks if the value of the field is `PAUSE`"]
113 #[inline(always)]
114 pub fn is_pause(&self) -> bool {
115 *self == HALT_A::PAUSE
116 }
117 #[doc = "Checks if the value of the field is `RUN`"]
118 #[inline(always)]
119 pub fn is_run(&self) -> bool {
120 *self == HALT_A::RUN
121 }
122}
123#[doc = "Field `HALT` writer - Configure WDT to either be paused, or kept running, while the CPU is halted by the debugger"]
124pub type HALT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CONFIG_SPEC, HALT_A, O>;
125impl<'a, const O: u8> HALT_W<'a, O> {
126 #[doc = "Pause WDT while the CPU is halted by the debugger"]
127 #[inline(always)]
128 pub fn pause(self) -> &'a mut W {
129 self.variant(HALT_A::PAUSE)
130 }
131 #[doc = "Keep WDT running while the CPU is halted by the debugger"]
132 #[inline(always)]
133 pub fn run(self) -> &'a mut W {
134 self.variant(HALT_A::RUN)
135 }
136}
137#[doc = "Field `STOPEN` reader - Allow stopping WDT"]
138pub type STOPEN_R = crate::BitReader<STOPEN_A>;
139#[doc = "Allow stopping WDT\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq)]
141pub enum STOPEN_A {
142 #[doc = "0: Do not allow stopping WDT"]
143 DISABLE = 0,
144 #[doc = "1: Allow stopping WDT"]
145 ENABLE = 1,
146}
147impl From<STOPEN_A> for bool {
148 #[inline(always)]
149 fn from(variant: STOPEN_A) -> Self {
150 variant as u8 != 0
151 }
152}
153impl STOPEN_R {
154 #[doc = "Get enumerated values variant"]
155 #[inline(always)]
156 pub fn variant(&self) -> STOPEN_A {
157 match self.bits {
158 false => STOPEN_A::DISABLE,
159 true => STOPEN_A::ENABLE,
160 }
161 }
162 #[doc = "Checks if the value of the field is `DISABLE`"]
163 #[inline(always)]
164 pub fn is_disable(&self) -> bool {
165 *self == STOPEN_A::DISABLE
166 }
167 #[doc = "Checks if the value of the field is `ENABLE`"]
168 #[inline(always)]
169 pub fn is_enable(&self) -> bool {
170 *self == STOPEN_A::ENABLE
171 }
172}
173#[doc = "Field `STOPEN` writer - Allow stopping WDT"]
174pub type STOPEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CONFIG_SPEC, STOPEN_A, O>;
175impl<'a, const O: u8> STOPEN_W<'a, O> {
176 #[doc = "Do not allow stopping WDT"]
177 #[inline(always)]
178 pub fn disable(self) -> &'a mut W {
179 self.variant(STOPEN_A::DISABLE)
180 }
181 #[doc = "Allow stopping WDT"]
182 #[inline(always)]
183 pub fn enable(self) -> &'a mut W {
184 self.variant(STOPEN_A::ENABLE)
185 }
186}
187impl R {
188 #[doc = "Bit 0 - Configure WDT to either be paused, or kept running, while the CPU is sleeping"]
189 #[inline(always)]
190 pub fn sleep(&self) -> SLEEP_R {
191 SLEEP_R::new((self.bits & 1) != 0)
192 }
193 #[doc = "Bit 3 - Configure WDT to either be paused, or kept running, while the CPU is halted by the debugger"]
194 #[inline(always)]
195 pub fn halt(&self) -> HALT_R {
196 HALT_R::new(((self.bits >> 3) & 1) != 0)
197 }
198 #[doc = "Bit 6 - Allow stopping WDT"]
199 #[inline(always)]
200 pub fn stopen(&self) -> STOPEN_R {
201 STOPEN_R::new(((self.bits >> 6) & 1) != 0)
202 }
203}
204impl W {
205 #[doc = "Bit 0 - Configure WDT to either be paused, or kept running, while the CPU is sleeping"]
206 #[inline(always)]
207 pub fn sleep(&mut self) -> SLEEP_W<0> {
208 SLEEP_W::new(self)
209 }
210 #[doc = "Bit 3 - Configure WDT to either be paused, or kept running, while the CPU is halted by the debugger"]
211 #[inline(always)]
212 pub fn halt(&mut self) -> HALT_W<3> {
213 HALT_W::new(self)
214 }
215 #[doc = "Bit 6 - Allow stopping WDT"]
216 #[inline(always)]
217 pub fn stopen(&mut self) -> STOPEN_W<6> {
218 STOPEN_W::new(self)
219 }
220 #[doc = "Writes raw bits to the register."]
221 #[inline(always)]
222 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
223 self.0.bits(bits);
224 self
225 }
226}
227#[doc = "Configuration register\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 [config](index.html) module"]
228pub struct CONFIG_SPEC;
229impl crate::RegisterSpec for CONFIG_SPEC {
230 type Ux = u32;
231}
232#[doc = "`read()` method returns [config::R](R) reader structure"]
233impl crate::Readable for CONFIG_SPEC {
234 type Reader = R;
235}
236#[doc = "`write(|w| ..)` method takes [config::W](W) writer structure"]
237impl crate::Writable for CONFIG_SPEC {
238 type Writer = W;
239}
240#[doc = "`reset()` method sets CONFIG to value 0x01"]
241impl crate::Resettable for CONFIG_SPEC {
242 #[inline(always)]
243 fn reset_value() -> Self::Ux {
244 0x01
245 }
246}