1#[doc = "Register `MOD` reader"]
2pub type R = crate::R<ModSpec>;
3#[doc = "Register `MOD` writer"]
4pub type W = crate::W<ModSpec>;
5#[doc = "Watchdog Enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Wden {
9 #[doc = "0: Timer stopped"]
10 Stop = 0,
11 #[doc = "1: Timer running"]
12 Run = 1,
13}
14impl From<Wden> for bool {
15 #[inline(always)]
16 fn from(variant: Wden) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `WDEN` reader - Watchdog Enable"]
21pub type WdenR = crate::BitReader<Wden>;
22impl WdenR {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> Wden {
26 match self.bits {
27 false => Wden::Stop,
28 true => Wden::Run,
29 }
30 }
31 #[doc = "Timer stopped"]
32 #[inline(always)]
33 pub fn is_stop(&self) -> bool {
34 *self == Wden::Stop
35 }
36 #[doc = "Timer running"]
37 #[inline(always)]
38 pub fn is_run(&self) -> bool {
39 *self == Wden::Run
40 }
41}
42#[doc = "Field `WDEN` writer - Watchdog Enable"]
43pub type WdenW<'a, REG> = crate::BitWriter<'a, REG, Wden>;
44impl<'a, REG> WdenW<'a, REG>
45where
46 REG: crate::Writable + crate::RegisterSpec,
47{
48 #[doc = "Timer stopped"]
49 #[inline(always)]
50 pub fn stop(self) -> &'a mut crate::W<REG> {
51 self.variant(Wden::Stop)
52 }
53 #[doc = "Timer running"]
54 #[inline(always)]
55 pub fn run(self) -> &'a mut crate::W<REG> {
56 self.variant(Wden::Run)
57 }
58}
59#[doc = "Watchdog Reset Enable\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Wdreset {
63 #[doc = "0: Interrupt"]
64 Interrupt = 0,
65 #[doc = "1: Reset"]
66 Reset = 1,
67}
68impl From<Wdreset> for bool {
69 #[inline(always)]
70 fn from(variant: Wdreset) -> Self {
71 variant as u8 != 0
72 }
73}
74#[doc = "Field `WDRESET` reader - Watchdog Reset Enable"]
75pub type WdresetR = crate::BitReader<Wdreset>;
76impl WdresetR {
77 #[doc = "Get enumerated values variant"]
78 #[inline(always)]
79 pub const fn variant(&self) -> Wdreset {
80 match self.bits {
81 false => Wdreset::Interrupt,
82 true => Wdreset::Reset,
83 }
84 }
85 #[doc = "Interrupt"]
86 #[inline(always)]
87 pub fn is_interrupt(&self) -> bool {
88 *self == Wdreset::Interrupt
89 }
90 #[doc = "Reset"]
91 #[inline(always)]
92 pub fn is_reset(&self) -> bool {
93 *self == Wdreset::Reset
94 }
95}
96#[doc = "Field `WDRESET` writer - Watchdog Reset Enable"]
97pub type WdresetW<'a, REG> = crate::BitWriter<'a, REG, Wdreset>;
98impl<'a, REG> WdresetW<'a, REG>
99where
100 REG: crate::Writable + crate::RegisterSpec,
101{
102 #[doc = "Interrupt"]
103 #[inline(always)]
104 pub fn interrupt(self) -> &'a mut crate::W<REG> {
105 self.variant(Wdreset::Interrupt)
106 }
107 #[doc = "Reset"]
108 #[inline(always)]
109 pub fn reset(self) -> &'a mut crate::W<REG> {
110 self.variant(Wdreset::Reset)
111 }
112}
113#[doc = "Watchdog Timeout Flag\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum Wdtof {
117 #[doc = "0: Watchdog event has not occurred."]
118 Clear = 0,
119 #[doc = "1: Watchdog event has occurred (causes a chip reset if WDRESET = 1)."]
120 Reset = 1,
121}
122impl From<Wdtof> for bool {
123 #[inline(always)]
124 fn from(variant: Wdtof) -> Self {
125 variant as u8 != 0
126 }
127}
128#[doc = "Field `WDTOF` reader - Watchdog Timeout Flag"]
129pub type WdtofR = crate::BitReader<Wdtof>;
130impl WdtofR {
131 #[doc = "Get enumerated values variant"]
132 #[inline(always)]
133 pub const fn variant(&self) -> Wdtof {
134 match self.bits {
135 false => Wdtof::Clear,
136 true => Wdtof::Reset,
137 }
138 }
139 #[doc = "Watchdog event has not occurred."]
140 #[inline(always)]
141 pub fn is_clear(&self) -> bool {
142 *self == Wdtof::Clear
143 }
144 #[doc = "Watchdog event has occurred (causes a chip reset if WDRESET = 1)."]
145 #[inline(always)]
146 pub fn is_reset(&self) -> bool {
147 *self == Wdtof::Reset
148 }
149}
150#[doc = "Field `WDTOF` writer - Watchdog Timeout Flag"]
151pub type WdtofW<'a, REG> = crate::BitWriter<'a, REG, Wdtof>;
152impl<'a, REG> WdtofW<'a, REG>
153where
154 REG: crate::Writable + crate::RegisterSpec,
155{
156 #[doc = "Watchdog event has not occurred."]
157 #[inline(always)]
158 pub fn clear(self) -> &'a mut crate::W<REG> {
159 self.variant(Wdtof::Clear)
160 }
161 #[doc = "Watchdog event has occurred (causes a chip reset if WDRESET = 1)."]
162 #[inline(always)]
163 pub fn reset(self) -> &'a mut crate::W<REG> {
164 self.variant(Wdtof::Reset)
165 }
166}
167#[doc = "Warning Interrupt Flag\n\nValue on reset: 0"]
168#[cfg_attr(feature = "defmt", derive(defmt::Format))]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum Wdint {
171 #[doc = "0: No flag"]
172 NoFlag = 0,
173 #[doc = "1: Flag"]
174 Flag = 1,
175}
176impl From<Wdint> for bool {
177 #[inline(always)]
178 fn from(variant: Wdint) -> Self {
179 variant as u8 != 0
180 }
181}
182#[doc = "Field `WDINT` reader - Warning Interrupt Flag"]
183pub type WdintR = crate::BitReader<Wdint>;
184impl WdintR {
185 #[doc = "Get enumerated values variant"]
186 #[inline(always)]
187 pub const fn variant(&self) -> Wdint {
188 match self.bits {
189 false => Wdint::NoFlag,
190 true => Wdint::Flag,
191 }
192 }
193 #[doc = "No flag"]
194 #[inline(always)]
195 pub fn is_no_flag(&self) -> bool {
196 *self == Wdint::NoFlag
197 }
198 #[doc = "Flag"]
199 #[inline(always)]
200 pub fn is_flag(&self) -> bool {
201 *self == Wdint::Flag
202 }
203}
204#[doc = "Field `WDINT` writer - Warning Interrupt Flag"]
205pub type WdintW<'a, REG> = crate::BitWriter1C<'a, REG, Wdint>;
206impl<'a, REG> WdintW<'a, REG>
207where
208 REG: crate::Writable + crate::RegisterSpec,
209{
210 #[doc = "No flag"]
211 #[inline(always)]
212 pub fn no_flag(self) -> &'a mut crate::W<REG> {
213 self.variant(Wdint::NoFlag)
214 }
215 #[doc = "Flag"]
216 #[inline(always)]
217 pub fn flag(self) -> &'a mut crate::W<REG> {
218 self.variant(Wdint::Flag)
219 }
220}
221#[doc = "Watchdog Update Mode\n\nValue on reset: 0"]
222#[cfg_attr(feature = "defmt", derive(defmt::Format))]
223#[derive(Clone, Copy, Debug, PartialEq, Eq)]
224pub enum Wdprotect {
225 #[doc = "0: Flexible"]
226 Flexible = 0,
227 #[doc = "1: Threshold"]
228 Threshold = 1,
229}
230impl From<Wdprotect> for bool {
231 #[inline(always)]
232 fn from(variant: Wdprotect) -> Self {
233 variant as u8 != 0
234 }
235}
236#[doc = "Field `WDPROTECT` reader - Watchdog Update Mode"]
237pub type WdprotectR = crate::BitReader<Wdprotect>;
238impl WdprotectR {
239 #[doc = "Get enumerated values variant"]
240 #[inline(always)]
241 pub const fn variant(&self) -> Wdprotect {
242 match self.bits {
243 false => Wdprotect::Flexible,
244 true => Wdprotect::Threshold,
245 }
246 }
247 #[doc = "Flexible"]
248 #[inline(always)]
249 pub fn is_flexible(&self) -> bool {
250 *self == Wdprotect::Flexible
251 }
252 #[doc = "Threshold"]
253 #[inline(always)]
254 pub fn is_threshold(&self) -> bool {
255 *self == Wdprotect::Threshold
256 }
257}
258#[doc = "Field `WDPROTECT` writer - Watchdog Update Mode"]
259pub type WdprotectW<'a, REG> = crate::BitWriter<'a, REG, Wdprotect>;
260impl<'a, REG> WdprotectW<'a, REG>
261where
262 REG: crate::Writable + crate::RegisterSpec,
263{
264 #[doc = "Flexible"]
265 #[inline(always)]
266 pub fn flexible(self) -> &'a mut crate::W<REG> {
267 self.variant(Wdprotect::Flexible)
268 }
269 #[doc = "Threshold"]
270 #[inline(always)]
271 pub fn threshold(self) -> &'a mut crate::W<REG> {
272 self.variant(Wdprotect::Threshold)
273 }
274}
275#[doc = "Lock\n\nValue on reset: 0"]
276#[cfg_attr(feature = "defmt", derive(defmt::Format))]
277#[derive(Clone, Copy, Debug, PartialEq, Eq)]
278pub enum Lock {
279 #[doc = "0: No Lock"]
280 NoLock = 0,
281 #[doc = "1: Lock"]
282 Lock = 1,
283}
284impl From<Lock> for bool {
285 #[inline(always)]
286 fn from(variant: Lock) -> Self {
287 variant as u8 != 0
288 }
289}
290#[doc = "Field `LOCK` reader - Lock"]
291pub type LockR = crate::BitReader<Lock>;
292impl LockR {
293 #[doc = "Get enumerated values variant"]
294 #[inline(always)]
295 pub const fn variant(&self) -> Lock {
296 match self.bits {
297 false => Lock::NoLock,
298 true => Lock::Lock,
299 }
300 }
301 #[doc = "No Lock"]
302 #[inline(always)]
303 pub fn is_no_lock(&self) -> bool {
304 *self == Lock::NoLock
305 }
306 #[doc = "Lock"]
307 #[inline(always)]
308 pub fn is_lock(&self) -> bool {
309 *self == Lock::Lock
310 }
311}
312#[doc = "Field `LOCK` writer - Lock"]
313pub type LockW<'a, REG> = crate::BitWriter<'a, REG, Lock>;
314impl<'a, REG> LockW<'a, REG>
315where
316 REG: crate::Writable + crate::RegisterSpec,
317{
318 #[doc = "No Lock"]
319 #[inline(always)]
320 pub fn no_lock(self) -> &'a mut crate::W<REG> {
321 self.variant(Lock::NoLock)
322 }
323 #[doc = "Lock"]
324 #[inline(always)]
325 pub fn lock(self) -> &'a mut crate::W<REG> {
326 self.variant(Lock::Lock)
327 }
328}
329#[doc = "Debug Enable\n\nValue on reset: 0"]
330#[cfg_attr(feature = "defmt", derive(defmt::Format))]
331#[derive(Clone, Copy, Debug, PartialEq, Eq)]
332pub enum DebugEn {
333 #[doc = "0: Disabled"]
334 Disable = 0,
335 #[doc = "1: Enabled"]
336 Enable = 1,
337}
338impl From<DebugEn> for bool {
339 #[inline(always)]
340 fn from(variant: DebugEn) -> Self {
341 variant as u8 != 0
342 }
343}
344#[doc = "Field `DEBUG_EN` reader - Debug Enable"]
345pub type DebugEnR = crate::BitReader<DebugEn>;
346impl DebugEnR {
347 #[doc = "Get enumerated values variant"]
348 #[inline(always)]
349 pub const fn variant(&self) -> DebugEn {
350 match self.bits {
351 false => DebugEn::Disable,
352 true => DebugEn::Enable,
353 }
354 }
355 #[doc = "Disabled"]
356 #[inline(always)]
357 pub fn is_disable(&self) -> bool {
358 *self == DebugEn::Disable
359 }
360 #[doc = "Enabled"]
361 #[inline(always)]
362 pub fn is_enable(&self) -> bool {
363 *self == DebugEn::Enable
364 }
365}
366#[doc = "Field `DEBUG_EN` writer - Debug Enable"]
367pub type DebugEnW<'a, REG> = crate::BitWriter<'a, REG, DebugEn>;
368impl<'a, REG> DebugEnW<'a, REG>
369where
370 REG: crate::Writable + crate::RegisterSpec,
371{
372 #[doc = "Disabled"]
373 #[inline(always)]
374 pub fn disable(self) -> &'a mut crate::W<REG> {
375 self.variant(DebugEn::Disable)
376 }
377 #[doc = "Enabled"]
378 #[inline(always)]
379 pub fn enable(self) -> &'a mut crate::W<REG> {
380 self.variant(DebugEn::Enable)
381 }
382}
383impl R {
384 #[doc = "Bit 0 - Watchdog Enable"]
385 #[inline(always)]
386 pub fn wden(&self) -> WdenR {
387 WdenR::new((self.bits & 1) != 0)
388 }
389 #[doc = "Bit 1 - Watchdog Reset Enable"]
390 #[inline(always)]
391 pub fn wdreset(&self) -> WdresetR {
392 WdresetR::new(((self.bits >> 1) & 1) != 0)
393 }
394 #[doc = "Bit 2 - Watchdog Timeout Flag"]
395 #[inline(always)]
396 pub fn wdtof(&self) -> WdtofR {
397 WdtofR::new(((self.bits >> 2) & 1) != 0)
398 }
399 #[doc = "Bit 3 - Warning Interrupt Flag"]
400 #[inline(always)]
401 pub fn wdint(&self) -> WdintR {
402 WdintR::new(((self.bits >> 3) & 1) != 0)
403 }
404 #[doc = "Bit 4 - Watchdog Update Mode"]
405 #[inline(always)]
406 pub fn wdprotect(&self) -> WdprotectR {
407 WdprotectR::new(((self.bits >> 4) & 1) != 0)
408 }
409 #[doc = "Bit 5 - Lock"]
410 #[inline(always)]
411 pub fn lock(&self) -> LockR {
412 LockR::new(((self.bits >> 5) & 1) != 0)
413 }
414 #[doc = "Bit 6 - Debug Enable"]
415 #[inline(always)]
416 pub fn debug_en(&self) -> DebugEnR {
417 DebugEnR::new(((self.bits >> 6) & 1) != 0)
418 }
419}
420#[cfg(feature = "debug")]
421impl core::fmt::Debug for R {
422 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
423 f.debug_struct("MOD")
424 .field("wden", &self.wden())
425 .field("wdreset", &self.wdreset())
426 .field("wdtof", &self.wdtof())
427 .field("wdint", &self.wdint())
428 .field("wdprotect", &self.wdprotect())
429 .field("lock", &self.lock())
430 .field("debug_en", &self.debug_en())
431 .finish()
432 }
433}
434impl W {
435 #[doc = "Bit 0 - Watchdog Enable"]
436 #[inline(always)]
437 pub fn wden(&mut self) -> WdenW<'_, ModSpec> {
438 WdenW::new(self, 0)
439 }
440 #[doc = "Bit 1 - Watchdog Reset Enable"]
441 #[inline(always)]
442 pub fn wdreset(&mut self) -> WdresetW<'_, ModSpec> {
443 WdresetW::new(self, 1)
444 }
445 #[doc = "Bit 2 - Watchdog Timeout Flag"]
446 #[inline(always)]
447 pub fn wdtof(&mut self) -> WdtofW<'_, ModSpec> {
448 WdtofW::new(self, 2)
449 }
450 #[doc = "Bit 3 - Warning Interrupt Flag"]
451 #[inline(always)]
452 pub fn wdint(&mut self) -> WdintW<'_, ModSpec> {
453 WdintW::new(self, 3)
454 }
455 #[doc = "Bit 4 - Watchdog Update Mode"]
456 #[inline(always)]
457 pub fn wdprotect(&mut self) -> WdprotectW<'_, ModSpec> {
458 WdprotectW::new(self, 4)
459 }
460 #[doc = "Bit 5 - Lock"]
461 #[inline(always)]
462 pub fn lock(&mut self) -> LockW<'_, ModSpec> {
463 LockW::new(self, 5)
464 }
465 #[doc = "Bit 6 - Debug Enable"]
466 #[inline(always)]
467 pub fn debug_en(&mut self) -> DebugEnW<'_, ModSpec> {
468 DebugEnW::new(self, 6)
469 }
470}
471#[doc = "Mode\n\nYou can [`read`](crate::Reg::read) this register and get [`mod_::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`mod_::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
472pub struct ModSpec;
473impl crate::RegisterSpec for ModSpec {
474 type Ux = u32;
475}
476#[doc = "`read()` method returns [`mod_::R`](R) reader structure"]
477impl crate::Readable for ModSpec {}
478#[doc = "`write(|w| ..)` method takes [`mod_::W`](W) writer structure"]
479impl crate::Writable for ModSpec {
480 type Safety = crate::Unsafe;
481 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x08;
482}
483#[doc = "`reset()` method sets MOD to value 0"]
484impl crate::Resettable for ModSpec {}