efm32jg1b_pac/efm32jg1b100/wdog0/
ctrl.rs1#[doc = "Register `CTRL` reader"]
2pub struct R(crate::R<CTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CTRL` writer"]
17pub struct W(crate::W<CTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CTRL_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<CTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `EN` reader - Watchdog Timer Enable"]
38pub type EN_R = crate::BitReader<bool>;
39#[doc = "Field `EN` writer - Watchdog Timer Enable"]
40pub type EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
41#[doc = "Field `DEBUGRUN` reader - Debug Mode Run Enable"]
42pub type DEBUGRUN_R = crate::BitReader<bool>;
43#[doc = "Field `DEBUGRUN` writer - Debug Mode Run Enable"]
44pub type DEBUGRUN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
45#[doc = "Field `EM2RUN` reader - Energy Mode 2 Run Enable"]
46pub type EM2RUN_R = crate::BitReader<bool>;
47#[doc = "Field `EM2RUN` writer - Energy Mode 2 Run Enable"]
48pub type EM2RUN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
49#[doc = "Field `EM3RUN` reader - Energy Mode 3 Run Enable"]
50pub type EM3RUN_R = crate::BitReader<bool>;
51#[doc = "Field `EM3RUN` writer - Energy Mode 3 Run Enable"]
52pub type EM3RUN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
53#[doc = "Field `LOCK` reader - Configuration Lock"]
54pub type LOCK_R = crate::BitReader<bool>;
55#[doc = "Field `LOCK` writer - Configuration Lock"]
56pub type LOCK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
57#[doc = "Field `EM4BLOCK` reader - Energy Mode 4 Block"]
58pub type EM4BLOCK_R = crate::BitReader<bool>;
59#[doc = "Field `EM4BLOCK` writer - Energy Mode 4 Block"]
60pub type EM4BLOCK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
61#[doc = "Field `SWOSCBLOCK` reader - Software Oscillator Disable Block"]
62pub type SWOSCBLOCK_R = crate::BitReader<bool>;
63#[doc = "Field `SWOSCBLOCK` writer - Software Oscillator Disable Block"]
64pub type SWOSCBLOCK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
65#[doc = "Field `PERSEL` reader - Watchdog Timeout Period Select"]
66pub type PERSEL_R = crate::FieldReader<u8, u8>;
67#[doc = "Field `PERSEL` writer - Watchdog Timeout Period Select"]
68pub type PERSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, u8, 4, O>;
69#[doc = "Field `CLKSEL` reader - Watchdog Clock Select"]
70pub type CLKSEL_R = crate::FieldReader<u8, CLKSEL_A>;
71#[doc = "Watchdog Clock Select\n\nValue on reset: 0"]
72#[derive(Clone, Copy, Debug, PartialEq, Eq)]
73#[repr(u8)]
74pub enum CLKSEL_A {
75 #[doc = "0: ULFRCO"]
76 ULFRCO = 0,
77 #[doc = "1: LFRCO"]
78 LFRCO = 1,
79 #[doc = "2: LFXO"]
80 LFXO = 2,
81}
82impl From<CLKSEL_A> for u8 {
83 #[inline(always)]
84 fn from(variant: CLKSEL_A) -> Self {
85 variant as _
86 }
87}
88impl CLKSEL_R {
89 #[doc = "Get enumerated values variant"]
90 #[inline(always)]
91 pub fn variant(&self) -> Option<CLKSEL_A> {
92 match self.bits {
93 0 => Some(CLKSEL_A::ULFRCO),
94 1 => Some(CLKSEL_A::LFRCO),
95 2 => Some(CLKSEL_A::LFXO),
96 _ => None,
97 }
98 }
99 #[doc = "Checks if the value of the field is `ULFRCO`"]
100 #[inline(always)]
101 pub fn is_ulfrco(&self) -> bool {
102 *self == CLKSEL_A::ULFRCO
103 }
104 #[doc = "Checks if the value of the field is `LFRCO`"]
105 #[inline(always)]
106 pub fn is_lfrco(&self) -> bool {
107 *self == CLKSEL_A::LFRCO
108 }
109 #[doc = "Checks if the value of the field is `LFXO`"]
110 #[inline(always)]
111 pub fn is_lfxo(&self) -> bool {
112 *self == CLKSEL_A::LFXO
113 }
114}
115#[doc = "Field `CLKSEL` writer - Watchdog Clock Select"]
116pub type CLKSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, CLKSEL_A, 2, O>;
117impl<'a, const O: u8> CLKSEL_W<'a, O> {
118 #[doc = "ULFRCO"]
119 #[inline(always)]
120 pub fn ulfrco(self) -> &'a mut W {
121 self.variant(CLKSEL_A::ULFRCO)
122 }
123 #[doc = "LFRCO"]
124 #[inline(always)]
125 pub fn lfrco(self) -> &'a mut W {
126 self.variant(CLKSEL_A::LFRCO)
127 }
128 #[doc = "LFXO"]
129 #[inline(always)]
130 pub fn lfxo(self) -> &'a mut W {
131 self.variant(CLKSEL_A::LFXO)
132 }
133}
134#[doc = "Field `WARNSEL` reader - Watchdog Timeout Period Select"]
135pub type WARNSEL_R = crate::FieldReader<u8, u8>;
136#[doc = "Field `WARNSEL` writer - Watchdog Timeout Period Select"]
137pub type WARNSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, u8, 2, O>;
138#[doc = "Field `WINSEL` reader - Watchdog Illegal Window Select"]
139pub type WINSEL_R = crate::FieldReader<u8, u8>;
140#[doc = "Field `WINSEL` writer - Watchdog Illegal Window Select"]
141pub type WINSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, u8, 3, O>;
142#[doc = "Field `CLRSRC` reader - Watchdog Clear Source"]
143pub type CLRSRC_R = crate::BitReader<bool>;
144#[doc = "Field `CLRSRC` writer - Watchdog Clear Source"]
145pub type CLRSRC_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
146#[doc = "Field `WDOGRSTDIS` reader - Watchdog Reset Disable"]
147pub type WDOGRSTDIS_R = crate::BitReader<bool>;
148#[doc = "Field `WDOGRSTDIS` writer - Watchdog Reset Disable"]
149pub type WDOGRSTDIS_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
150impl R {
151 #[doc = "Bit 0 - Watchdog Timer Enable"]
152 #[inline(always)]
153 pub fn en(&self) -> EN_R {
154 EN_R::new((self.bits & 1) != 0)
155 }
156 #[doc = "Bit 1 - Debug Mode Run Enable"]
157 #[inline(always)]
158 pub fn debugrun(&self) -> DEBUGRUN_R {
159 DEBUGRUN_R::new(((self.bits >> 1) & 1) != 0)
160 }
161 #[doc = "Bit 2 - Energy Mode 2 Run Enable"]
162 #[inline(always)]
163 pub fn em2run(&self) -> EM2RUN_R {
164 EM2RUN_R::new(((self.bits >> 2) & 1) != 0)
165 }
166 #[doc = "Bit 3 - Energy Mode 3 Run Enable"]
167 #[inline(always)]
168 pub fn em3run(&self) -> EM3RUN_R {
169 EM3RUN_R::new(((self.bits >> 3) & 1) != 0)
170 }
171 #[doc = "Bit 4 - Configuration Lock"]
172 #[inline(always)]
173 pub fn lock(&self) -> LOCK_R {
174 LOCK_R::new(((self.bits >> 4) & 1) != 0)
175 }
176 #[doc = "Bit 5 - Energy Mode 4 Block"]
177 #[inline(always)]
178 pub fn em4block(&self) -> EM4BLOCK_R {
179 EM4BLOCK_R::new(((self.bits >> 5) & 1) != 0)
180 }
181 #[doc = "Bit 6 - Software Oscillator Disable Block"]
182 #[inline(always)]
183 pub fn swoscblock(&self) -> SWOSCBLOCK_R {
184 SWOSCBLOCK_R::new(((self.bits >> 6) & 1) != 0)
185 }
186 #[doc = "Bits 8:11 - Watchdog Timeout Period Select"]
187 #[inline(always)]
188 pub fn persel(&self) -> PERSEL_R {
189 PERSEL_R::new(((self.bits >> 8) & 0x0f) as u8)
190 }
191 #[doc = "Bits 12:13 - Watchdog Clock Select"]
192 #[inline(always)]
193 pub fn clksel(&self) -> CLKSEL_R {
194 CLKSEL_R::new(((self.bits >> 12) & 3) as u8)
195 }
196 #[doc = "Bits 16:17 - Watchdog Timeout Period Select"]
197 #[inline(always)]
198 pub fn warnsel(&self) -> WARNSEL_R {
199 WARNSEL_R::new(((self.bits >> 16) & 3) as u8)
200 }
201 #[doc = "Bits 24:26 - Watchdog Illegal Window Select"]
202 #[inline(always)]
203 pub fn winsel(&self) -> WINSEL_R {
204 WINSEL_R::new(((self.bits >> 24) & 7) as u8)
205 }
206 #[doc = "Bit 30 - Watchdog Clear Source"]
207 #[inline(always)]
208 pub fn clrsrc(&self) -> CLRSRC_R {
209 CLRSRC_R::new(((self.bits >> 30) & 1) != 0)
210 }
211 #[doc = "Bit 31 - Watchdog Reset Disable"]
212 #[inline(always)]
213 pub fn wdogrstdis(&self) -> WDOGRSTDIS_R {
214 WDOGRSTDIS_R::new(((self.bits >> 31) & 1) != 0)
215 }
216}
217impl W {
218 #[doc = "Bit 0 - Watchdog Timer Enable"]
219 #[inline(always)]
220 #[must_use]
221 pub fn en(&mut self) -> EN_W<0> {
222 EN_W::new(self)
223 }
224 #[doc = "Bit 1 - Debug Mode Run Enable"]
225 #[inline(always)]
226 #[must_use]
227 pub fn debugrun(&mut self) -> DEBUGRUN_W<1> {
228 DEBUGRUN_W::new(self)
229 }
230 #[doc = "Bit 2 - Energy Mode 2 Run Enable"]
231 #[inline(always)]
232 #[must_use]
233 pub fn em2run(&mut self) -> EM2RUN_W<2> {
234 EM2RUN_W::new(self)
235 }
236 #[doc = "Bit 3 - Energy Mode 3 Run Enable"]
237 #[inline(always)]
238 #[must_use]
239 pub fn em3run(&mut self) -> EM3RUN_W<3> {
240 EM3RUN_W::new(self)
241 }
242 #[doc = "Bit 4 - Configuration Lock"]
243 #[inline(always)]
244 #[must_use]
245 pub fn lock(&mut self) -> LOCK_W<4> {
246 LOCK_W::new(self)
247 }
248 #[doc = "Bit 5 - Energy Mode 4 Block"]
249 #[inline(always)]
250 #[must_use]
251 pub fn em4block(&mut self) -> EM4BLOCK_W<5> {
252 EM4BLOCK_W::new(self)
253 }
254 #[doc = "Bit 6 - Software Oscillator Disable Block"]
255 #[inline(always)]
256 #[must_use]
257 pub fn swoscblock(&mut self) -> SWOSCBLOCK_W<6> {
258 SWOSCBLOCK_W::new(self)
259 }
260 #[doc = "Bits 8:11 - Watchdog Timeout Period Select"]
261 #[inline(always)]
262 #[must_use]
263 pub fn persel(&mut self) -> PERSEL_W<8> {
264 PERSEL_W::new(self)
265 }
266 #[doc = "Bits 12:13 - Watchdog Clock Select"]
267 #[inline(always)]
268 #[must_use]
269 pub fn clksel(&mut self) -> CLKSEL_W<12> {
270 CLKSEL_W::new(self)
271 }
272 #[doc = "Bits 16:17 - Watchdog Timeout Period Select"]
273 #[inline(always)]
274 #[must_use]
275 pub fn warnsel(&mut self) -> WARNSEL_W<16> {
276 WARNSEL_W::new(self)
277 }
278 #[doc = "Bits 24:26 - Watchdog Illegal Window Select"]
279 #[inline(always)]
280 #[must_use]
281 pub fn winsel(&mut self) -> WINSEL_W<24> {
282 WINSEL_W::new(self)
283 }
284 #[doc = "Bit 30 - Watchdog Clear Source"]
285 #[inline(always)]
286 #[must_use]
287 pub fn clrsrc(&mut self) -> CLRSRC_W<30> {
288 CLRSRC_W::new(self)
289 }
290 #[doc = "Bit 31 - Watchdog Reset Disable"]
291 #[inline(always)]
292 #[must_use]
293 pub fn wdogrstdis(&mut self) -> WDOGRSTDIS_W<31> {
294 WDOGRSTDIS_W::new(self)
295 }
296 #[doc = "Writes raw bits to the register."]
297 #[inline(always)]
298 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
299 self.0.bits(bits);
300 self
301 }
302}
303#[doc = "Control 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 [ctrl](index.html) module"]
304pub struct CTRL_SPEC;
305impl crate::RegisterSpec for CTRL_SPEC {
306 type Ux = u32;
307}
308#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
309impl crate::Readable for CTRL_SPEC {
310 type Reader = R;
311}
312#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
313impl crate::Writable for CTRL_SPEC {
314 type Writer = W;
315 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
316 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
317}
318#[doc = "`reset()` method sets CTRL to value 0x0f00"]
319impl crate::Resettable for CTRL_SPEC {
320 const RESET_VALUE: Self::Ux = 0x0f00;
321}