1#[doc = "Register `CONFIG` reader"]
2pub struct R(crate::R<CONFIG_SPEC>);
3impl core::ops::Deref for R {
4type Target = crate::R<CONFIG_SPEC>;
5#[inline(always)]
6fn deref(&self) -> &Self::Target {
7&self.0
8}
9}
10impl From<crate::R<CONFIG_SPEC>> for R {
11#[inline(always)]
12fn 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 {
19type Target = crate::W<CONFIG_SPEC>;
20#[inline(always)]
21fn deref(&self) -> &Self::Target {
22&self.0
23}
24}
25impl core::ops::DerefMut for W {
26#[inline(always)]
27fn deref_mut(&mut self) -> &mut Self::Target {
28&mut self.0
29}
30}
31impl From<crate::W<CONFIG_SPEC>> for W {
32#[inline(always)]
33fn from(writer: crate::W<CONFIG_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `SLEEP` reader - Configure the watchdog to either be paused, or kept running, while the CPU is sleeping"]
38pub type SLEEP_R = crate::BitReader<SLEEP_A>;
39#[doc = "Configure the watchdog 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 watchdog while the CPU is sleeping"]
43PAUSE = 0,
44#[doc = "1: Keep the watchdog running while the CPU is sleeping"]
45RUN = 1,
46}
47impl From<SLEEP_A> for bool {
48#[inline(always)]
49fn from(variant: SLEEP_A) -> Self {
50 variant as u8 != 0
51}
52}
53impl SLEEP_R {
54#[doc = "Get enumerated values variant"]
55 #[inline(always)]
56pub fn variant(&self) -> SLEEP_A {
57match self.bits {
58false => SLEEP_A::PAUSE,
59true => SLEEP_A::RUN,
60 }
61 }
62#[doc = "Checks if the value of the field is `PAUSE`"]
63 #[inline(always)]
64pub 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)]
69pub fn is_run(&self) -> bool {
70*self == SLEEP_A::RUN
71 }
72}
73#[doc = "Field `SLEEP` writer - Configure the watchdog 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 watchdog while the CPU is sleeping"]
77 #[inline(always)]
78pub fn pause(self) -> &'a mut W {
79self.variant(SLEEP_A::PAUSE)
80 }
81#[doc = "Keep the watchdog running while the CPU is sleeping"]
82 #[inline(always)]
83pub fn run(self) -> &'a mut W {
84self.variant(SLEEP_A::RUN)
85 }
86}
87#[doc = "Field `HALT` reader - Configure the watchdog 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 the watchdog 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 watchdog while the CPU is halted by the debugger"]
93PAUSE = 0,
94#[doc = "1: Keep the watchdog running while the CPU is halted by the debugger"]
95RUN = 1,
96}
97impl From<HALT_A> for bool {
98#[inline(always)]
99fn from(variant: HALT_A) -> Self {
100 variant as u8 != 0
101}
102}
103impl HALT_R {
104#[doc = "Get enumerated values variant"]
105 #[inline(always)]
106pub fn variant(&self) -> HALT_A {
107match self.bits {
108false => HALT_A::PAUSE,
109true => HALT_A::RUN,
110 }
111 }
112#[doc = "Checks if the value of the field is `PAUSE`"]
113 #[inline(always)]
114pub 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)]
119pub fn is_run(&self) -> bool {
120*self == HALT_A::RUN
121 }
122}
123#[doc = "Field `HALT` writer - Configure the watchdog 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 watchdog while the CPU is halted by the debugger"]
127 #[inline(always)]
128pub fn pause(self) -> &'a mut W {
129self.variant(HALT_A::PAUSE)
130 }
131#[doc = "Keep the watchdog running while the CPU is halted by the debugger"]
132 #[inline(always)]
133pub fn run(self) -> &'a mut W {
134self.variant(HALT_A::RUN)
135 }
136}
137impl R {
138#[doc = "Bit 0 - Configure the watchdog to either be paused, or kept running, while the CPU is sleeping"]
139 #[inline(always)]
140pub fn sleep(&self) -> SLEEP_R {
141 SLEEP_R::new((self.bits & 1) != 0)
142 }
143#[doc = "Bit 3 - Configure the watchdog to either be paused, or kept running, while the CPU is halted by the debugger"]
144 #[inline(always)]
145pub fn halt(&self) -> HALT_R {
146 HALT_R::new(((self.bits >> 3) & 1) != 0)
147 }
148}
149impl W {
150#[doc = "Bit 0 - Configure the watchdog to either be paused, or kept running, while the CPU is sleeping"]
151 #[inline(always)]
152pub fn sleep(&mut self) -> SLEEP_W<0> {
153 SLEEP_W::new(self)
154 }
155#[doc = "Bit 3 - Configure the watchdog to either be paused, or kept running, while the CPU is halted by the debugger"]
156 #[inline(always)]
157pub fn halt(&mut self) -> HALT_W<3> {
158 HALT_W::new(self)
159 }
160#[doc = "Writes raw bits to the register."]
161 #[inline(always)]
162pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
163self.0.bits(bits);
164self
165}
166}
167#[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"]
168pub struct CONFIG_SPEC;
169impl crate::RegisterSpec for CONFIG_SPEC {
170type Ux = u32;
171}
172#[doc = "`read()` method returns [config::R](R) reader structure"]
173impl crate::Readable for CONFIG_SPEC {
174type Reader = R;
175}
176#[doc = "`write(|w| ..)` method takes [config::W](W) writer structure"]
177impl crate::Writable for CONFIG_SPEC {
178type Writer = W;
179}
180#[doc = "`reset()` method sets CONFIG to value 0x01"]
181impl crate::Resettable for CONFIG_SPEC {
182#[inline(always)]
183fn reset_value() -> Self::Ux {
1840x01
185}
186}