d1_pac/timer/
wdog_ctrl.rs1#[doc = "Register `wdog_ctrl` reader"]
2pub type R = crate::R<WDOG_CTRL_SPEC>;
3#[doc = "Register `wdog_ctrl` writer"]
4pub type W = crate::W<WDOG_CTRL_SPEC>;
5#[doc = "Field `wdog_restart` reader - Watchdog Restart"]
6pub type WDOG_RESTART_R = crate::BitReader<WDOG_RESTART_A>;
7#[doc = "Watchdog Restart\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum WDOG_RESTART_A {
10 #[doc = "0: `0`"]
11 NO_EFFECT = 0,
12 #[doc = "1: `1`"]
13 RESTART = 1,
14}
15impl From<WDOG_RESTART_A> for bool {
16 #[inline(always)]
17 fn from(variant: WDOG_RESTART_A) -> Self {
18 variant as u8 != 0
19 }
20}
21impl WDOG_RESTART_R {
22 #[doc = "Get enumerated values variant"]
23 #[inline(always)]
24 pub const fn variant(&self) -> WDOG_RESTART_A {
25 match self.bits {
26 false => WDOG_RESTART_A::NO_EFFECT,
27 true => WDOG_RESTART_A::RESTART,
28 }
29 }
30 #[doc = "`0`"]
31 #[inline(always)]
32 pub fn is_no_effect(&self) -> bool {
33 *self == WDOG_RESTART_A::NO_EFFECT
34 }
35 #[doc = "`1`"]
36 #[inline(always)]
37 pub fn is_restart(&self) -> bool {
38 *self == WDOG_RESTART_A::RESTART
39 }
40}
41#[doc = "Field `wdog_restart` writer - Watchdog Restart"]
42pub type WDOG_RESTART_W<'a, REG> = crate::BitWriter1S<'a, REG, WDOG_RESTART_A>;
43impl<'a, REG> WDOG_RESTART_W<'a, REG>
44where
45 REG: crate::Writable + crate::RegisterSpec,
46{
47 #[doc = "`0`"]
48 #[inline(always)]
49 pub fn no_effect(self) -> &'a mut crate::W<REG> {
50 self.variant(WDOG_RESTART_A::NO_EFFECT)
51 }
52 #[doc = "`1`"]
53 #[inline(always)]
54 pub fn restart(self) -> &'a mut crate::W<REG> {
55 self.variant(WDOG_RESTART_A::RESTART)
56 }
57}
58#[doc = "Field `wdog_key_field` writer - Watchdog Key Field"]
59pub type WDOG_KEY_FIELD_W<'a, REG> = crate::FieldWriter<'a, REG, 12, u16>;
60impl R {
61 #[doc = "Bit 0 - Watchdog Restart"]
62 #[inline(always)]
63 pub fn wdog_restart(&self) -> WDOG_RESTART_R {
64 WDOG_RESTART_R::new((self.bits & 1) != 0)
65 }
66}
67impl W {
68 #[doc = "Bit 0 - Watchdog Restart"]
69 #[inline(always)]
70 #[must_use]
71 pub fn wdog_restart(&mut self) -> WDOG_RESTART_W<WDOG_CTRL_SPEC> {
72 WDOG_RESTART_W::new(self, 0)
73 }
74 #[doc = "Bits 1:12 - Watchdog Key Field"]
75 #[inline(always)]
76 #[must_use]
77 pub fn wdog_key_field(&mut self) -> WDOG_KEY_FIELD_W<WDOG_CTRL_SPEC> {
78 WDOG_KEY_FIELD_W::new(self, 1)
79 }
80 #[doc = r" Writes raw bits to the register."]
81 #[doc = r""]
82 #[doc = r" # Safety"]
83 #[doc = r""]
84 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
85 #[inline(always)]
86 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
87 self.bits = bits;
88 self
89 }
90}
91#[doc = "Watchdog Control Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`wdog_ctrl::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`wdog_ctrl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
92pub struct WDOG_CTRL_SPEC;
93impl crate::RegisterSpec for WDOG_CTRL_SPEC {
94 type Ux = u32;
95}
96#[doc = "`read()` method returns [`wdog_ctrl::R`](R) reader structure"]
97impl crate::Readable for WDOG_CTRL_SPEC {}
98#[doc = "`write(|w| ..)` method takes [`wdog_ctrl::W`](W) writer structure"]
99impl crate::Writable for WDOG_CTRL_SPEC {
100 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
101 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0x01;
102}
103#[doc = "`reset()` method sets wdog_ctrl to value 0"]
104impl crate::Resettable for WDOG_CTRL_SPEC {
105 const RESET_VALUE: Self::Ux = 0;
106}