1#![allow(clippy::identity_op)]
21#![allow(clippy::module_inception)]
22#![allow(clippy::derivable_impls)]
23#[allow(unused_imports)]
24use crate::common::sealed;
25#[allow(unused_imports)]
26use crate::common::*;
27#[doc = r"Watchdog Timer"]
28unsafe impl ::core::marker::Send for super::Wdt {}
29unsafe impl ::core::marker::Sync for super::Wdt {}
30impl super::Wdt {
31 #[allow(unused)]
32 #[inline(always)]
33 pub(crate) const fn _svd2pac_as_ptr(&self) -> *mut u8 {
34 self.ptr
35 }
36 #[doc = "WDT Refresh Register"]
37 #[inline(always)]
38 pub const fn wdtrr(&self) -> &'static crate::common::Reg<self::Wdtrr_SPEC, crate::common::RW> {
39 unsafe {
40 crate::common::Reg::<self::Wdtrr_SPEC, crate::common::RW>::from_ptr(
41 self._svd2pac_as_ptr().add(0usize),
42 )
43 }
44 }
45
46 #[doc = "WDT Control Register"]
47 #[inline(always)]
48 pub const fn wdtcr(&self) -> &'static crate::common::Reg<self::Wdtcr_SPEC, crate::common::RW> {
49 unsafe {
50 crate::common::Reg::<self::Wdtcr_SPEC, crate::common::RW>::from_ptr(
51 self._svd2pac_as_ptr().add(2usize),
52 )
53 }
54 }
55
56 #[doc = "WDT Status Register"]
57 #[inline(always)]
58 pub const fn wdtsr(&self) -> &'static crate::common::Reg<self::Wdtsr_SPEC, crate::common::RW> {
59 unsafe {
60 crate::common::Reg::<self::Wdtsr_SPEC, crate::common::RW>::from_ptr(
61 self._svd2pac_as_ptr().add(4usize),
62 )
63 }
64 }
65
66 #[doc = "WDT Reset Control Register"]
67 #[inline(always)]
68 pub const fn wdtrcr(
69 &self,
70 ) -> &'static crate::common::Reg<self::Wdtrcr_SPEC, crate::common::RW> {
71 unsafe {
72 crate::common::Reg::<self::Wdtrcr_SPEC, crate::common::RW>::from_ptr(
73 self._svd2pac_as_ptr().add(6usize),
74 )
75 }
76 }
77
78 #[doc = "WDT Count Stop Control Register"]
79 #[inline(always)]
80 pub const fn wdtcstpr(
81 &self,
82 ) -> &'static crate::common::Reg<self::Wdtcstpr_SPEC, crate::common::RW> {
83 unsafe {
84 crate::common::Reg::<self::Wdtcstpr_SPEC, crate::common::RW>::from_ptr(
85 self._svd2pac_as_ptr().add(8usize),
86 )
87 }
88 }
89}
90#[doc(hidden)]
91#[derive(Copy, Clone, Eq, PartialEq)]
92pub struct Wdtrr_SPEC;
93impl crate::sealed::RegSpec for Wdtrr_SPEC {
94 type DataType = u8;
95}
96#[doc = "WDT Refresh Register"]
97pub type Wdtrr = crate::RegValueT<Wdtrr_SPEC>;
98
99impl NoBitfieldReg<Wdtrr_SPEC> for Wdtrr {}
100impl ::core::default::Default for Wdtrr {
101 #[inline(always)]
102 fn default() -> Wdtrr {
103 <crate::RegValueT<Wdtrr_SPEC> as RegisterValue<_>>::new(255)
104 }
105}
106
107#[doc(hidden)]
108#[derive(Copy, Clone, Eq, PartialEq)]
109pub struct Wdtcr_SPEC;
110impl crate::sealed::RegSpec for Wdtcr_SPEC {
111 type DataType = u16;
112}
113#[doc = "WDT Control Register"]
114pub type Wdtcr = crate::RegValueT<Wdtcr_SPEC>;
115
116impl Wdtcr {
117 #[doc = "Timeout Period Select"]
118 #[inline(always)]
119 pub fn tops(
120 self,
121 ) -> crate::common::RegisterField<0, 0x3, 1, 0, wdtcr::Tops, Wdtcr_SPEC, crate::common::RW>
122 {
123 crate::common::RegisterField::<0,0x3,1,0,wdtcr::Tops, Wdtcr_SPEC,crate::common::RW>::from_register(self,0)
124 }
125 #[doc = "Clock Division Ratio Select"]
126 #[inline(always)]
127 pub fn cks(
128 self,
129 ) -> crate::common::RegisterField<4, 0xf, 1, 0, wdtcr::Cks, Wdtcr_SPEC, crate::common::RW> {
130 crate::common::RegisterField::<4,0xf,1,0,wdtcr::Cks, Wdtcr_SPEC,crate::common::RW>::from_register(self,0)
131 }
132 #[doc = "Window End Position Select"]
133 #[inline(always)]
134 pub fn rpes(
135 self,
136 ) -> crate::common::RegisterField<8, 0x3, 1, 0, wdtcr::Rpes, Wdtcr_SPEC, crate::common::RW>
137 {
138 crate::common::RegisterField::<8,0x3,1,0,wdtcr::Rpes, Wdtcr_SPEC,crate::common::RW>::from_register(self,0)
139 }
140 #[doc = "Window Start Position Select"]
141 #[inline(always)]
142 pub fn rpss(
143 self,
144 ) -> crate::common::RegisterField<12, 0x3, 1, 0, wdtcr::Rpss, Wdtcr_SPEC, crate::common::RW>
145 {
146 crate::common::RegisterField::<12,0x3,1,0,wdtcr::Rpss, Wdtcr_SPEC,crate::common::RW>::from_register(self,0)
147 }
148}
149impl ::core::default::Default for Wdtcr {
150 #[inline(always)]
151 fn default() -> Wdtcr {
152 <crate::RegValueT<Wdtcr_SPEC> as RegisterValue<_>>::new(13299)
153 }
154}
155pub mod wdtcr {
156
157 #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
158 pub struct Tops_SPEC;
159 pub type Tops = crate::EnumBitfieldStruct<u8, Tops_SPEC>;
160 impl Tops {
161 #[doc = "1024 cycles (0x03FF)"]
162 pub const _00: Self = Self::new(0);
163 #[doc = "4096 cycles (0x0FFF)"]
164 pub const _01: Self = Self::new(1);
165 #[doc = "8192 cycles (0x1FFF)"]
166 pub const _10: Self = Self::new(2);
167 #[doc = "16384 cycles (0x3FFF)"]
168 pub const _11: Self = Self::new(3);
169 }
170 #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
171 pub struct Cks_SPEC;
172 pub type Cks = crate::EnumBitfieldStruct<u8, Cks_SPEC>;
173 impl Cks {
174 #[doc = "PCLKB/4"]
175 pub const _0_X_1: Self = Self::new(1);
176 #[doc = "PCLKB/64"]
177 pub const _0_X_4: Self = Self::new(4);
178 #[doc = "PCLKB/128"]
179 pub const _0_X_F: Self = Self::new(15);
180 #[doc = "PCLKB/512"]
181 pub const _0_X_6: Self = Self::new(6);
182 #[doc = "PCLKB/2048"]
183 pub const _0_X_7: Self = Self::new(7);
184 #[doc = "PCLKB/8192"]
185 pub const _0_X_8: Self = Self::new(8);
186 #[doc = "Setting prohibited"]
187 pub const OTHERS: Self = Self::new(0);
188 }
189 #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
190 pub struct Rpes_SPEC;
191 pub type Rpes = crate::EnumBitfieldStruct<u8, Rpes_SPEC>;
192 impl Rpes {
193 #[doc = "75%"]
194 pub const _00: Self = Self::new(0);
195 #[doc = "50%"]
196 pub const _01: Self = Self::new(1);
197 #[doc = "25%"]
198 pub const _10: Self = Self::new(2);
199 #[doc = "0% (do not specify window end position)."]
200 pub const _11: Self = Self::new(3);
201 }
202 #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
203 pub struct Rpss_SPEC;
204 pub type Rpss = crate::EnumBitfieldStruct<u8, Rpss_SPEC>;
205 impl Rpss {
206 #[doc = "25%"]
207 pub const _00: Self = Self::new(0);
208 #[doc = "50%"]
209 pub const _01: Self = Self::new(1);
210 #[doc = "75%"]
211 pub const _10: Self = Self::new(2);
212 #[doc = "100% (do not specify window start position)."]
213 pub const _11: Self = Self::new(3);
214 }
215}
216#[doc(hidden)]
217#[derive(Copy, Clone, Eq, PartialEq)]
218pub struct Wdtsr_SPEC;
219impl crate::sealed::RegSpec for Wdtsr_SPEC {
220 type DataType = u16;
221}
222#[doc = "WDT Status Register"]
223pub type Wdtsr = crate::RegValueT<Wdtsr_SPEC>;
224
225impl Wdtsr {
226 #[doc = "Down-Counter Value"]
227 #[inline(always)]
228 pub fn cntval(
229 self,
230 ) -> crate::common::RegisterField<0, 0x3fff, 1, 0, u16, Wdtsr_SPEC, crate::common::R> {
231 crate::common::RegisterField::<0,0x3fff,1,0,u16, Wdtsr_SPEC,crate::common::R>::from_register(self,0)
232 }
233 #[doc = "Underflow Flag"]
234 #[inline(always)]
235 pub fn undff(
236 self,
237 ) -> crate::common::RegisterField<14, 0x1, 1, 0, wdtsr::Undff, Wdtsr_SPEC, crate::common::RW>
238 {
239 crate::common::RegisterField::<14,0x1,1,0,wdtsr::Undff, Wdtsr_SPEC,crate::common::RW>::from_register(self,0)
240 }
241 #[doc = "Refresh Error Flag"]
242 #[inline(always)]
243 pub fn refef(
244 self,
245 ) -> crate::common::RegisterField<15, 0x1, 1, 0, wdtsr::Refef, Wdtsr_SPEC, crate::common::RW>
246 {
247 crate::common::RegisterField::<15,0x1,1,0,wdtsr::Refef, Wdtsr_SPEC,crate::common::RW>::from_register(self,0)
248 }
249}
250impl ::core::default::Default for Wdtsr {
251 #[inline(always)]
252 fn default() -> Wdtsr {
253 <crate::RegValueT<Wdtsr_SPEC> as RegisterValue<_>>::new(0)
254 }
255}
256pub mod wdtsr {
257
258 #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
259 pub struct Undff_SPEC;
260 pub type Undff = crate::EnumBitfieldStruct<u8, Undff_SPEC>;
261 impl Undff {
262 #[doc = "No underflow occurred"]
263 pub const _0: Self = Self::new(0);
264 #[doc = "Underflow occurred"]
265 pub const _1: Self = Self::new(1);
266 }
267 #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
268 pub struct Refef_SPEC;
269 pub type Refef = crate::EnumBitfieldStruct<u8, Refef_SPEC>;
270 impl Refef {
271 #[doc = "No refresh error occurred"]
272 pub const _0: Self = Self::new(0);
273 #[doc = "Refresh error occurred"]
274 pub const _1: Self = Self::new(1);
275 }
276}
277#[doc(hidden)]
278#[derive(Copy, Clone, Eq, PartialEq)]
279pub struct Wdtrcr_SPEC;
280impl crate::sealed::RegSpec for Wdtrcr_SPEC {
281 type DataType = u8;
282}
283#[doc = "WDT Reset Control Register"]
284pub type Wdtrcr = crate::RegValueT<Wdtrcr_SPEC>;
285
286impl Wdtrcr {
287 #[doc = "WDT Behavior Selection"]
288 #[inline(always)]
289 pub fn rstirqs(
290 self,
291 ) -> crate::common::RegisterField<7, 0x1, 1, 0, wdtrcr::Rstirqs, Wdtrcr_SPEC, crate::common::RW>
292 {
293 crate::common::RegisterField::<7,0x1,1,0,wdtrcr::Rstirqs, Wdtrcr_SPEC,crate::common::RW>::from_register(self,0)
294 }
295}
296impl ::core::default::Default for Wdtrcr {
297 #[inline(always)]
298 fn default() -> Wdtrcr {
299 <crate::RegValueT<Wdtrcr_SPEC> as RegisterValue<_>>::new(128)
300 }
301}
302pub mod wdtrcr {
303
304 #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
305 pub struct Rstirqs_SPEC;
306 pub type Rstirqs = crate::EnumBitfieldStruct<u8, Rstirqs_SPEC>;
307 impl Rstirqs {
308 #[doc = "Interrupt"]
309 pub const _0: Self = Self::new(0);
310 #[doc = "Reset"]
311 pub const _1: Self = Self::new(1);
312 }
313}
314#[doc(hidden)]
315#[derive(Copy, Clone, Eq, PartialEq)]
316pub struct Wdtcstpr_SPEC;
317impl crate::sealed::RegSpec for Wdtcstpr_SPEC {
318 type DataType = u8;
319}
320#[doc = "WDT Count Stop Control Register"]
321pub type Wdtcstpr = crate::RegValueT<Wdtcstpr_SPEC>;
322
323impl Wdtcstpr {
324 #[doc = "Sleep-Mode Count Stop Control"]
325 #[inline(always)]
326 pub fn slcstp(
327 self,
328 ) -> crate::common::RegisterField<
329 7,
330 0x1,
331 1,
332 0,
333 wdtcstpr::Slcstp,
334 Wdtcstpr_SPEC,
335 crate::common::RW,
336 > {
337 crate::common::RegisterField::<
338 7,
339 0x1,
340 1,
341 0,
342 wdtcstpr::Slcstp,
343 Wdtcstpr_SPEC,
344 crate::common::RW,
345 >::from_register(self, 0)
346 }
347}
348impl ::core::default::Default for Wdtcstpr {
349 #[inline(always)]
350 fn default() -> Wdtcstpr {
351 <crate::RegValueT<Wdtcstpr_SPEC> as RegisterValue<_>>::new(128)
352 }
353}
354pub mod wdtcstpr {
355
356 #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
357 pub struct Slcstp_SPEC;
358 pub type Slcstp = crate::EnumBitfieldStruct<u8, Slcstp_SPEC>;
359 impl Slcstp {
360 #[doc = "Disable count stop"]
361 pub const _0: Self = Self::new(0);
362 #[doc = "Stop count on transition to Sleep mode"]
363 pub const _1: Self = Self::new(1);
364 }
365}