1#![allow(clippy::missing_safety_doc)]
2#![allow(clippy::identity_op)]
3#![allow(clippy::unnecessary_cast)]
4#![allow(clippy::erasing_op)]
5
6#[doc = "Real-time clock"]
7#[derive(Copy, Clone, Eq, PartialEq)]
8pub struct Rtc {
9 ptr: *mut u8,
10}
11unsafe impl Send for Rtc {}
12unsafe impl Sync for Rtc {}
13impl Rtc {
14 #[inline(always)]
15 pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
16 Self { ptr: ptr as _ }
17 }
18 #[inline(always)]
19 pub const fn as_ptr(&self) -> *mut () {
20 self.ptr as _
21 }
22 #[doc = "Time register"]
23 #[inline(always)]
24 pub const fn tr(self) -> crate::common::Reg<regs::Tr, crate::common::RW> {
25 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0usize) as _) }
26 }
27 #[doc = "Date register"]
28 #[inline(always)]
29 pub const fn dr(self) -> crate::common::Reg<regs::Dr, crate::common::RW> {
30 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x04usize) as _) }
31 }
32 #[doc = "Sub second register"]
33 #[inline(always)]
34 pub const fn ssr(self) -> crate::common::Reg<regs::Ssr, crate::common::R> {
35 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x08usize) as _) }
36 }
37 #[doc = "Initialization control and status register"]
38 #[inline(always)]
39 pub const fn icsr(self) -> crate::common::Reg<regs::Icsr, crate::common::RW> {
40 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0cusize) as _) }
41 }
42 #[doc = "Prescaler register"]
43 #[inline(always)]
44 pub const fn prer(self) -> crate::common::Reg<regs::Prer, crate::common::RW> {
45 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x10usize) as _) }
46 }
47 #[doc = "Wakeup timer register"]
48 #[inline(always)]
49 pub const fn wutr(self) -> crate::common::Reg<regs::Wutr, crate::common::RW> {
50 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x14usize) as _) }
51 }
52 #[doc = "Control register"]
53 #[inline(always)]
54 pub const fn cr(self) -> crate::common::Reg<regs::Cr, crate::common::RW> {
55 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x18usize) as _) }
56 }
57 #[doc = "Privilege mode control register"]
58 #[inline(always)]
59 pub const fn privcr(self) -> crate::common::Reg<regs::Privcr, crate::common::RW> {
60 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x1cusize) as _) }
61 }
62 #[doc = "Secure mode control register"]
63 #[inline(always)]
64 pub const fn seccfgr(self) -> crate::common::Reg<regs::Seccfgr, crate::common::RW> {
65 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x20usize) as _) }
66 }
67 #[doc = "Write protection register"]
68 #[inline(always)]
69 pub const fn wpr(self) -> crate::common::Reg<regs::Wpr, crate::common::W> {
70 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x24usize) as _) }
71 }
72 #[doc = "Calibration register"]
73 #[inline(always)]
74 pub const fn calr(self) -> crate::common::Reg<regs::Calr, crate::common::RW> {
75 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x28usize) as _) }
76 }
77 #[doc = "Shift control register"]
78 #[inline(always)]
79 pub const fn shiftr(self) -> crate::common::Reg<regs::Shiftr, crate::common::W> {
80 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x2cusize) as _) }
81 }
82 #[doc = "Timestamp time register"]
83 #[inline(always)]
84 pub const fn tstr(self) -> crate::common::Reg<regs::Tstr, crate::common::R> {
85 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x30usize) as _) }
86 }
87 #[doc = "Timestamp date register"]
88 #[inline(always)]
89 pub const fn tsdr(self) -> crate::common::Reg<regs::Tsdr, crate::common::R> {
90 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x34usize) as _) }
91 }
92 #[doc = "Timestamp sub second register"]
93 #[inline(always)]
94 pub const fn tsssr(self) -> crate::common::Reg<regs::Tsssr, crate::common::R> {
95 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x38usize) as _) }
96 }
97 #[doc = "Alarm register"]
98 #[inline(always)]
99 pub const fn alrmr(self, n: usize) -> crate::common::Reg<regs::Alrmr, crate::common::RW> {
100 assert!(n < 2usize);
101 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x40usize + n * 8usize) as _) }
102 }
103 #[doc = "Alarm sub second register"]
104 #[inline(always)]
105 pub const fn alrmssr(self, n: usize) -> crate::common::Reg<regs::Alrmssr, crate::common::RW> {
106 assert!(n < 2usize);
107 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x44usize + n * 8usize) as _) }
108 }
109 #[doc = "Status register"]
110 #[inline(always)]
111 pub const fn sr(self) -> crate::common::Reg<regs::Sr, crate::common::R> {
112 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x50usize) as _) }
113 }
114 #[doc = "Masked interrupt status register"]
115 #[inline(always)]
116 pub const fn misr(self) -> crate::common::Reg<regs::Misr, crate::common::R> {
117 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x54usize) as _) }
118 }
119 #[doc = "Secure masked interrupt status register"]
120 #[inline(always)]
121 pub const fn smisr(self) -> crate::common::Reg<regs::Smisr, crate::common::R> {
122 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x58usize) as _) }
123 }
124 #[doc = "Status clear register"]
125 #[inline(always)]
126 pub const fn scr(self) -> crate::common::Reg<regs::Scr, crate::common::W> {
127 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x5cusize) as _) }
128 }
129 #[doc = "Alarm binary mode register"]
130 #[inline(always)]
131 pub const fn alrbinr(self, n: usize) -> crate::common::Reg<regs::Alrbinr, crate::common::RW> {
132 assert!(n < 2usize);
133 unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x70usize + n * 4usize) as _) }
134 }
135}
136pub mod regs {
137 #[doc = "RTC alarm A binary mode register"]
138 #[repr(transparent)]
139 #[derive(Copy, Clone, Eq, PartialEq)]
140 pub struct Alrbinr(pub u32);
141 impl Alrbinr {
142 #[doc = "Synchronous counter alarm value in Binary mode"]
143 #[inline(always)]
144 pub const fn ss(&self) -> u32 {
145 let val = (self.0 >> 0usize) & 0xffff_ffff;
146 val as u32
147 }
148 #[doc = "Synchronous counter alarm value in Binary mode"]
149 #[inline(always)]
150 pub fn set_ss(&mut self, val: u32) {
151 self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
152 }
153 }
154 impl Default for Alrbinr {
155 #[inline(always)]
156 fn default() -> Alrbinr {
157 Alrbinr(0)
158 }
159 }
160 impl core::fmt::Debug for Alrbinr {
161 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
162 f.debug_struct("Alrbinr").field("ss", &self.ss()).finish()
163 }
164 }
165 #[cfg(feature = "defmt")]
166 impl defmt::Format for Alrbinr {
167 fn format(&self, f: defmt::Formatter) {
168 #[derive(defmt :: Format)]
169 struct Alrbinr {
170 ss: u32,
171 }
172 let proxy = Alrbinr { ss: self.ss() };
173 defmt::write!(f, "{}", proxy)
174 }
175 }
176 #[doc = "Alarm register"]
177 #[repr(transparent)]
178 #[derive(Copy, Clone, Eq, PartialEq)]
179 pub struct Alrmr(pub u32);
180 impl Alrmr {
181 #[doc = "Second units in BCD format"]
182 #[inline(always)]
183 pub const fn su(&self) -> u8 {
184 let val = (self.0 >> 0usize) & 0x0f;
185 val as u8
186 }
187 #[doc = "Second units in BCD format"]
188 #[inline(always)]
189 pub fn set_su(&mut self, val: u8) {
190 self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize);
191 }
192 #[doc = "Second tens in BCD format"]
193 #[inline(always)]
194 pub const fn st(&self) -> u8 {
195 let val = (self.0 >> 4usize) & 0x07;
196 val as u8
197 }
198 #[doc = "Second tens in BCD format"]
199 #[inline(always)]
200 pub fn set_st(&mut self, val: u8) {
201 self.0 = (self.0 & !(0x07 << 4usize)) | (((val as u32) & 0x07) << 4usize);
202 }
203 #[doc = "Alarm A seconds mask"]
204 #[inline(always)]
205 pub const fn msk1(&self) -> super::vals::AlrmrMsk {
206 let val = (self.0 >> 7usize) & 0x01;
207 super::vals::AlrmrMsk::from_bits(val as u8)
208 }
209 #[doc = "Alarm A seconds mask"]
210 #[inline(always)]
211 pub fn set_msk1(&mut self, val: super::vals::AlrmrMsk) {
212 self.0 = (self.0 & !(0x01 << 7usize)) | (((val.to_bits() as u32) & 0x01) << 7usize);
213 }
214 #[doc = "Minute units in BCD format"]
215 #[inline(always)]
216 pub const fn mnu(&self) -> u8 {
217 let val = (self.0 >> 8usize) & 0x0f;
218 val as u8
219 }
220 #[doc = "Minute units in BCD format"]
221 #[inline(always)]
222 pub fn set_mnu(&mut self, val: u8) {
223 self.0 = (self.0 & !(0x0f << 8usize)) | (((val as u32) & 0x0f) << 8usize);
224 }
225 #[doc = "Minute tens in BCD format"]
226 #[inline(always)]
227 pub const fn mnt(&self) -> u8 {
228 let val = (self.0 >> 12usize) & 0x07;
229 val as u8
230 }
231 #[doc = "Minute tens in BCD format"]
232 #[inline(always)]
233 pub fn set_mnt(&mut self, val: u8) {
234 self.0 = (self.0 & !(0x07 << 12usize)) | (((val as u32) & 0x07) << 12usize);
235 }
236 #[doc = "Alarm A minutes mask"]
237 #[inline(always)]
238 pub const fn msk2(&self) -> super::vals::AlrmrMsk {
239 let val = (self.0 >> 15usize) & 0x01;
240 super::vals::AlrmrMsk::from_bits(val as u8)
241 }
242 #[doc = "Alarm A minutes mask"]
243 #[inline(always)]
244 pub fn set_msk2(&mut self, val: super::vals::AlrmrMsk) {
245 self.0 = (self.0 & !(0x01 << 15usize)) | (((val.to_bits() as u32) & 0x01) << 15usize);
246 }
247 #[doc = "Hour units in BCD format"]
248 #[inline(always)]
249 pub const fn hu(&self) -> u8 {
250 let val = (self.0 >> 16usize) & 0x0f;
251 val as u8
252 }
253 #[doc = "Hour units in BCD format"]
254 #[inline(always)]
255 pub fn set_hu(&mut self, val: u8) {
256 self.0 = (self.0 & !(0x0f << 16usize)) | (((val as u32) & 0x0f) << 16usize);
257 }
258 #[doc = "Hour tens in BCD format"]
259 #[inline(always)]
260 pub const fn ht(&self) -> u8 {
261 let val = (self.0 >> 20usize) & 0x03;
262 val as u8
263 }
264 #[doc = "Hour tens in BCD format"]
265 #[inline(always)]
266 pub fn set_ht(&mut self, val: u8) {
267 self.0 = (self.0 & !(0x03 << 20usize)) | (((val as u32) & 0x03) << 20usize);
268 }
269 #[doc = "AM/PM notation"]
270 #[inline(always)]
271 pub const fn pm(&self) -> super::vals::AlrmrPm {
272 let val = (self.0 >> 22usize) & 0x01;
273 super::vals::AlrmrPm::from_bits(val as u8)
274 }
275 #[doc = "AM/PM notation"]
276 #[inline(always)]
277 pub fn set_pm(&mut self, val: super::vals::AlrmrPm) {
278 self.0 = (self.0 & !(0x01 << 22usize)) | (((val.to_bits() as u32) & 0x01) << 22usize);
279 }
280 #[doc = "Alarm A hours mask"]
281 #[inline(always)]
282 pub const fn msk3(&self) -> super::vals::AlrmrMsk {
283 let val = (self.0 >> 23usize) & 0x01;
284 super::vals::AlrmrMsk::from_bits(val as u8)
285 }
286 #[doc = "Alarm A hours mask"]
287 #[inline(always)]
288 pub fn set_msk3(&mut self, val: super::vals::AlrmrMsk) {
289 self.0 = (self.0 & !(0x01 << 23usize)) | (((val.to_bits() as u32) & 0x01) << 23usize);
290 }
291 #[doc = "Date units or day in BCD format"]
292 #[inline(always)]
293 pub const fn du(&self) -> u8 {
294 let val = (self.0 >> 24usize) & 0x0f;
295 val as u8
296 }
297 #[doc = "Date units or day in BCD format"]
298 #[inline(always)]
299 pub fn set_du(&mut self, val: u8) {
300 self.0 = (self.0 & !(0x0f << 24usize)) | (((val as u32) & 0x0f) << 24usize);
301 }
302 #[doc = "Date tens in BCD format"]
303 #[inline(always)]
304 pub const fn dt(&self) -> u8 {
305 let val = (self.0 >> 28usize) & 0x03;
306 val as u8
307 }
308 #[doc = "Date tens in BCD format"]
309 #[inline(always)]
310 pub fn set_dt(&mut self, val: u8) {
311 self.0 = (self.0 & !(0x03 << 28usize)) | (((val as u32) & 0x03) << 28usize);
312 }
313 #[doc = "Week day selection"]
314 #[inline(always)]
315 pub const fn wdsel(&self) -> super::vals::AlrmrWdsel {
316 let val = (self.0 >> 30usize) & 0x01;
317 super::vals::AlrmrWdsel::from_bits(val as u8)
318 }
319 #[doc = "Week day selection"]
320 #[inline(always)]
321 pub fn set_wdsel(&mut self, val: super::vals::AlrmrWdsel) {
322 self.0 = (self.0 & !(0x01 << 30usize)) | (((val.to_bits() as u32) & 0x01) << 30usize);
323 }
324 #[doc = "Alarm A date mask"]
325 #[inline(always)]
326 pub const fn msk4(&self) -> super::vals::AlrmrMsk {
327 let val = (self.0 >> 31usize) & 0x01;
328 super::vals::AlrmrMsk::from_bits(val as u8)
329 }
330 #[doc = "Alarm A date mask"]
331 #[inline(always)]
332 pub fn set_msk4(&mut self, val: super::vals::AlrmrMsk) {
333 self.0 = (self.0 & !(0x01 << 31usize)) | (((val.to_bits() as u32) & 0x01) << 31usize);
334 }
335 }
336 impl Default for Alrmr {
337 #[inline(always)]
338 fn default() -> Alrmr {
339 Alrmr(0)
340 }
341 }
342 impl core::fmt::Debug for Alrmr {
343 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
344 f.debug_struct("Alrmr")
345 .field("su", &self.su())
346 .field("st", &self.st())
347 .field("msk1", &self.msk1())
348 .field("mnu", &self.mnu())
349 .field("mnt", &self.mnt())
350 .field("msk2", &self.msk2())
351 .field("hu", &self.hu())
352 .field("ht", &self.ht())
353 .field("pm", &self.pm())
354 .field("msk3", &self.msk3())
355 .field("du", &self.du())
356 .field("dt", &self.dt())
357 .field("wdsel", &self.wdsel())
358 .field("msk4", &self.msk4())
359 .finish()
360 }
361 }
362 #[cfg(feature = "defmt")]
363 impl defmt::Format for Alrmr {
364 fn format(&self, f: defmt::Formatter) {
365 #[derive(defmt :: Format)]
366 struct Alrmr {
367 su: u8,
368 st: u8,
369 msk1: super::vals::AlrmrMsk,
370 mnu: u8,
371 mnt: u8,
372 msk2: super::vals::AlrmrMsk,
373 hu: u8,
374 ht: u8,
375 pm: super::vals::AlrmrPm,
376 msk3: super::vals::AlrmrMsk,
377 du: u8,
378 dt: u8,
379 wdsel: super::vals::AlrmrWdsel,
380 msk4: super::vals::AlrmrMsk,
381 }
382 let proxy = Alrmr {
383 su: self.su(),
384 st: self.st(),
385 msk1: self.msk1(),
386 mnu: self.mnu(),
387 mnt: self.mnt(),
388 msk2: self.msk2(),
389 hu: self.hu(),
390 ht: self.ht(),
391 pm: self.pm(),
392 msk3: self.msk3(),
393 du: self.du(),
394 dt: self.dt(),
395 wdsel: self.wdsel(),
396 msk4: self.msk4(),
397 };
398 defmt::write!(f, "{}", proxy)
399 }
400 }
401 #[doc = "Alarm sub second register"]
402 #[repr(transparent)]
403 #[derive(Copy, Clone, Eq, PartialEq)]
404 pub struct Alrmssr(pub u32);
405 impl Alrmssr {
406 #[doc = "Sub seconds value"]
407 #[inline(always)]
408 pub const fn ss(&self) -> u16 {
409 let val = (self.0 >> 0usize) & 0x7fff;
410 val as u16
411 }
412 #[doc = "Sub seconds value"]
413 #[inline(always)]
414 pub fn set_ss(&mut self, val: u16) {
415 self.0 = (self.0 & !(0x7fff << 0usize)) | (((val as u32) & 0x7fff) << 0usize);
416 }
417 #[doc = "Mask the most-significant bits starting at this bit"]
418 #[inline(always)]
419 pub const fn maskss(&self) -> u8 {
420 let val = (self.0 >> 24usize) & 0x3f;
421 val as u8
422 }
423 #[doc = "Mask the most-significant bits starting at this bit"]
424 #[inline(always)]
425 pub fn set_maskss(&mut self, val: u8) {
426 self.0 = (self.0 & !(0x3f << 24usize)) | (((val as u32) & 0x3f) << 24usize);
427 }
428 #[doc = "Clear synchronous counter on alarm (Binary mode only)"]
429 #[inline(always)]
430 pub const fn ssclr(&self) -> super::vals::AlrmssrSsclr {
431 let val = (self.0 >> 31usize) & 0x01;
432 super::vals::AlrmssrSsclr::from_bits(val as u8)
433 }
434 #[doc = "Clear synchronous counter on alarm (Binary mode only)"]
435 #[inline(always)]
436 pub fn set_ssclr(&mut self, val: super::vals::AlrmssrSsclr) {
437 self.0 = (self.0 & !(0x01 << 31usize)) | (((val.to_bits() as u32) & 0x01) << 31usize);
438 }
439 }
440 impl Default for Alrmssr {
441 #[inline(always)]
442 fn default() -> Alrmssr {
443 Alrmssr(0)
444 }
445 }
446 impl core::fmt::Debug for Alrmssr {
447 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
448 f.debug_struct("Alrmssr")
449 .field("ss", &self.ss())
450 .field("maskss", &self.maskss())
451 .field("ssclr", &self.ssclr())
452 .finish()
453 }
454 }
455 #[cfg(feature = "defmt")]
456 impl defmt::Format for Alrmssr {
457 fn format(&self, f: defmt::Formatter) {
458 #[derive(defmt :: Format)]
459 struct Alrmssr {
460 ss: u16,
461 maskss: u8,
462 ssclr: super::vals::AlrmssrSsclr,
463 }
464 let proxy = Alrmssr {
465 ss: self.ss(),
466 maskss: self.maskss(),
467 ssclr: self.ssclr(),
468 };
469 defmt::write!(f, "{}", proxy)
470 }
471 }
472 #[doc = "Calibration register"]
473 #[repr(transparent)]
474 #[derive(Copy, Clone, Eq, PartialEq)]
475 pub struct Calr(pub u32);
476 impl Calr {
477 #[doc = "Calibration minus"]
478 #[inline(always)]
479 pub const fn calm(&self) -> u16 {
480 let val = (self.0 >> 0usize) & 0x01ff;
481 val as u16
482 }
483 #[doc = "Calibration minus"]
484 #[inline(always)]
485 pub fn set_calm(&mut self, val: u16) {
486 self.0 = (self.0 & !(0x01ff << 0usize)) | (((val as u32) & 0x01ff) << 0usize);
487 }
488 #[doc = "Calibration low-power mode"]
489 #[inline(always)]
490 pub const fn lpcal(&self) -> super::vals::Lpcal {
491 let val = (self.0 >> 12usize) & 0x01;
492 super::vals::Lpcal::from_bits(val as u8)
493 }
494 #[doc = "Calibration low-power mode"]
495 #[inline(always)]
496 pub fn set_lpcal(&mut self, val: super::vals::Lpcal) {
497 self.0 = (self.0 & !(0x01 << 12usize)) | (((val.to_bits() as u32) & 0x01) << 12usize);
498 }
499 #[doc = "Use a 16-second calibration cycle period"]
500 #[inline(always)]
501 pub const fn calw16(&self) -> super::vals::Calw16 {
502 let val = (self.0 >> 13usize) & 0x01;
503 super::vals::Calw16::from_bits(val as u8)
504 }
505 #[doc = "Use a 16-second calibration cycle period"]
506 #[inline(always)]
507 pub fn set_calw16(&mut self, val: super::vals::Calw16) {
508 self.0 = (self.0 & !(0x01 << 13usize)) | (((val.to_bits() as u32) & 0x01) << 13usize);
509 }
510 #[doc = "Use an 8-second calibration cycle period"]
511 #[inline(always)]
512 pub const fn calw8(&self) -> super::vals::Calw8 {
513 let val = (self.0 >> 14usize) & 0x01;
514 super::vals::Calw8::from_bits(val as u8)
515 }
516 #[doc = "Use an 8-second calibration cycle period"]
517 #[inline(always)]
518 pub fn set_calw8(&mut self, val: super::vals::Calw8) {
519 self.0 = (self.0 & !(0x01 << 14usize)) | (((val.to_bits() as u32) & 0x01) << 14usize);
520 }
521 #[doc = "Increase frequency of RTC by 488.5 ppm"]
522 #[inline(always)]
523 pub const fn calp(&self) -> super::vals::Calp {
524 let val = (self.0 >> 15usize) & 0x01;
525 super::vals::Calp::from_bits(val as u8)
526 }
527 #[doc = "Increase frequency of RTC by 488.5 ppm"]
528 #[inline(always)]
529 pub fn set_calp(&mut self, val: super::vals::Calp) {
530 self.0 = (self.0 & !(0x01 << 15usize)) | (((val.to_bits() as u32) & 0x01) << 15usize);
531 }
532 }
533 impl Default for Calr {
534 #[inline(always)]
535 fn default() -> Calr {
536 Calr(0)
537 }
538 }
539 impl core::fmt::Debug for Calr {
540 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
541 f.debug_struct("Calr")
542 .field("calm", &self.calm())
543 .field("lpcal", &self.lpcal())
544 .field("calw16", &self.calw16())
545 .field("calw8", &self.calw8())
546 .field("calp", &self.calp())
547 .finish()
548 }
549 }
550 #[cfg(feature = "defmt")]
551 impl defmt::Format for Calr {
552 fn format(&self, f: defmt::Formatter) {
553 #[derive(defmt :: Format)]
554 struct Calr {
555 calm: u16,
556 lpcal: super::vals::Lpcal,
557 calw16: super::vals::Calw16,
558 calw8: super::vals::Calw8,
559 calp: super::vals::Calp,
560 }
561 let proxy = Calr {
562 calm: self.calm(),
563 lpcal: self.lpcal(),
564 calw16: self.calw16(),
565 calw8: self.calw8(),
566 calp: self.calp(),
567 };
568 defmt::write!(f, "{}", proxy)
569 }
570 }
571 #[doc = "Control register"]
572 #[repr(transparent)]
573 #[derive(Copy, Clone, Eq, PartialEq)]
574 pub struct Cr(pub u32);
575 impl Cr {
576 #[doc = "Wakeup clock selection"]
577 #[inline(always)]
578 pub const fn wucksel(&self) -> super::vals::Wucksel {
579 let val = (self.0 >> 0usize) & 0x07;
580 super::vals::Wucksel::from_bits(val as u8)
581 }
582 #[doc = "Wakeup clock selection"]
583 #[inline(always)]
584 pub fn set_wucksel(&mut self, val: super::vals::Wucksel) {
585 self.0 = (self.0 & !(0x07 << 0usize)) | (((val.to_bits() as u32) & 0x07) << 0usize);
586 }
587 #[doc = "Timestamp event active edge"]
588 #[inline(always)]
589 pub const fn tsedge(&self) -> super::vals::Tsedge {
590 let val = (self.0 >> 3usize) & 0x01;
591 super::vals::Tsedge::from_bits(val as u8)
592 }
593 #[doc = "Timestamp event active edge"]
594 #[inline(always)]
595 pub fn set_tsedge(&mut self, val: super::vals::Tsedge) {
596 self.0 = (self.0 & !(0x01 << 3usize)) | (((val.to_bits() as u32) & 0x01) << 3usize);
597 }
598 #[doc = "RTC_REFIN reference clock detection enable (50 or 60 Hz)"]
599 #[inline(always)]
600 pub const fn refckon(&self) -> bool {
601 let val = (self.0 >> 4usize) & 0x01;
602 val != 0
603 }
604 #[doc = "RTC_REFIN reference clock detection enable (50 or 60 Hz)"]
605 #[inline(always)]
606 pub fn set_refckon(&mut self, val: bool) {
607 self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
608 }
609 #[doc = "Bypass the shadow registers"]
610 #[inline(always)]
611 pub const fn bypshad(&self) -> bool {
612 let val = (self.0 >> 5usize) & 0x01;
613 val != 0
614 }
615 #[doc = "Bypass the shadow registers"]
616 #[inline(always)]
617 pub fn set_bypshad(&mut self, val: bool) {
618 self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
619 }
620 #[doc = "Hour format"]
621 #[inline(always)]
622 pub const fn fmt(&self) -> super::vals::Fmt {
623 let val = (self.0 >> 6usize) & 0x01;
624 super::vals::Fmt::from_bits(val as u8)
625 }
626 #[doc = "Hour format"]
627 #[inline(always)]
628 pub fn set_fmt(&mut self, val: super::vals::Fmt) {
629 self.0 = (self.0 & !(0x01 << 6usize)) | (((val.to_bits() as u32) & 0x01) << 6usize);
630 }
631 #[doc = "SSR underflow interrupt enable"]
632 #[inline(always)]
633 pub const fn ssruie(&self) -> bool {
634 let val = (self.0 >> 7usize) & 0x01;
635 val != 0
636 }
637 #[doc = "SSR underflow interrupt enable"]
638 #[inline(always)]
639 pub fn set_ssruie(&mut self, val: bool) {
640 self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
641 }
642 #[doc = "Alarm enable"]
643 #[inline(always)]
644 pub const fn alre(&self, n: usize) -> bool {
645 assert!(n < 2usize);
646 let offs = 8usize + n * 1usize;
647 let val = (self.0 >> offs) & 0x01;
648 val != 0
649 }
650 #[doc = "Alarm enable"]
651 #[inline(always)]
652 pub fn set_alre(&mut self, n: usize, val: bool) {
653 assert!(n < 2usize);
654 let offs = 8usize + n * 1usize;
655 self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
656 }
657 #[doc = "Wakeup timer enable"]
658 #[inline(always)]
659 pub const fn wute(&self) -> bool {
660 let val = (self.0 >> 10usize) & 0x01;
661 val != 0
662 }
663 #[doc = "Wakeup timer enable"]
664 #[inline(always)]
665 pub fn set_wute(&mut self, val: bool) {
666 self.0 = (self.0 & !(0x01 << 10usize)) | (((val as u32) & 0x01) << 10usize);
667 }
668 #[doc = "Timestamp enable"]
669 #[inline(always)]
670 pub const fn tse(&self) -> bool {
671 let val = (self.0 >> 11usize) & 0x01;
672 val != 0
673 }
674 #[doc = "Timestamp enable"]
675 #[inline(always)]
676 pub fn set_tse(&mut self, val: bool) {
677 self.0 = (self.0 & !(0x01 << 11usize)) | (((val as u32) & 0x01) << 11usize);
678 }
679 #[doc = "Alarm interrupt enable"]
680 #[inline(always)]
681 pub const fn alrie(&self, n: usize) -> bool {
682 assert!(n < 2usize);
683 let offs = 12usize + n * 1usize;
684 let val = (self.0 >> offs) & 0x01;
685 val != 0
686 }
687 #[doc = "Alarm interrupt enable"]
688 #[inline(always)]
689 pub fn set_alrie(&mut self, n: usize, val: bool) {
690 assert!(n < 2usize);
691 let offs = 12usize + n * 1usize;
692 self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
693 }
694 #[doc = "Wakeup timer interrupt enable"]
695 #[inline(always)]
696 pub const fn wutie(&self) -> bool {
697 let val = (self.0 >> 14usize) & 0x01;
698 val != 0
699 }
700 #[doc = "Wakeup timer interrupt enable"]
701 #[inline(always)]
702 pub fn set_wutie(&mut self, val: bool) {
703 self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
704 }
705 #[doc = "Timestamp interrupt enable"]
706 #[inline(always)]
707 pub const fn tsie(&self) -> bool {
708 let val = (self.0 >> 15usize) & 0x01;
709 val != 0
710 }
711 #[doc = "Timestamp interrupt enable"]
712 #[inline(always)]
713 pub fn set_tsie(&mut self, val: bool) {
714 self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
715 }
716 #[doc = "Add 1 hour (summer time change)"]
717 #[inline(always)]
718 pub const fn add1h(&self) -> bool {
719 let val = (self.0 >> 16usize) & 0x01;
720 val != 0
721 }
722 #[doc = "Add 1 hour (summer time change)"]
723 #[inline(always)]
724 pub fn set_add1h(&mut self, val: bool) {
725 self.0 = (self.0 & !(0x01 << 16usize)) | (((val as u32) & 0x01) << 16usize);
726 }
727 #[doc = "Subtract 1 hour (winter time change)"]
728 #[inline(always)]
729 pub const fn sub1h(&self) -> bool {
730 let val = (self.0 >> 17usize) & 0x01;
731 val != 0
732 }
733 #[doc = "Subtract 1 hour (winter time change)"]
734 #[inline(always)]
735 pub fn set_sub1h(&mut self, val: bool) {
736 self.0 = (self.0 & !(0x01 << 17usize)) | (((val as u32) & 0x01) << 17usize);
737 }
738 #[doc = "Backup"]
739 #[inline(always)]
740 pub const fn bkp(&self) -> bool {
741 let val = (self.0 >> 18usize) & 0x01;
742 val != 0
743 }
744 #[doc = "Backup"]
745 #[inline(always)]
746 pub fn set_bkp(&mut self, val: bool) {
747 self.0 = (self.0 & !(0x01 << 18usize)) | (((val as u32) & 0x01) << 18usize);
748 }
749 #[doc = "Calibration output selection"]
750 #[inline(always)]
751 pub const fn cosel(&self) -> super::vals::Cosel {
752 let val = (self.0 >> 19usize) & 0x01;
753 super::vals::Cosel::from_bits(val as u8)
754 }
755 #[doc = "Calibration output selection"]
756 #[inline(always)]
757 pub fn set_cosel(&mut self, val: super::vals::Cosel) {
758 self.0 = (self.0 & !(0x01 << 19usize)) | (((val.to_bits() as u32) & 0x01) << 19usize);
759 }
760 #[doc = "Output polarity"]
761 #[inline(always)]
762 pub const fn pol(&self) -> super::vals::Pol {
763 let val = (self.0 >> 20usize) & 0x01;
764 super::vals::Pol::from_bits(val as u8)
765 }
766 #[doc = "Output polarity"]
767 #[inline(always)]
768 pub fn set_pol(&mut self, val: super::vals::Pol) {
769 self.0 = (self.0 & !(0x01 << 20usize)) | (((val.to_bits() as u32) & 0x01) << 20usize);
770 }
771 #[doc = "Output selection"]
772 #[inline(always)]
773 pub const fn osel(&self) -> super::vals::Osel {
774 let val = (self.0 >> 21usize) & 0x03;
775 super::vals::Osel::from_bits(val as u8)
776 }
777 #[doc = "Output selection"]
778 #[inline(always)]
779 pub fn set_osel(&mut self, val: super::vals::Osel) {
780 self.0 = (self.0 & !(0x03 << 21usize)) | (((val.to_bits() as u32) & 0x03) << 21usize);
781 }
782 #[doc = "Calibration output enable"]
783 #[inline(always)]
784 pub const fn coe(&self) -> bool {
785 let val = (self.0 >> 23usize) & 0x01;
786 val != 0
787 }
788 #[doc = "Calibration output enable"]
789 #[inline(always)]
790 pub fn set_coe(&mut self, val: bool) {
791 self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
792 }
793 #[doc = "Timestamp on internal event enable"]
794 #[inline(always)]
795 pub const fn itse(&self) -> bool {
796 let val = (self.0 >> 24usize) & 0x01;
797 val != 0
798 }
799 #[doc = "Timestamp on internal event enable"]
800 #[inline(always)]
801 pub fn set_itse(&mut self, val: bool) {
802 self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
803 }
804 #[doc = "Activate timestamp on tamper detection event"]
805 #[inline(always)]
806 pub const fn tampts(&self) -> bool {
807 let val = (self.0 >> 25usize) & 0x01;
808 val != 0
809 }
810 #[doc = "Activate timestamp on tamper detection event"]
811 #[inline(always)]
812 pub fn set_tampts(&mut self, val: bool) {
813 self.0 = (self.0 & !(0x01 << 25usize)) | (((val as u32) & 0x01) << 25usize);
814 }
815 #[doc = "Tamper detection output enable on TAMPALRM"]
816 #[inline(always)]
817 pub const fn tampoe(&self) -> bool {
818 let val = (self.0 >> 26usize) & 0x01;
819 val != 0
820 }
821 #[doc = "Tamper detection output enable on TAMPALRM"]
822 #[inline(always)]
823 pub fn set_tampoe(&mut self, val: bool) {
824 self.0 = (self.0 & !(0x01 << 26usize)) | (((val as u32) & 0x01) << 26usize);
825 }
826 #[doc = "ALRFCLR"]
827 #[inline(always)]
828 pub const fn alrfclr(&self, n: usize) -> bool {
829 assert!(n < 2usize);
830 let offs = 27usize + n * 1usize;
831 let val = (self.0 >> offs) & 0x01;
832 val != 0
833 }
834 #[doc = "ALRFCLR"]
835 #[inline(always)]
836 pub fn set_alrfclr(&mut self, n: usize, val: bool) {
837 assert!(n < 2usize);
838 let offs = 27usize + n * 1usize;
839 self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
840 }
841 #[doc = "TAMPALRM pull-up enable"]
842 #[inline(always)]
843 pub const fn tampalrm_pu(&self) -> bool {
844 let val = (self.0 >> 29usize) & 0x01;
845 val != 0
846 }
847 #[doc = "TAMPALRM pull-up enable"]
848 #[inline(always)]
849 pub fn set_tampalrm_pu(&mut self, val: bool) {
850 self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
851 }
852 #[doc = "TAMPALRM output type"]
853 #[inline(always)]
854 pub const fn tampalrm_type(&self) -> super::vals::TampalrmType {
855 let val = (self.0 >> 30usize) & 0x01;
856 super::vals::TampalrmType::from_bits(val as u8)
857 }
858 #[doc = "TAMPALRM output type"]
859 #[inline(always)]
860 pub fn set_tampalrm_type(&mut self, val: super::vals::TampalrmType) {
861 self.0 = (self.0 & !(0x01 << 30usize)) | (((val.to_bits() as u32) & 0x01) << 30usize);
862 }
863 #[doc = "RTC_OUT2 output enable"]
864 #[inline(always)]
865 pub const fn out2en(&self) -> bool {
866 let val = (self.0 >> 31usize) & 0x01;
867 val != 0
868 }
869 #[doc = "RTC_OUT2 output enable"]
870 #[inline(always)]
871 pub fn set_out2en(&mut self, val: bool) {
872 self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
873 }
874 }
875 impl Default for Cr {
876 #[inline(always)]
877 fn default() -> Cr {
878 Cr(0)
879 }
880 }
881 impl core::fmt::Debug for Cr {
882 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
883 f.debug_struct("Cr")
884 .field("wucksel", &self.wucksel())
885 .field("tsedge", &self.tsedge())
886 .field("refckon", &self.refckon())
887 .field("bypshad", &self.bypshad())
888 .field("fmt", &self.fmt())
889 .field("ssruie", &self.ssruie())
890 .field("alre", &[self.alre(0usize), self.alre(1usize)])
891 .field("wute", &self.wute())
892 .field("tse", &self.tse())
893 .field("alrie", &[self.alrie(0usize), self.alrie(1usize)])
894 .field("wutie", &self.wutie())
895 .field("tsie", &self.tsie())
896 .field("add1h", &self.add1h())
897 .field("sub1h", &self.sub1h())
898 .field("bkp", &self.bkp())
899 .field("cosel", &self.cosel())
900 .field("pol", &self.pol())
901 .field("osel", &self.osel())
902 .field("coe", &self.coe())
903 .field("itse", &self.itse())
904 .field("tampts", &self.tampts())
905 .field("tampoe", &self.tampoe())
906 .field("alrfclr", &[self.alrfclr(0usize), self.alrfclr(1usize)])
907 .field("tampalrm_pu", &self.tampalrm_pu())
908 .field("tampalrm_type", &self.tampalrm_type())
909 .field("out2en", &self.out2en())
910 .finish()
911 }
912 }
913 #[cfg(feature = "defmt")]
914 impl defmt::Format for Cr {
915 fn format(&self, f: defmt::Formatter) {
916 #[derive(defmt :: Format)]
917 struct Cr {
918 wucksel: super::vals::Wucksel,
919 tsedge: super::vals::Tsedge,
920 refckon: bool,
921 bypshad: bool,
922 fmt: super::vals::Fmt,
923 ssruie: bool,
924 alre: [bool; 2usize],
925 wute: bool,
926 tse: bool,
927 alrie: [bool; 2usize],
928 wutie: bool,
929 tsie: bool,
930 add1h: bool,
931 sub1h: bool,
932 bkp: bool,
933 cosel: super::vals::Cosel,
934 pol: super::vals::Pol,
935 osel: super::vals::Osel,
936 coe: bool,
937 itse: bool,
938 tampts: bool,
939 tampoe: bool,
940 alrfclr: [bool; 2usize],
941 tampalrm_pu: bool,
942 tampalrm_type: super::vals::TampalrmType,
943 out2en: bool,
944 }
945 let proxy = Cr {
946 wucksel: self.wucksel(),
947 tsedge: self.tsedge(),
948 refckon: self.refckon(),
949 bypshad: self.bypshad(),
950 fmt: self.fmt(),
951 ssruie: self.ssruie(),
952 alre: [self.alre(0usize), self.alre(1usize)],
953 wute: self.wute(),
954 tse: self.tse(),
955 alrie: [self.alrie(0usize), self.alrie(1usize)],
956 wutie: self.wutie(),
957 tsie: self.tsie(),
958 add1h: self.add1h(),
959 sub1h: self.sub1h(),
960 bkp: self.bkp(),
961 cosel: self.cosel(),
962 pol: self.pol(),
963 osel: self.osel(),
964 coe: self.coe(),
965 itse: self.itse(),
966 tampts: self.tampts(),
967 tampoe: self.tampoe(),
968 alrfclr: [self.alrfclr(0usize), self.alrfclr(1usize)],
969 tampalrm_pu: self.tampalrm_pu(),
970 tampalrm_type: self.tampalrm_type(),
971 out2en: self.out2en(),
972 };
973 defmt::write!(f, "{}", proxy)
974 }
975 }
976 #[doc = "Date register"]
977 #[repr(transparent)]
978 #[derive(Copy, Clone, Eq, PartialEq)]
979 pub struct Dr(pub u32);
980 impl Dr {
981 #[doc = "Date units in BCD format"]
982 #[inline(always)]
983 pub const fn du(&self) -> u8 {
984 let val = (self.0 >> 0usize) & 0x0f;
985 val as u8
986 }
987 #[doc = "Date units in BCD format"]
988 #[inline(always)]
989 pub fn set_du(&mut self, val: u8) {
990 self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize);
991 }
992 #[doc = "Date tens in BCD format"]
993 #[inline(always)]
994 pub const fn dt(&self) -> u8 {
995 let val = (self.0 >> 4usize) & 0x03;
996 val as u8
997 }
998 #[doc = "Date tens in BCD format"]
999 #[inline(always)]
1000 pub fn set_dt(&mut self, val: u8) {
1001 self.0 = (self.0 & !(0x03 << 4usize)) | (((val as u32) & 0x03) << 4usize);
1002 }
1003 #[doc = "Month units in BCD format"]
1004 #[inline(always)]
1005 pub const fn mu(&self) -> u8 {
1006 let val = (self.0 >> 8usize) & 0x0f;
1007 val as u8
1008 }
1009 #[doc = "Month units in BCD format"]
1010 #[inline(always)]
1011 pub fn set_mu(&mut self, val: u8) {
1012 self.0 = (self.0 & !(0x0f << 8usize)) | (((val as u32) & 0x0f) << 8usize);
1013 }
1014 #[doc = "Month tens in BCD format"]
1015 #[inline(always)]
1016 pub const fn mt(&self) -> bool {
1017 let val = (self.0 >> 12usize) & 0x01;
1018 val != 0
1019 }
1020 #[doc = "Month tens in BCD format"]
1021 #[inline(always)]
1022 pub fn set_mt(&mut self, val: bool) {
1023 self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
1024 }
1025 #[doc = "Week day units"]
1026 #[inline(always)]
1027 pub const fn wdu(&self) -> u8 {
1028 let val = (self.0 >> 13usize) & 0x07;
1029 val as u8
1030 }
1031 #[doc = "Week day units"]
1032 #[inline(always)]
1033 pub fn set_wdu(&mut self, val: u8) {
1034 self.0 = (self.0 & !(0x07 << 13usize)) | (((val as u32) & 0x07) << 13usize);
1035 }
1036 #[doc = "Year units in BCD format"]
1037 #[inline(always)]
1038 pub const fn yu(&self) -> u8 {
1039 let val = (self.0 >> 16usize) & 0x0f;
1040 val as u8
1041 }
1042 #[doc = "Year units in BCD format"]
1043 #[inline(always)]
1044 pub fn set_yu(&mut self, val: u8) {
1045 self.0 = (self.0 & !(0x0f << 16usize)) | (((val as u32) & 0x0f) << 16usize);
1046 }
1047 #[doc = "Year tens in BCD format"]
1048 #[inline(always)]
1049 pub const fn yt(&self) -> u8 {
1050 let val = (self.0 >> 20usize) & 0x0f;
1051 val as u8
1052 }
1053 #[doc = "Year tens in BCD format"]
1054 #[inline(always)]
1055 pub fn set_yt(&mut self, val: u8) {
1056 self.0 = (self.0 & !(0x0f << 20usize)) | (((val as u32) & 0x0f) << 20usize);
1057 }
1058 }
1059 impl Default for Dr {
1060 #[inline(always)]
1061 fn default() -> Dr {
1062 Dr(0)
1063 }
1064 }
1065 impl core::fmt::Debug for Dr {
1066 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1067 f.debug_struct("Dr")
1068 .field("du", &self.du())
1069 .field("dt", &self.dt())
1070 .field("mu", &self.mu())
1071 .field("mt", &self.mt())
1072 .field("wdu", &self.wdu())
1073 .field("yu", &self.yu())
1074 .field("yt", &self.yt())
1075 .finish()
1076 }
1077 }
1078 #[cfg(feature = "defmt")]
1079 impl defmt::Format for Dr {
1080 fn format(&self, f: defmt::Formatter) {
1081 #[derive(defmt :: Format)]
1082 struct Dr {
1083 du: u8,
1084 dt: u8,
1085 mu: u8,
1086 mt: bool,
1087 wdu: u8,
1088 yu: u8,
1089 yt: u8,
1090 }
1091 let proxy = Dr {
1092 du: self.du(),
1093 dt: self.dt(),
1094 mu: self.mu(),
1095 mt: self.mt(),
1096 wdu: self.wdu(),
1097 yu: self.yu(),
1098 yt: self.yt(),
1099 };
1100 defmt::write!(f, "{}", proxy)
1101 }
1102 }
1103 #[doc = "Initialization control and status register"]
1104 #[repr(transparent)]
1105 #[derive(Copy, Clone, Eq, PartialEq)]
1106 pub struct Icsr(pub u32);
1107 impl Icsr {
1108 #[doc = "Wakeup timer write enabled"]
1109 #[inline(always)]
1110 pub const fn wutwf(&self) -> bool {
1111 let val = (self.0 >> 2usize) & 0x01;
1112 val != 0
1113 }
1114 #[doc = "Wakeup timer write enabled"]
1115 #[inline(always)]
1116 pub fn set_wutwf(&mut self, val: bool) {
1117 self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
1118 }
1119 #[doc = "Shift operation pending"]
1120 #[inline(always)]
1121 pub const fn shpf(&self) -> bool {
1122 let val = (self.0 >> 3usize) & 0x01;
1123 val != 0
1124 }
1125 #[doc = "Shift operation pending"]
1126 #[inline(always)]
1127 pub fn set_shpf(&mut self, val: bool) {
1128 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
1129 }
1130 #[doc = "Initialization status flag"]
1131 #[inline(always)]
1132 pub const fn inits(&self) -> bool {
1133 let val = (self.0 >> 4usize) & 0x01;
1134 val != 0
1135 }
1136 #[doc = "Initialization status flag"]
1137 #[inline(always)]
1138 pub fn set_inits(&mut self, val: bool) {
1139 self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
1140 }
1141 #[doc = "Registers synchronization flag"]
1142 #[inline(always)]
1143 pub const fn rsf(&self) -> bool {
1144 let val = (self.0 >> 5usize) & 0x01;
1145 val != 0
1146 }
1147 #[doc = "Registers synchronization flag"]
1148 #[inline(always)]
1149 pub fn set_rsf(&mut self, val: bool) {
1150 self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
1151 }
1152 #[doc = "Initialization flag"]
1153 #[inline(always)]
1154 pub const fn initf(&self) -> bool {
1155 let val = (self.0 >> 6usize) & 0x01;
1156 val != 0
1157 }
1158 #[doc = "Initialization flag"]
1159 #[inline(always)]
1160 pub fn set_initf(&mut self, val: bool) {
1161 self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
1162 }
1163 #[doc = "Enter Initialization mode"]
1164 #[inline(always)]
1165 pub const fn init(&self) -> bool {
1166 let val = (self.0 >> 7usize) & 0x01;
1167 val != 0
1168 }
1169 #[doc = "Enter Initialization mode"]
1170 #[inline(always)]
1171 pub fn set_init(&mut self, val: bool) {
1172 self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
1173 }
1174 #[doc = "Binary mode"]
1175 #[inline(always)]
1176 pub const fn bin(&self) -> super::vals::Bin {
1177 let val = (self.0 >> 8usize) & 0x03;
1178 super::vals::Bin::from_bits(val as u8)
1179 }
1180 #[doc = "Binary mode"]
1181 #[inline(always)]
1182 pub fn set_bin(&mut self, val: super::vals::Bin) {
1183 self.0 = (self.0 & !(0x03 << 8usize)) | (((val.to_bits() as u32) & 0x03) << 8usize);
1184 }
1185 #[doc = "BCD update"]
1186 #[inline(always)]
1187 pub const fn bcdu(&self) -> super::vals::Bcdu {
1188 let val = (self.0 >> 10usize) & 0x07;
1189 super::vals::Bcdu::from_bits(val as u8)
1190 }
1191 #[doc = "BCD update"]
1192 #[inline(always)]
1193 pub fn set_bcdu(&mut self, val: super::vals::Bcdu) {
1194 self.0 = (self.0 & !(0x07 << 10usize)) | (((val.to_bits() as u32) & 0x07) << 10usize);
1195 }
1196 #[doc = "Recalibration pending Flag"]
1197 #[inline(always)]
1198 pub const fn recalpf(&self) -> super::vals::Recalpf {
1199 let val = (self.0 >> 16usize) & 0x01;
1200 super::vals::Recalpf::from_bits(val as u8)
1201 }
1202 #[doc = "Recalibration pending Flag"]
1203 #[inline(always)]
1204 pub fn set_recalpf(&mut self, val: super::vals::Recalpf) {
1205 self.0 = (self.0 & !(0x01 << 16usize)) | (((val.to_bits() as u32) & 0x01) << 16usize);
1206 }
1207 }
1208 impl Default for Icsr {
1209 #[inline(always)]
1210 fn default() -> Icsr {
1211 Icsr(0)
1212 }
1213 }
1214 impl core::fmt::Debug for Icsr {
1215 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1216 f.debug_struct("Icsr")
1217 .field("wutwf", &self.wutwf())
1218 .field("shpf", &self.shpf())
1219 .field("inits", &self.inits())
1220 .field("rsf", &self.rsf())
1221 .field("initf", &self.initf())
1222 .field("init", &self.init())
1223 .field("bin", &self.bin())
1224 .field("bcdu", &self.bcdu())
1225 .field("recalpf", &self.recalpf())
1226 .finish()
1227 }
1228 }
1229 #[cfg(feature = "defmt")]
1230 impl defmt::Format for Icsr {
1231 fn format(&self, f: defmt::Formatter) {
1232 #[derive(defmt :: Format)]
1233 struct Icsr {
1234 wutwf: bool,
1235 shpf: bool,
1236 inits: bool,
1237 rsf: bool,
1238 initf: bool,
1239 init: bool,
1240 bin: super::vals::Bin,
1241 bcdu: super::vals::Bcdu,
1242 recalpf: super::vals::Recalpf,
1243 }
1244 let proxy = Icsr {
1245 wutwf: self.wutwf(),
1246 shpf: self.shpf(),
1247 inits: self.inits(),
1248 rsf: self.rsf(),
1249 initf: self.initf(),
1250 init: self.init(),
1251 bin: self.bin(),
1252 bcdu: self.bcdu(),
1253 recalpf: self.recalpf(),
1254 };
1255 defmt::write!(f, "{}", proxy)
1256 }
1257 }
1258 #[doc = "Masked interrupt status register"]
1259 #[repr(transparent)]
1260 #[derive(Copy, Clone, Eq, PartialEq)]
1261 pub struct Misr(pub u32);
1262 impl Misr {
1263 #[doc = "Alarm masked flag"]
1264 #[inline(always)]
1265 pub const fn alrmf(&self, n: usize) -> super::vals::Alrmf {
1266 assert!(n < 2usize);
1267 let offs = 0usize + n * 1usize;
1268 let val = (self.0 >> offs) & 0x01;
1269 super::vals::Alrmf::from_bits(val as u8)
1270 }
1271 #[doc = "Alarm masked flag"]
1272 #[inline(always)]
1273 pub fn set_alrmf(&mut self, n: usize, val: super::vals::Alrmf) {
1274 assert!(n < 2usize);
1275 let offs = 0usize + n * 1usize;
1276 self.0 = (self.0 & !(0x01 << offs)) | (((val.to_bits() as u32) & 0x01) << offs);
1277 }
1278 #[doc = "Wakeup timer masked flag"]
1279 #[inline(always)]
1280 pub const fn wutmf(&self) -> super::vals::Wutmf {
1281 let val = (self.0 >> 2usize) & 0x01;
1282 super::vals::Wutmf::from_bits(val as u8)
1283 }
1284 #[doc = "Wakeup timer masked flag"]
1285 #[inline(always)]
1286 pub fn set_wutmf(&mut self, val: super::vals::Wutmf) {
1287 self.0 = (self.0 & !(0x01 << 2usize)) | (((val.to_bits() as u32) & 0x01) << 2usize);
1288 }
1289 #[doc = "Timestamp masked flag"]
1290 #[inline(always)]
1291 pub const fn tsmf(&self) -> super::vals::Tsmf {
1292 let val = (self.0 >> 3usize) & 0x01;
1293 super::vals::Tsmf::from_bits(val as u8)
1294 }
1295 #[doc = "Timestamp masked flag"]
1296 #[inline(always)]
1297 pub fn set_tsmf(&mut self, val: super::vals::Tsmf) {
1298 self.0 = (self.0 & !(0x01 << 3usize)) | (((val.to_bits() as u32) & 0x01) << 3usize);
1299 }
1300 #[doc = "Timestamp overflow masked flag"]
1301 #[inline(always)]
1302 pub const fn tsovmf(&self) -> super::vals::Tsovmf {
1303 let val = (self.0 >> 4usize) & 0x01;
1304 super::vals::Tsovmf::from_bits(val as u8)
1305 }
1306 #[doc = "Timestamp overflow masked flag"]
1307 #[inline(always)]
1308 pub fn set_tsovmf(&mut self, val: super::vals::Tsovmf) {
1309 self.0 = (self.0 & !(0x01 << 4usize)) | (((val.to_bits() as u32) & 0x01) << 4usize);
1310 }
1311 #[doc = "Internal timestamp masked flag"]
1312 #[inline(always)]
1313 pub const fn itsmf(&self) -> super::vals::Itsmf {
1314 let val = (self.0 >> 5usize) & 0x01;
1315 super::vals::Itsmf::from_bits(val as u8)
1316 }
1317 #[doc = "Internal timestamp masked flag"]
1318 #[inline(always)]
1319 pub fn set_itsmf(&mut self, val: super::vals::Itsmf) {
1320 self.0 = (self.0 & !(0x01 << 5usize)) | (((val.to_bits() as u32) & 0x01) << 5usize);
1321 }
1322 #[doc = "SSR underflow masked flag"]
1323 #[inline(always)]
1324 pub const fn ssrumf(&self) -> super::vals::Ssrumf {
1325 let val = (self.0 >> 6usize) & 0x01;
1326 super::vals::Ssrumf::from_bits(val as u8)
1327 }
1328 #[doc = "SSR underflow masked flag"]
1329 #[inline(always)]
1330 pub fn set_ssrumf(&mut self, val: super::vals::Ssrumf) {
1331 self.0 = (self.0 & !(0x01 << 6usize)) | (((val.to_bits() as u32) & 0x01) << 6usize);
1332 }
1333 }
1334 impl Default for Misr {
1335 #[inline(always)]
1336 fn default() -> Misr {
1337 Misr(0)
1338 }
1339 }
1340 impl core::fmt::Debug for Misr {
1341 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1342 f.debug_struct("Misr")
1343 .field("alrmf", &[self.alrmf(0usize), self.alrmf(1usize)])
1344 .field("wutmf", &self.wutmf())
1345 .field("tsmf", &self.tsmf())
1346 .field("tsovmf", &self.tsovmf())
1347 .field("itsmf", &self.itsmf())
1348 .field("ssrumf", &self.ssrumf())
1349 .finish()
1350 }
1351 }
1352 #[cfg(feature = "defmt")]
1353 impl defmt::Format for Misr {
1354 fn format(&self, f: defmt::Formatter) {
1355 #[derive(defmt :: Format)]
1356 struct Misr {
1357 alrmf: [super::vals::Alrmf; 2usize],
1358 wutmf: super::vals::Wutmf,
1359 tsmf: super::vals::Tsmf,
1360 tsovmf: super::vals::Tsovmf,
1361 itsmf: super::vals::Itsmf,
1362 ssrumf: super::vals::Ssrumf,
1363 }
1364 let proxy = Misr {
1365 alrmf: [self.alrmf(0usize), self.alrmf(1usize)],
1366 wutmf: self.wutmf(),
1367 tsmf: self.tsmf(),
1368 tsovmf: self.tsovmf(),
1369 itsmf: self.itsmf(),
1370 ssrumf: self.ssrumf(),
1371 };
1372 defmt::write!(f, "{}", proxy)
1373 }
1374 }
1375 #[doc = "Prescaler register"]
1376 #[repr(transparent)]
1377 #[derive(Copy, Clone, Eq, PartialEq)]
1378 pub struct Prer(pub u32);
1379 impl Prer {
1380 #[doc = "Synchronous prescaler factor"]
1381 #[inline(always)]
1382 pub const fn prediv_s(&self) -> u16 {
1383 let val = (self.0 >> 0usize) & 0x7fff;
1384 val as u16
1385 }
1386 #[doc = "Synchronous prescaler factor"]
1387 #[inline(always)]
1388 pub fn set_prediv_s(&mut self, val: u16) {
1389 self.0 = (self.0 & !(0x7fff << 0usize)) | (((val as u32) & 0x7fff) << 0usize);
1390 }
1391 #[doc = "Asynchronous prescaler factor"]
1392 #[inline(always)]
1393 pub const fn prediv_a(&self) -> u8 {
1394 let val = (self.0 >> 16usize) & 0x7f;
1395 val as u8
1396 }
1397 #[doc = "Asynchronous prescaler factor"]
1398 #[inline(always)]
1399 pub fn set_prediv_a(&mut self, val: u8) {
1400 self.0 = (self.0 & !(0x7f << 16usize)) | (((val as u32) & 0x7f) << 16usize);
1401 }
1402 }
1403 impl Default for Prer {
1404 #[inline(always)]
1405 fn default() -> Prer {
1406 Prer(0)
1407 }
1408 }
1409 impl core::fmt::Debug for Prer {
1410 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1411 f.debug_struct("Prer")
1412 .field("prediv_s", &self.prediv_s())
1413 .field("prediv_a", &self.prediv_a())
1414 .finish()
1415 }
1416 }
1417 #[cfg(feature = "defmt")]
1418 impl defmt::Format for Prer {
1419 fn format(&self, f: defmt::Formatter) {
1420 #[derive(defmt :: Format)]
1421 struct Prer {
1422 prediv_s: u16,
1423 prediv_a: u8,
1424 }
1425 let proxy = Prer {
1426 prediv_s: self.prediv_s(),
1427 prediv_a: self.prediv_a(),
1428 };
1429 defmt::write!(f, "{}", proxy)
1430 }
1431 }
1432 #[doc = "Privilege mode control register"]
1433 #[repr(transparent)]
1434 #[derive(Copy, Clone, Eq, PartialEq)]
1435 pub struct Privcr(pub u32);
1436 impl Privcr {
1437 #[doc = "ALRPRIV"]
1438 #[inline(always)]
1439 pub const fn alrpriv(&self, n: usize) -> bool {
1440 assert!(n < 2usize);
1441 let offs = 0usize + n * 1usize;
1442 let val = (self.0 >> offs) & 0x01;
1443 val != 0
1444 }
1445 #[doc = "ALRPRIV"]
1446 #[inline(always)]
1447 pub fn set_alrpriv(&mut self, n: usize, val: bool) {
1448 assert!(n < 2usize);
1449 let offs = 0usize + n * 1usize;
1450 self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
1451 }
1452 #[doc = "WUTPRIV"]
1453 #[inline(always)]
1454 pub const fn wutpriv(&self) -> bool {
1455 let val = (self.0 >> 2usize) & 0x01;
1456 val != 0
1457 }
1458 #[doc = "WUTPRIV"]
1459 #[inline(always)]
1460 pub fn set_wutpriv(&mut self, val: bool) {
1461 self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
1462 }
1463 #[doc = "TSPRIV"]
1464 #[inline(always)]
1465 pub const fn tspriv(&self) -> bool {
1466 let val = (self.0 >> 3usize) & 0x01;
1467 val != 0
1468 }
1469 #[doc = "TSPRIV"]
1470 #[inline(always)]
1471 pub fn set_tspriv(&mut self, val: bool) {
1472 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
1473 }
1474 #[doc = "CALPRIV"]
1475 #[inline(always)]
1476 pub const fn calpriv(&self) -> bool {
1477 let val = (self.0 >> 13usize) & 0x01;
1478 val != 0
1479 }
1480 #[doc = "CALPRIV"]
1481 #[inline(always)]
1482 pub fn set_calpriv(&mut self, val: bool) {
1483 self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
1484 }
1485 #[doc = "INITPRIV"]
1486 #[inline(always)]
1487 pub const fn initpriv(&self) -> bool {
1488 let val = (self.0 >> 14usize) & 0x01;
1489 val != 0
1490 }
1491 #[doc = "INITPRIV"]
1492 #[inline(always)]
1493 pub fn set_initpriv(&mut self, val: bool) {
1494 self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
1495 }
1496 #[doc = "PRIV"]
1497 #[inline(always)]
1498 pub const fn priv_(&self) -> bool {
1499 let val = (self.0 >> 15usize) & 0x01;
1500 val != 0
1501 }
1502 #[doc = "PRIV"]
1503 #[inline(always)]
1504 pub fn set_priv_(&mut self, val: bool) {
1505 self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
1506 }
1507 }
1508 impl Default for Privcr {
1509 #[inline(always)]
1510 fn default() -> Privcr {
1511 Privcr(0)
1512 }
1513 }
1514 impl core::fmt::Debug for Privcr {
1515 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1516 f.debug_struct("Privcr")
1517 .field("alrpriv", &[self.alrpriv(0usize), self.alrpriv(1usize)])
1518 .field("wutpriv", &self.wutpriv())
1519 .field("tspriv", &self.tspriv())
1520 .field("calpriv", &self.calpriv())
1521 .field("initpriv", &self.initpriv())
1522 .field("priv_", &self.priv_())
1523 .finish()
1524 }
1525 }
1526 #[cfg(feature = "defmt")]
1527 impl defmt::Format for Privcr {
1528 fn format(&self, f: defmt::Formatter) {
1529 #[derive(defmt :: Format)]
1530 struct Privcr {
1531 alrpriv: [bool; 2usize],
1532 wutpriv: bool,
1533 tspriv: bool,
1534 calpriv: bool,
1535 initpriv: bool,
1536 priv_: bool,
1537 }
1538 let proxy = Privcr {
1539 alrpriv: [self.alrpriv(0usize), self.alrpriv(1usize)],
1540 wutpriv: self.wutpriv(),
1541 tspriv: self.tspriv(),
1542 calpriv: self.calpriv(),
1543 initpriv: self.initpriv(),
1544 priv_: self.priv_(),
1545 };
1546 defmt::write!(f, "{}", proxy)
1547 }
1548 }
1549 #[doc = "Status clear register"]
1550 #[repr(transparent)]
1551 #[derive(Copy, Clone, Eq, PartialEq)]
1552 pub struct Scr(pub u32);
1553 impl Scr {
1554 #[doc = "Clear alarm x flag"]
1555 #[inline(always)]
1556 pub const fn calrf(&self, n: usize) -> super::vals::Calrf {
1557 assert!(n < 2usize);
1558 let offs = 0usize + n * 1usize;
1559 let val = (self.0 >> offs) & 0x01;
1560 super::vals::Calrf::from_bits(val as u8)
1561 }
1562 #[doc = "Clear alarm x flag"]
1563 #[inline(always)]
1564 pub fn set_calrf(&mut self, n: usize, val: super::vals::Calrf) {
1565 assert!(n < 2usize);
1566 let offs = 0usize + n * 1usize;
1567 self.0 = (self.0 & !(0x01 << offs)) | (((val.to_bits() as u32) & 0x01) << offs);
1568 }
1569 #[doc = "Clear wakeup timer flag"]
1570 #[inline(always)]
1571 pub const fn cwutf(&self) -> super::vals::Calrf {
1572 let val = (self.0 >> 2usize) & 0x01;
1573 super::vals::Calrf::from_bits(val as u8)
1574 }
1575 #[doc = "Clear wakeup timer flag"]
1576 #[inline(always)]
1577 pub fn set_cwutf(&mut self, val: super::vals::Calrf) {
1578 self.0 = (self.0 & !(0x01 << 2usize)) | (((val.to_bits() as u32) & 0x01) << 2usize);
1579 }
1580 #[doc = "Clear timestamp flag"]
1581 #[inline(always)]
1582 pub const fn ctsf(&self) -> super::vals::Calrf {
1583 let val = (self.0 >> 3usize) & 0x01;
1584 super::vals::Calrf::from_bits(val as u8)
1585 }
1586 #[doc = "Clear timestamp flag"]
1587 #[inline(always)]
1588 pub fn set_ctsf(&mut self, val: super::vals::Calrf) {
1589 self.0 = (self.0 & !(0x01 << 3usize)) | (((val.to_bits() as u32) & 0x01) << 3usize);
1590 }
1591 #[doc = "Clear timestamp overflow flag"]
1592 #[inline(always)]
1593 pub const fn ctsovf(&self) -> super::vals::Calrf {
1594 let val = (self.0 >> 4usize) & 0x01;
1595 super::vals::Calrf::from_bits(val as u8)
1596 }
1597 #[doc = "Clear timestamp overflow flag"]
1598 #[inline(always)]
1599 pub fn set_ctsovf(&mut self, val: super::vals::Calrf) {
1600 self.0 = (self.0 & !(0x01 << 4usize)) | (((val.to_bits() as u32) & 0x01) << 4usize);
1601 }
1602 #[doc = "Clear internal timestamp flag"]
1603 #[inline(always)]
1604 pub const fn citsf(&self) -> super::vals::Calrf {
1605 let val = (self.0 >> 5usize) & 0x01;
1606 super::vals::Calrf::from_bits(val as u8)
1607 }
1608 #[doc = "Clear internal timestamp flag"]
1609 #[inline(always)]
1610 pub fn set_citsf(&mut self, val: super::vals::Calrf) {
1611 self.0 = (self.0 & !(0x01 << 5usize)) | (((val.to_bits() as u32) & 0x01) << 5usize);
1612 }
1613 #[doc = "Clear SSR underflow flag"]
1614 #[inline(always)]
1615 pub const fn cssruf(&self) -> super::vals::Calrf {
1616 let val = (self.0 >> 6usize) & 0x01;
1617 super::vals::Calrf::from_bits(val as u8)
1618 }
1619 #[doc = "Clear SSR underflow flag"]
1620 #[inline(always)]
1621 pub fn set_cssruf(&mut self, val: super::vals::Calrf) {
1622 self.0 = (self.0 & !(0x01 << 6usize)) | (((val.to_bits() as u32) & 0x01) << 6usize);
1623 }
1624 }
1625 impl Default for Scr {
1626 #[inline(always)]
1627 fn default() -> Scr {
1628 Scr(0)
1629 }
1630 }
1631 impl core::fmt::Debug for Scr {
1632 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1633 f.debug_struct("Scr")
1634 .field("calrf", &[self.calrf(0usize), self.calrf(1usize)])
1635 .field("cwutf", &self.cwutf())
1636 .field("ctsf", &self.ctsf())
1637 .field("ctsovf", &self.ctsovf())
1638 .field("citsf", &self.citsf())
1639 .field("cssruf", &self.cssruf())
1640 .finish()
1641 }
1642 }
1643 #[cfg(feature = "defmt")]
1644 impl defmt::Format for Scr {
1645 fn format(&self, f: defmt::Formatter) {
1646 #[derive(defmt :: Format)]
1647 struct Scr {
1648 calrf: [super::vals::Calrf; 2usize],
1649 cwutf: super::vals::Calrf,
1650 ctsf: super::vals::Calrf,
1651 ctsovf: super::vals::Calrf,
1652 citsf: super::vals::Calrf,
1653 cssruf: super::vals::Calrf,
1654 }
1655 let proxy = Scr {
1656 calrf: [self.calrf(0usize), self.calrf(1usize)],
1657 cwutf: self.cwutf(),
1658 ctsf: self.ctsf(),
1659 ctsovf: self.ctsovf(),
1660 citsf: self.citsf(),
1661 cssruf: self.cssruf(),
1662 };
1663 defmt::write!(f, "{}", proxy)
1664 }
1665 }
1666 #[doc = "Secure mode control register"]
1667 #[repr(transparent)]
1668 #[derive(Copy, Clone, Eq, PartialEq)]
1669 pub struct Seccfgr(pub u32);
1670 impl Seccfgr {
1671 #[doc = "ALRASEC"]
1672 #[inline(always)]
1673 pub const fn alrasec(&self) -> bool {
1674 let val = (self.0 >> 0usize) & 0x01;
1675 val != 0
1676 }
1677 #[doc = "ALRASEC"]
1678 #[inline(always)]
1679 pub fn set_alrasec(&mut self, val: bool) {
1680 self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
1681 }
1682 #[doc = "ALRBSEC"]
1683 #[inline(always)]
1684 pub const fn alrbsec(&self) -> bool {
1685 let val = (self.0 >> 1usize) & 0x01;
1686 val != 0
1687 }
1688 #[doc = "ALRBSEC"]
1689 #[inline(always)]
1690 pub fn set_alrbsec(&mut self, val: bool) {
1691 self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
1692 }
1693 #[doc = "WUTSEC"]
1694 #[inline(always)]
1695 pub const fn wutsec(&self) -> bool {
1696 let val = (self.0 >> 2usize) & 0x01;
1697 val != 0
1698 }
1699 #[doc = "WUTSEC"]
1700 #[inline(always)]
1701 pub fn set_wutsec(&mut self, val: bool) {
1702 self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
1703 }
1704 #[doc = "TSSEC"]
1705 #[inline(always)]
1706 pub const fn tssec(&self) -> bool {
1707 let val = (self.0 >> 3usize) & 0x01;
1708 val != 0
1709 }
1710 #[doc = "TSSEC"]
1711 #[inline(always)]
1712 pub fn set_tssec(&mut self, val: bool) {
1713 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
1714 }
1715 #[doc = "CALSEC"]
1716 #[inline(always)]
1717 pub const fn calsec(&self) -> bool {
1718 let val = (self.0 >> 13usize) & 0x01;
1719 val != 0
1720 }
1721 #[doc = "CALSEC"]
1722 #[inline(always)]
1723 pub fn set_calsec(&mut self, val: bool) {
1724 self.0 = (self.0 & !(0x01 << 13usize)) | (((val as u32) & 0x01) << 13usize);
1725 }
1726 #[doc = "INITSEC"]
1727 #[inline(always)]
1728 pub const fn initsec(&self) -> bool {
1729 let val = (self.0 >> 14usize) & 0x01;
1730 val != 0
1731 }
1732 #[doc = "INITSEC"]
1733 #[inline(always)]
1734 pub fn set_initsec(&mut self, val: bool) {
1735 self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
1736 }
1737 #[doc = "SEC"]
1738 #[inline(always)]
1739 pub const fn sec(&self) -> bool {
1740 let val = (self.0 >> 15usize) & 0x01;
1741 val != 0
1742 }
1743 #[doc = "SEC"]
1744 #[inline(always)]
1745 pub fn set_sec(&mut self, val: bool) {
1746 self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
1747 }
1748 }
1749 impl Default for Seccfgr {
1750 #[inline(always)]
1751 fn default() -> Seccfgr {
1752 Seccfgr(0)
1753 }
1754 }
1755 impl core::fmt::Debug for Seccfgr {
1756 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1757 f.debug_struct("Seccfgr")
1758 .field("alrasec", &self.alrasec())
1759 .field("alrbsec", &self.alrbsec())
1760 .field("wutsec", &self.wutsec())
1761 .field("tssec", &self.tssec())
1762 .field("calsec", &self.calsec())
1763 .field("initsec", &self.initsec())
1764 .field("sec", &self.sec())
1765 .finish()
1766 }
1767 }
1768 #[cfg(feature = "defmt")]
1769 impl defmt::Format for Seccfgr {
1770 fn format(&self, f: defmt::Formatter) {
1771 #[derive(defmt :: Format)]
1772 struct Seccfgr {
1773 alrasec: bool,
1774 alrbsec: bool,
1775 wutsec: bool,
1776 tssec: bool,
1777 calsec: bool,
1778 initsec: bool,
1779 sec: bool,
1780 }
1781 let proxy = Seccfgr {
1782 alrasec: self.alrasec(),
1783 alrbsec: self.alrbsec(),
1784 wutsec: self.wutsec(),
1785 tssec: self.tssec(),
1786 calsec: self.calsec(),
1787 initsec: self.initsec(),
1788 sec: self.sec(),
1789 };
1790 defmt::write!(f, "{}", proxy)
1791 }
1792 }
1793 #[doc = "Shift control register"]
1794 #[repr(transparent)]
1795 #[derive(Copy, Clone, Eq, PartialEq)]
1796 pub struct Shiftr(pub u32);
1797 impl Shiftr {
1798 #[doc = "Subtract a fraction of a second"]
1799 #[inline(always)]
1800 pub const fn subfs(&self) -> u16 {
1801 let val = (self.0 >> 0usize) & 0x7fff;
1802 val as u16
1803 }
1804 #[doc = "Subtract a fraction of a second"]
1805 #[inline(always)]
1806 pub fn set_subfs(&mut self, val: u16) {
1807 self.0 = (self.0 & !(0x7fff << 0usize)) | (((val as u32) & 0x7fff) << 0usize);
1808 }
1809 #[doc = "Add one second"]
1810 #[inline(always)]
1811 pub const fn add1s(&self) -> bool {
1812 let val = (self.0 >> 31usize) & 0x01;
1813 val != 0
1814 }
1815 #[doc = "Add one second"]
1816 #[inline(always)]
1817 pub fn set_add1s(&mut self, val: bool) {
1818 self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
1819 }
1820 }
1821 impl Default for Shiftr {
1822 #[inline(always)]
1823 fn default() -> Shiftr {
1824 Shiftr(0)
1825 }
1826 }
1827 impl core::fmt::Debug for Shiftr {
1828 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1829 f.debug_struct("Shiftr")
1830 .field("subfs", &self.subfs())
1831 .field("add1s", &self.add1s())
1832 .finish()
1833 }
1834 }
1835 #[cfg(feature = "defmt")]
1836 impl defmt::Format for Shiftr {
1837 fn format(&self, f: defmt::Formatter) {
1838 #[derive(defmt :: Format)]
1839 struct Shiftr {
1840 subfs: u16,
1841 add1s: bool,
1842 }
1843 let proxy = Shiftr {
1844 subfs: self.subfs(),
1845 add1s: self.add1s(),
1846 };
1847 defmt::write!(f, "{}", proxy)
1848 }
1849 }
1850 #[doc = "Secure masked interrupt status register"]
1851 #[repr(transparent)]
1852 #[derive(Copy, Clone, Eq, PartialEq)]
1853 pub struct Smisr(pub u32);
1854 impl Smisr {
1855 #[doc = "Alarm x interrupt secure masked flag"]
1856 #[inline(always)]
1857 pub const fn alrmf(&self, n: usize) -> bool {
1858 assert!(n < 2usize);
1859 let offs = 0usize + n * 1usize;
1860 let val = (self.0 >> offs) & 0x01;
1861 val != 0
1862 }
1863 #[doc = "Alarm x interrupt secure masked flag"]
1864 #[inline(always)]
1865 pub fn set_alrmf(&mut self, n: usize, val: bool) {
1866 assert!(n < 2usize);
1867 let offs = 0usize + n * 1usize;
1868 self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
1869 }
1870 #[doc = "WUTMF"]
1871 #[inline(always)]
1872 pub const fn wutmf(&self) -> bool {
1873 let val = (self.0 >> 2usize) & 0x01;
1874 val != 0
1875 }
1876 #[doc = "WUTMF"]
1877 #[inline(always)]
1878 pub fn set_wutmf(&mut self, val: bool) {
1879 self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
1880 }
1881 #[doc = "TSMF"]
1882 #[inline(always)]
1883 pub const fn tsmf(&self) -> bool {
1884 let val = (self.0 >> 3usize) & 0x01;
1885 val != 0
1886 }
1887 #[doc = "TSMF"]
1888 #[inline(always)]
1889 pub fn set_tsmf(&mut self, val: bool) {
1890 self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
1891 }
1892 #[doc = "TSOVMF"]
1893 #[inline(always)]
1894 pub const fn tsovmf(&self) -> bool {
1895 let val = (self.0 >> 4usize) & 0x01;
1896 val != 0
1897 }
1898 #[doc = "TSOVMF"]
1899 #[inline(always)]
1900 pub fn set_tsovmf(&mut self, val: bool) {
1901 self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
1902 }
1903 #[doc = "ITSMF"]
1904 #[inline(always)]
1905 pub const fn itsmf(&self) -> bool {
1906 let val = (self.0 >> 5usize) & 0x01;
1907 val != 0
1908 }
1909 #[doc = "ITSMF"]
1910 #[inline(always)]
1911 pub fn set_itsmf(&mut self, val: bool) {
1912 self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
1913 }
1914 #[doc = "SSRUMF"]
1915 #[inline(always)]
1916 pub const fn ssrumf(&self) -> bool {
1917 let val = (self.0 >> 6usize) & 0x01;
1918 val != 0
1919 }
1920 #[doc = "SSRUMF"]
1921 #[inline(always)]
1922 pub fn set_ssrumf(&mut self, val: bool) {
1923 self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
1924 }
1925 }
1926 impl Default for Smisr {
1927 #[inline(always)]
1928 fn default() -> Smisr {
1929 Smisr(0)
1930 }
1931 }
1932 impl core::fmt::Debug for Smisr {
1933 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
1934 f.debug_struct("Smisr")
1935 .field("alrmf", &[self.alrmf(0usize), self.alrmf(1usize)])
1936 .field("wutmf", &self.wutmf())
1937 .field("tsmf", &self.tsmf())
1938 .field("tsovmf", &self.tsovmf())
1939 .field("itsmf", &self.itsmf())
1940 .field("ssrumf", &self.ssrumf())
1941 .finish()
1942 }
1943 }
1944 #[cfg(feature = "defmt")]
1945 impl defmt::Format for Smisr {
1946 fn format(&self, f: defmt::Formatter) {
1947 #[derive(defmt :: Format)]
1948 struct Smisr {
1949 alrmf: [bool; 2usize],
1950 wutmf: bool,
1951 tsmf: bool,
1952 tsovmf: bool,
1953 itsmf: bool,
1954 ssrumf: bool,
1955 }
1956 let proxy = Smisr {
1957 alrmf: [self.alrmf(0usize), self.alrmf(1usize)],
1958 wutmf: self.wutmf(),
1959 tsmf: self.tsmf(),
1960 tsovmf: self.tsovmf(),
1961 itsmf: self.itsmf(),
1962 ssrumf: self.ssrumf(),
1963 };
1964 defmt::write!(f, "{}", proxy)
1965 }
1966 }
1967 #[doc = "Status register"]
1968 #[repr(transparent)]
1969 #[derive(Copy, Clone, Eq, PartialEq)]
1970 pub struct Sr(pub u32);
1971 impl Sr {
1972 #[doc = "Alarm flag"]
1973 #[inline(always)]
1974 pub const fn alrf(&self, n: usize) -> super::vals::Alrf {
1975 assert!(n < 2usize);
1976 let offs = 0usize + n * 1usize;
1977 let val = (self.0 >> offs) & 0x01;
1978 super::vals::Alrf::from_bits(val as u8)
1979 }
1980 #[doc = "Alarm flag"]
1981 #[inline(always)]
1982 pub fn set_alrf(&mut self, n: usize, val: super::vals::Alrf) {
1983 assert!(n < 2usize);
1984 let offs = 0usize + n * 1usize;
1985 self.0 = (self.0 & !(0x01 << offs)) | (((val.to_bits() as u32) & 0x01) << offs);
1986 }
1987 #[doc = "Wakeup timer flag"]
1988 #[inline(always)]
1989 pub const fn wutf(&self) -> super::vals::Wutf {
1990 let val = (self.0 >> 2usize) & 0x01;
1991 super::vals::Wutf::from_bits(val as u8)
1992 }
1993 #[doc = "Wakeup timer flag"]
1994 #[inline(always)]
1995 pub fn set_wutf(&mut self, val: super::vals::Wutf) {
1996 self.0 = (self.0 & !(0x01 << 2usize)) | (((val.to_bits() as u32) & 0x01) << 2usize);
1997 }
1998 #[doc = "Timestamp flag"]
1999 #[inline(always)]
2000 pub const fn tsf(&self) -> super::vals::Tsf {
2001 let val = (self.0 >> 3usize) & 0x01;
2002 super::vals::Tsf::from_bits(val as u8)
2003 }
2004 #[doc = "Timestamp flag"]
2005 #[inline(always)]
2006 pub fn set_tsf(&mut self, val: super::vals::Tsf) {
2007 self.0 = (self.0 & !(0x01 << 3usize)) | (((val.to_bits() as u32) & 0x01) << 3usize);
2008 }
2009 #[doc = "Timestamp overflow flag"]
2010 #[inline(always)]
2011 pub const fn tsovf(&self) -> super::vals::Tsovf {
2012 let val = (self.0 >> 4usize) & 0x01;
2013 super::vals::Tsovf::from_bits(val as u8)
2014 }
2015 #[doc = "Timestamp overflow flag"]
2016 #[inline(always)]
2017 pub fn set_tsovf(&mut self, val: super::vals::Tsovf) {
2018 self.0 = (self.0 & !(0x01 << 4usize)) | (((val.to_bits() as u32) & 0x01) << 4usize);
2019 }
2020 #[doc = "Internal timestamp flag"]
2021 #[inline(always)]
2022 pub const fn itsf(&self) -> super::vals::Itsf {
2023 let val = (self.0 >> 5usize) & 0x01;
2024 super::vals::Itsf::from_bits(val as u8)
2025 }
2026 #[doc = "Internal timestamp flag"]
2027 #[inline(always)]
2028 pub fn set_itsf(&mut self, val: super::vals::Itsf) {
2029 self.0 = (self.0 & !(0x01 << 5usize)) | (((val.to_bits() as u32) & 0x01) << 5usize);
2030 }
2031 #[doc = "SSR underflow flag"]
2032 #[inline(always)]
2033 pub const fn ssruf(&self) -> super::vals::Ssruf {
2034 let val = (self.0 >> 6usize) & 0x01;
2035 super::vals::Ssruf::from_bits(val as u8)
2036 }
2037 #[doc = "SSR underflow flag"]
2038 #[inline(always)]
2039 pub fn set_ssruf(&mut self, val: super::vals::Ssruf) {
2040 self.0 = (self.0 & !(0x01 << 6usize)) | (((val.to_bits() as u32) & 0x01) << 6usize);
2041 }
2042 }
2043 impl Default for Sr {
2044 #[inline(always)]
2045 fn default() -> Sr {
2046 Sr(0)
2047 }
2048 }
2049 impl core::fmt::Debug for Sr {
2050 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2051 f.debug_struct("Sr")
2052 .field("alrf", &[self.alrf(0usize), self.alrf(1usize)])
2053 .field("wutf", &self.wutf())
2054 .field("tsf", &self.tsf())
2055 .field("tsovf", &self.tsovf())
2056 .field("itsf", &self.itsf())
2057 .field("ssruf", &self.ssruf())
2058 .finish()
2059 }
2060 }
2061 #[cfg(feature = "defmt")]
2062 impl defmt::Format for Sr {
2063 fn format(&self, f: defmt::Formatter) {
2064 #[derive(defmt :: Format)]
2065 struct Sr {
2066 alrf: [super::vals::Alrf; 2usize],
2067 wutf: super::vals::Wutf,
2068 tsf: super::vals::Tsf,
2069 tsovf: super::vals::Tsovf,
2070 itsf: super::vals::Itsf,
2071 ssruf: super::vals::Ssruf,
2072 }
2073 let proxy = Sr {
2074 alrf: [self.alrf(0usize), self.alrf(1usize)],
2075 wutf: self.wutf(),
2076 tsf: self.tsf(),
2077 tsovf: self.tsovf(),
2078 itsf: self.itsf(),
2079 ssruf: self.ssruf(),
2080 };
2081 defmt::write!(f, "{}", proxy)
2082 }
2083 }
2084 #[doc = "Sub second register"]
2085 #[repr(transparent)]
2086 #[derive(Copy, Clone, Eq, PartialEq)]
2087 pub struct Ssr(pub u32);
2088 impl Ssr {
2089 #[doc = "Synchronous binary counter"]
2090 #[inline(always)]
2091 pub const fn ss(&self) -> u32 {
2092 let val = (self.0 >> 0usize) & 0xffff_ffff;
2093 val as u32
2094 }
2095 #[doc = "Synchronous binary counter"]
2096 #[inline(always)]
2097 pub fn set_ss(&mut self, val: u32) {
2098 self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
2099 }
2100 }
2101 impl Default for Ssr {
2102 #[inline(always)]
2103 fn default() -> Ssr {
2104 Ssr(0)
2105 }
2106 }
2107 impl core::fmt::Debug for Ssr {
2108 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2109 f.debug_struct("Ssr").field("ss", &self.ss()).finish()
2110 }
2111 }
2112 #[cfg(feature = "defmt")]
2113 impl defmt::Format for Ssr {
2114 fn format(&self, f: defmt::Formatter) {
2115 #[derive(defmt :: Format)]
2116 struct Ssr {
2117 ss: u32,
2118 }
2119 let proxy = Ssr { ss: self.ss() };
2120 defmt::write!(f, "{}", proxy)
2121 }
2122 }
2123 #[doc = "Time register"]
2124 #[repr(transparent)]
2125 #[derive(Copy, Clone, Eq, PartialEq)]
2126 pub struct Tr(pub u32);
2127 impl Tr {
2128 #[doc = "Second units in BCD format"]
2129 #[inline(always)]
2130 pub const fn su(&self) -> u8 {
2131 let val = (self.0 >> 0usize) & 0x0f;
2132 val as u8
2133 }
2134 #[doc = "Second units in BCD format"]
2135 #[inline(always)]
2136 pub fn set_su(&mut self, val: u8) {
2137 self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize);
2138 }
2139 #[doc = "Second tens in BCD format"]
2140 #[inline(always)]
2141 pub const fn st(&self) -> u8 {
2142 let val = (self.0 >> 4usize) & 0x07;
2143 val as u8
2144 }
2145 #[doc = "Second tens in BCD format"]
2146 #[inline(always)]
2147 pub fn set_st(&mut self, val: u8) {
2148 self.0 = (self.0 & !(0x07 << 4usize)) | (((val as u32) & 0x07) << 4usize);
2149 }
2150 #[doc = "Minute units in BCD format"]
2151 #[inline(always)]
2152 pub const fn mnu(&self) -> u8 {
2153 let val = (self.0 >> 8usize) & 0x0f;
2154 val as u8
2155 }
2156 #[doc = "Minute units in BCD format"]
2157 #[inline(always)]
2158 pub fn set_mnu(&mut self, val: u8) {
2159 self.0 = (self.0 & !(0x0f << 8usize)) | (((val as u32) & 0x0f) << 8usize);
2160 }
2161 #[doc = "Minute tens in BCD format"]
2162 #[inline(always)]
2163 pub const fn mnt(&self) -> u8 {
2164 let val = (self.0 >> 12usize) & 0x07;
2165 val as u8
2166 }
2167 #[doc = "Minute tens in BCD format"]
2168 #[inline(always)]
2169 pub fn set_mnt(&mut self, val: u8) {
2170 self.0 = (self.0 & !(0x07 << 12usize)) | (((val as u32) & 0x07) << 12usize);
2171 }
2172 #[doc = "Hour units in BCD format"]
2173 #[inline(always)]
2174 pub const fn hu(&self) -> u8 {
2175 let val = (self.0 >> 16usize) & 0x0f;
2176 val as u8
2177 }
2178 #[doc = "Hour units in BCD format"]
2179 #[inline(always)]
2180 pub fn set_hu(&mut self, val: u8) {
2181 self.0 = (self.0 & !(0x0f << 16usize)) | (((val as u32) & 0x0f) << 16usize);
2182 }
2183 #[doc = "Hour tens in BCD format"]
2184 #[inline(always)]
2185 pub const fn ht(&self) -> u8 {
2186 let val = (self.0 >> 20usize) & 0x03;
2187 val as u8
2188 }
2189 #[doc = "Hour tens in BCD format"]
2190 #[inline(always)]
2191 pub fn set_ht(&mut self, val: u8) {
2192 self.0 = (self.0 & !(0x03 << 20usize)) | (((val as u32) & 0x03) << 20usize);
2193 }
2194 #[doc = "AM/PM notation"]
2195 #[inline(always)]
2196 pub const fn pm(&self) -> super::vals::Ampm {
2197 let val = (self.0 >> 22usize) & 0x01;
2198 super::vals::Ampm::from_bits(val as u8)
2199 }
2200 #[doc = "AM/PM notation"]
2201 #[inline(always)]
2202 pub fn set_pm(&mut self, val: super::vals::Ampm) {
2203 self.0 = (self.0 & !(0x01 << 22usize)) | (((val.to_bits() as u32) & 0x01) << 22usize);
2204 }
2205 }
2206 impl Default for Tr {
2207 #[inline(always)]
2208 fn default() -> Tr {
2209 Tr(0)
2210 }
2211 }
2212 impl core::fmt::Debug for Tr {
2213 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2214 f.debug_struct("Tr")
2215 .field("su", &self.su())
2216 .field("st", &self.st())
2217 .field("mnu", &self.mnu())
2218 .field("mnt", &self.mnt())
2219 .field("hu", &self.hu())
2220 .field("ht", &self.ht())
2221 .field("pm", &self.pm())
2222 .finish()
2223 }
2224 }
2225 #[cfg(feature = "defmt")]
2226 impl defmt::Format for Tr {
2227 fn format(&self, f: defmt::Formatter) {
2228 #[derive(defmt :: Format)]
2229 struct Tr {
2230 su: u8,
2231 st: u8,
2232 mnu: u8,
2233 mnt: u8,
2234 hu: u8,
2235 ht: u8,
2236 pm: super::vals::Ampm,
2237 }
2238 let proxy = Tr {
2239 su: self.su(),
2240 st: self.st(),
2241 mnu: self.mnu(),
2242 mnt: self.mnt(),
2243 hu: self.hu(),
2244 ht: self.ht(),
2245 pm: self.pm(),
2246 };
2247 defmt::write!(f, "{}", proxy)
2248 }
2249 }
2250 #[doc = "Timestamp date register"]
2251 #[repr(transparent)]
2252 #[derive(Copy, Clone, Eq, PartialEq)]
2253 pub struct Tsdr(pub u32);
2254 impl Tsdr {
2255 #[doc = "Date units in BCD format"]
2256 #[inline(always)]
2257 pub const fn du(&self) -> u8 {
2258 let val = (self.0 >> 0usize) & 0x0f;
2259 val as u8
2260 }
2261 #[doc = "Date units in BCD format"]
2262 #[inline(always)]
2263 pub fn set_du(&mut self, val: u8) {
2264 self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize);
2265 }
2266 #[doc = "Date tens in BCD format"]
2267 #[inline(always)]
2268 pub const fn dt(&self) -> u8 {
2269 let val = (self.0 >> 4usize) & 0x03;
2270 val as u8
2271 }
2272 #[doc = "Date tens in BCD format"]
2273 #[inline(always)]
2274 pub fn set_dt(&mut self, val: u8) {
2275 self.0 = (self.0 & !(0x03 << 4usize)) | (((val as u32) & 0x03) << 4usize);
2276 }
2277 #[doc = "Month units in BCD format"]
2278 #[inline(always)]
2279 pub const fn mu(&self) -> u8 {
2280 let val = (self.0 >> 8usize) & 0x0f;
2281 val as u8
2282 }
2283 #[doc = "Month units in BCD format"]
2284 #[inline(always)]
2285 pub fn set_mu(&mut self, val: u8) {
2286 self.0 = (self.0 & !(0x0f << 8usize)) | (((val as u32) & 0x0f) << 8usize);
2287 }
2288 #[doc = "Month tens in BCD format"]
2289 #[inline(always)]
2290 pub const fn mt(&self) -> bool {
2291 let val = (self.0 >> 12usize) & 0x01;
2292 val != 0
2293 }
2294 #[doc = "Month tens in BCD format"]
2295 #[inline(always)]
2296 pub fn set_mt(&mut self, val: bool) {
2297 self.0 = (self.0 & !(0x01 << 12usize)) | (((val as u32) & 0x01) << 12usize);
2298 }
2299 #[doc = "Week day units"]
2300 #[inline(always)]
2301 pub const fn wdu(&self) -> u8 {
2302 let val = (self.0 >> 13usize) & 0x07;
2303 val as u8
2304 }
2305 #[doc = "Week day units"]
2306 #[inline(always)]
2307 pub fn set_wdu(&mut self, val: u8) {
2308 self.0 = (self.0 & !(0x07 << 13usize)) | (((val as u32) & 0x07) << 13usize);
2309 }
2310 }
2311 impl Default for Tsdr {
2312 #[inline(always)]
2313 fn default() -> Tsdr {
2314 Tsdr(0)
2315 }
2316 }
2317 impl core::fmt::Debug for Tsdr {
2318 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2319 f.debug_struct("Tsdr")
2320 .field("du", &self.du())
2321 .field("dt", &self.dt())
2322 .field("mu", &self.mu())
2323 .field("mt", &self.mt())
2324 .field("wdu", &self.wdu())
2325 .finish()
2326 }
2327 }
2328 #[cfg(feature = "defmt")]
2329 impl defmt::Format for Tsdr {
2330 fn format(&self, f: defmt::Formatter) {
2331 #[derive(defmt :: Format)]
2332 struct Tsdr {
2333 du: u8,
2334 dt: u8,
2335 mu: u8,
2336 mt: bool,
2337 wdu: u8,
2338 }
2339 let proxy = Tsdr {
2340 du: self.du(),
2341 dt: self.dt(),
2342 mu: self.mu(),
2343 mt: self.mt(),
2344 wdu: self.wdu(),
2345 };
2346 defmt::write!(f, "{}", proxy)
2347 }
2348 }
2349 #[doc = "Timestamp sub second register"]
2350 #[repr(transparent)]
2351 #[derive(Copy, Clone, Eq, PartialEq)]
2352 pub struct Tsssr(pub u32);
2353 impl Tsssr {
2354 #[doc = "Sub second value"]
2355 #[inline(always)]
2356 pub const fn ss(&self) -> u32 {
2357 let val = (self.0 >> 0usize) & 0xffff_ffff;
2358 val as u32
2359 }
2360 #[doc = "Sub second value"]
2361 #[inline(always)]
2362 pub fn set_ss(&mut self, val: u32) {
2363 self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
2364 }
2365 }
2366 impl Default for Tsssr {
2367 #[inline(always)]
2368 fn default() -> Tsssr {
2369 Tsssr(0)
2370 }
2371 }
2372 impl core::fmt::Debug for Tsssr {
2373 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2374 f.debug_struct("Tsssr").field("ss", &self.ss()).finish()
2375 }
2376 }
2377 #[cfg(feature = "defmt")]
2378 impl defmt::Format for Tsssr {
2379 fn format(&self, f: defmt::Formatter) {
2380 #[derive(defmt :: Format)]
2381 struct Tsssr {
2382 ss: u32,
2383 }
2384 let proxy = Tsssr { ss: self.ss() };
2385 defmt::write!(f, "{}", proxy)
2386 }
2387 }
2388 #[doc = "Timestamp time register"]
2389 #[repr(transparent)]
2390 #[derive(Copy, Clone, Eq, PartialEq)]
2391 pub struct Tstr(pub u32);
2392 impl Tstr {
2393 #[doc = "Second units in BCD format"]
2394 #[inline(always)]
2395 pub const fn su(&self) -> u8 {
2396 let val = (self.0 >> 0usize) & 0x0f;
2397 val as u8
2398 }
2399 #[doc = "Second units in BCD format"]
2400 #[inline(always)]
2401 pub fn set_su(&mut self, val: u8) {
2402 self.0 = (self.0 & !(0x0f << 0usize)) | (((val as u32) & 0x0f) << 0usize);
2403 }
2404 #[doc = "Second tens in BCD format"]
2405 #[inline(always)]
2406 pub const fn st(&self) -> u8 {
2407 let val = (self.0 >> 4usize) & 0x07;
2408 val as u8
2409 }
2410 #[doc = "Second tens in BCD format"]
2411 #[inline(always)]
2412 pub fn set_st(&mut self, val: u8) {
2413 self.0 = (self.0 & !(0x07 << 4usize)) | (((val as u32) & 0x07) << 4usize);
2414 }
2415 #[doc = "Minute units in BCD format"]
2416 #[inline(always)]
2417 pub const fn mnu(&self) -> u8 {
2418 let val = (self.0 >> 8usize) & 0x0f;
2419 val as u8
2420 }
2421 #[doc = "Minute units in BCD format"]
2422 #[inline(always)]
2423 pub fn set_mnu(&mut self, val: u8) {
2424 self.0 = (self.0 & !(0x0f << 8usize)) | (((val as u32) & 0x0f) << 8usize);
2425 }
2426 #[doc = "Minute tens in BCD format"]
2427 #[inline(always)]
2428 pub const fn mnt(&self) -> u8 {
2429 let val = (self.0 >> 12usize) & 0x07;
2430 val as u8
2431 }
2432 #[doc = "Minute tens in BCD format"]
2433 #[inline(always)]
2434 pub fn set_mnt(&mut self, val: u8) {
2435 self.0 = (self.0 & !(0x07 << 12usize)) | (((val as u32) & 0x07) << 12usize);
2436 }
2437 #[doc = "Hour units in BCD format"]
2438 #[inline(always)]
2439 pub const fn hu(&self) -> u8 {
2440 let val = (self.0 >> 16usize) & 0x0f;
2441 val as u8
2442 }
2443 #[doc = "Hour units in BCD format"]
2444 #[inline(always)]
2445 pub fn set_hu(&mut self, val: u8) {
2446 self.0 = (self.0 & !(0x0f << 16usize)) | (((val as u32) & 0x0f) << 16usize);
2447 }
2448 #[doc = "Hour tens in BCD format"]
2449 #[inline(always)]
2450 pub const fn ht(&self) -> u8 {
2451 let val = (self.0 >> 20usize) & 0x03;
2452 val as u8
2453 }
2454 #[doc = "Hour tens in BCD format"]
2455 #[inline(always)]
2456 pub fn set_ht(&mut self, val: u8) {
2457 self.0 = (self.0 & !(0x03 << 20usize)) | (((val as u32) & 0x03) << 20usize);
2458 }
2459 #[doc = "AM/PM notation"]
2460 #[inline(always)]
2461 pub const fn pm(&self) -> bool {
2462 let val = (self.0 >> 22usize) & 0x01;
2463 val != 0
2464 }
2465 #[doc = "AM/PM notation"]
2466 #[inline(always)]
2467 pub fn set_pm(&mut self, val: bool) {
2468 self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize);
2469 }
2470 }
2471 impl Default for Tstr {
2472 #[inline(always)]
2473 fn default() -> Tstr {
2474 Tstr(0)
2475 }
2476 }
2477 impl core::fmt::Debug for Tstr {
2478 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2479 f.debug_struct("Tstr")
2480 .field("su", &self.su())
2481 .field("st", &self.st())
2482 .field("mnu", &self.mnu())
2483 .field("mnt", &self.mnt())
2484 .field("hu", &self.hu())
2485 .field("ht", &self.ht())
2486 .field("pm", &self.pm())
2487 .finish()
2488 }
2489 }
2490 #[cfg(feature = "defmt")]
2491 impl defmt::Format for Tstr {
2492 fn format(&self, f: defmt::Formatter) {
2493 #[derive(defmt :: Format)]
2494 struct Tstr {
2495 su: u8,
2496 st: u8,
2497 mnu: u8,
2498 mnt: u8,
2499 hu: u8,
2500 ht: u8,
2501 pm: bool,
2502 }
2503 let proxy = Tstr {
2504 su: self.su(),
2505 st: self.st(),
2506 mnu: self.mnu(),
2507 mnt: self.mnt(),
2508 hu: self.hu(),
2509 ht: self.ht(),
2510 pm: self.pm(),
2511 };
2512 defmt::write!(f, "{}", proxy)
2513 }
2514 }
2515 #[doc = "Write protection register"]
2516 #[repr(transparent)]
2517 #[derive(Copy, Clone, Eq, PartialEq)]
2518 pub struct Wpr(pub u32);
2519 impl Wpr {
2520 #[doc = "Write protection key"]
2521 #[inline(always)]
2522 pub const fn key(&self) -> super::vals::Key {
2523 let val = (self.0 >> 0usize) & 0xff;
2524 super::vals::Key::from_bits(val as u8)
2525 }
2526 #[doc = "Write protection key"]
2527 #[inline(always)]
2528 pub fn set_key(&mut self, val: super::vals::Key) {
2529 self.0 = (self.0 & !(0xff << 0usize)) | (((val.to_bits() as u32) & 0xff) << 0usize);
2530 }
2531 }
2532 impl Default for Wpr {
2533 #[inline(always)]
2534 fn default() -> Wpr {
2535 Wpr(0)
2536 }
2537 }
2538 impl core::fmt::Debug for Wpr {
2539 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2540 f.debug_struct("Wpr").field("key", &self.key()).finish()
2541 }
2542 }
2543 #[cfg(feature = "defmt")]
2544 impl defmt::Format for Wpr {
2545 fn format(&self, f: defmt::Formatter) {
2546 #[derive(defmt :: Format)]
2547 struct Wpr {
2548 key: super::vals::Key,
2549 }
2550 let proxy = Wpr { key: self.key() };
2551 defmt::write!(f, "{}", proxy)
2552 }
2553 }
2554 #[doc = "Wakeup timer register"]
2555 #[repr(transparent)]
2556 #[derive(Copy, Clone, Eq, PartialEq)]
2557 pub struct Wutr(pub u32);
2558 impl Wutr {
2559 #[doc = "Wakeup auto-reload value bits"]
2560 #[inline(always)]
2561 pub const fn wut(&self) -> u16 {
2562 let val = (self.0 >> 0usize) & 0xffff;
2563 val as u16
2564 }
2565 #[doc = "Wakeup auto-reload value bits"]
2566 #[inline(always)]
2567 pub fn set_wut(&mut self, val: u16) {
2568 self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
2569 }
2570 #[doc = "Wakeup auto-reload output clear value"]
2571 #[inline(always)]
2572 pub const fn wutoclr(&self) -> u16 {
2573 let val = (self.0 >> 16usize) & 0xffff;
2574 val as u16
2575 }
2576 #[doc = "Wakeup auto-reload output clear value"]
2577 #[inline(always)]
2578 pub fn set_wutoclr(&mut self, val: u16) {
2579 self.0 = (self.0 & !(0xffff << 16usize)) | (((val as u32) & 0xffff) << 16usize);
2580 }
2581 }
2582 impl Default for Wutr {
2583 #[inline(always)]
2584 fn default() -> Wutr {
2585 Wutr(0)
2586 }
2587 }
2588 impl core::fmt::Debug for Wutr {
2589 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
2590 f.debug_struct("Wutr")
2591 .field("wut", &self.wut())
2592 .field("wutoclr", &self.wutoclr())
2593 .finish()
2594 }
2595 }
2596 #[cfg(feature = "defmt")]
2597 impl defmt::Format for Wutr {
2598 fn format(&self, f: defmt::Formatter) {
2599 #[derive(defmt :: Format)]
2600 struct Wutr {
2601 wut: u16,
2602 wutoclr: u16,
2603 }
2604 let proxy = Wutr {
2605 wut: self.wut(),
2606 wutoclr: self.wutoclr(),
2607 };
2608 defmt::write!(f, "{}", proxy)
2609 }
2610 }
2611}
2612pub mod vals {
2613 #[repr(u8)]
2614 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
2615 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2616 pub enum Alrf {
2617 _RESERVED_0 = 0x0,
2618 #[doc = "This flag is set by hardware when the time/date registers (RTC_TR and RTC_DR) match the Alarm A register (RTC_ALRMAR)"]
2619 MATCH = 0x01,
2620 }
2621 impl Alrf {
2622 #[inline(always)]
2623 pub const fn from_bits(val: u8) -> Alrf {
2624 unsafe { core::mem::transmute(val & 0x01) }
2625 }
2626 #[inline(always)]
2627 pub const fn to_bits(self) -> u8 {
2628 unsafe { core::mem::transmute(self) }
2629 }
2630 }
2631 impl From<u8> for Alrf {
2632 #[inline(always)]
2633 fn from(val: u8) -> Alrf {
2634 Alrf::from_bits(val)
2635 }
2636 }
2637 impl From<Alrf> for u8 {
2638 #[inline(always)]
2639 fn from(val: Alrf) -> u8 {
2640 Alrf::to_bits(val)
2641 }
2642 }
2643 #[repr(u8)]
2644 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
2645 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2646 pub enum Alrmf {
2647 _RESERVED_0 = 0x0,
2648 #[doc = "This flag is set by hardware when the time/date registers (RTC_TR and RTC_DR) match the Alarm A register (RTC_ALRMAR)"]
2649 MATCH = 0x01,
2650 }
2651 impl Alrmf {
2652 #[inline(always)]
2653 pub const fn from_bits(val: u8) -> Alrmf {
2654 unsafe { core::mem::transmute(val & 0x01) }
2655 }
2656 #[inline(always)]
2657 pub const fn to_bits(self) -> u8 {
2658 unsafe { core::mem::transmute(self) }
2659 }
2660 }
2661 impl From<u8> for Alrmf {
2662 #[inline(always)]
2663 fn from(val: u8) -> Alrmf {
2664 Alrmf::from_bits(val)
2665 }
2666 }
2667 impl From<Alrmf> for u8 {
2668 #[inline(always)]
2669 fn from(val: Alrmf) -> u8 {
2670 Alrmf::to_bits(val)
2671 }
2672 }
2673 #[repr(u8)]
2674 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
2675 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2676 pub enum AlrmrMsk {
2677 #[doc = "Alarm set if the date/day match"]
2678 TO_MATCH = 0x0,
2679 #[doc = "Date/day don’t care in Alarm comparison"]
2680 NOT_MATCH = 0x01,
2681 }
2682 impl AlrmrMsk {
2683 #[inline(always)]
2684 pub const fn from_bits(val: u8) -> AlrmrMsk {
2685 unsafe { core::mem::transmute(val & 0x01) }
2686 }
2687 #[inline(always)]
2688 pub const fn to_bits(self) -> u8 {
2689 unsafe { core::mem::transmute(self) }
2690 }
2691 }
2692 impl From<u8> for AlrmrMsk {
2693 #[inline(always)]
2694 fn from(val: u8) -> AlrmrMsk {
2695 AlrmrMsk::from_bits(val)
2696 }
2697 }
2698 impl From<AlrmrMsk> for u8 {
2699 #[inline(always)]
2700 fn from(val: AlrmrMsk) -> u8 {
2701 AlrmrMsk::to_bits(val)
2702 }
2703 }
2704 #[repr(u8)]
2705 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
2706 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2707 pub enum AlrmrPm {
2708 #[doc = "AM or 24-hour format"]
2709 AM = 0x0,
2710 #[doc = "PM"]
2711 PM = 0x01,
2712 }
2713 impl AlrmrPm {
2714 #[inline(always)]
2715 pub const fn from_bits(val: u8) -> AlrmrPm {
2716 unsafe { core::mem::transmute(val & 0x01) }
2717 }
2718 #[inline(always)]
2719 pub const fn to_bits(self) -> u8 {
2720 unsafe { core::mem::transmute(self) }
2721 }
2722 }
2723 impl From<u8> for AlrmrPm {
2724 #[inline(always)]
2725 fn from(val: u8) -> AlrmrPm {
2726 AlrmrPm::from_bits(val)
2727 }
2728 }
2729 impl From<AlrmrPm> for u8 {
2730 #[inline(always)]
2731 fn from(val: AlrmrPm) -> u8 {
2732 AlrmrPm::to_bits(val)
2733 }
2734 }
2735 #[repr(u8)]
2736 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
2737 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2738 pub enum AlrmrWdsel {
2739 #[doc = "DU\\[3:0\\]
2740represents the date units"]
2741 DATE_UNITS = 0x0,
2742 #[doc = "DU\\[3:0\\]
2743represents the week day. DT\\[1:0\\]
2744is don’t care."]
2745 WEEK_DAY = 0x01,
2746 }
2747 impl AlrmrWdsel {
2748 #[inline(always)]
2749 pub const fn from_bits(val: u8) -> AlrmrWdsel {
2750 unsafe { core::mem::transmute(val & 0x01) }
2751 }
2752 #[inline(always)]
2753 pub const fn to_bits(self) -> u8 {
2754 unsafe { core::mem::transmute(self) }
2755 }
2756 }
2757 impl From<u8> for AlrmrWdsel {
2758 #[inline(always)]
2759 fn from(val: u8) -> AlrmrWdsel {
2760 AlrmrWdsel::from_bits(val)
2761 }
2762 }
2763 impl From<AlrmrWdsel> for u8 {
2764 #[inline(always)]
2765 fn from(val: AlrmrWdsel) -> u8 {
2766 AlrmrWdsel::to_bits(val)
2767 }
2768 }
2769 #[repr(u8)]
2770 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
2771 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2772 pub enum AlrmssrSsclr {
2773 #[doc = "The synchronous binary counter (SS\\[31:0\\]
2774in RTC_SSR) is free-running"]
2775 FREE_RUNNING = 0x0,
2776 #[doc = "The synchronous binary counter (SS\\[31:0\\]
2777in RTC_SSR) is running from 0xFFFF FFFF to RTC_ALRMABINR → SS\\[31:0\\]
2778value and is automatically reloaded with 0xFFFF FFFF when reaching RTC_ALRMABINR → SS\\[31:0\\]"]
2779 ALRMBINR = 0x01,
2780 }
2781 impl AlrmssrSsclr {
2782 #[inline(always)]
2783 pub const fn from_bits(val: u8) -> AlrmssrSsclr {
2784 unsafe { core::mem::transmute(val & 0x01) }
2785 }
2786 #[inline(always)]
2787 pub const fn to_bits(self) -> u8 {
2788 unsafe { core::mem::transmute(self) }
2789 }
2790 }
2791 impl From<u8> for AlrmssrSsclr {
2792 #[inline(always)]
2793 fn from(val: u8) -> AlrmssrSsclr {
2794 AlrmssrSsclr::from_bits(val)
2795 }
2796 }
2797 impl From<AlrmssrSsclr> for u8 {
2798 #[inline(always)]
2799 fn from(val: AlrmssrSsclr) -> u8 {
2800 AlrmssrSsclr::to_bits(val)
2801 }
2802 }
2803 #[repr(u8)]
2804 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
2805 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2806 pub enum Ampm {
2807 #[doc = "AM or 24-hour format"]
2808 AM = 0x0,
2809 #[doc = "PM"]
2810 PM = 0x01,
2811 }
2812 impl Ampm {
2813 #[inline(always)]
2814 pub const fn from_bits(val: u8) -> Ampm {
2815 unsafe { core::mem::transmute(val & 0x01) }
2816 }
2817 #[inline(always)]
2818 pub const fn to_bits(self) -> u8 {
2819 unsafe { core::mem::transmute(self) }
2820 }
2821 }
2822 impl From<u8> for Ampm {
2823 #[inline(always)]
2824 fn from(val: u8) -> Ampm {
2825 Ampm::from_bits(val)
2826 }
2827 }
2828 impl From<Ampm> for u8 {
2829 #[inline(always)]
2830 fn from(val: Ampm) -> u8 {
2831 Ampm::to_bits(val)
2832 }
2833 }
2834 #[repr(u8)]
2835 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
2836 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2837 pub enum Bcdu {
2838 #[doc = "1s increment each time SS\\[7:0\\]=0"]
2839 BIT7 = 0x0,
2840 #[doc = "1s increment each time SS\\[8:0\\]=0"]
2841 BIT8 = 0x01,
2842 #[doc = "1s increment each time SS\\[9:0\\]=0"]
2843 BIT9 = 0x02,
2844 #[doc = "1s increment each time SS\\[10:0\\]=0"]
2845 BIT10 = 0x03,
2846 #[doc = "1s increment each time SS\\[11:0\\]=0"]
2847 BIT11 = 0x04,
2848 #[doc = "1s increment each time SS\\[12:0\\]=0"]
2849 BIT12 = 0x05,
2850 #[doc = "1s increment each time SS\\[13:0\\]=0"]
2851 BIT13 = 0x06,
2852 #[doc = "1s increment each time SS\\[14:0\\]=0"]
2853 BIT14 = 0x07,
2854 }
2855 impl Bcdu {
2856 #[inline(always)]
2857 pub const fn from_bits(val: u8) -> Bcdu {
2858 unsafe { core::mem::transmute(val & 0x07) }
2859 }
2860 #[inline(always)]
2861 pub const fn to_bits(self) -> u8 {
2862 unsafe { core::mem::transmute(self) }
2863 }
2864 }
2865 impl From<u8> for Bcdu {
2866 #[inline(always)]
2867 fn from(val: u8) -> Bcdu {
2868 Bcdu::from_bits(val)
2869 }
2870 }
2871 impl From<Bcdu> for u8 {
2872 #[inline(always)]
2873 fn from(val: Bcdu) -> u8 {
2874 Bcdu::to_bits(val)
2875 }
2876 }
2877 #[repr(u8)]
2878 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
2879 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2880 pub enum Bin {
2881 #[doc = "Free running BCD calendar mode (Binary mode disabled)"]
2882 BCD = 0x0,
2883 #[doc = "Free running Binary mode (BCD mode disabled)"]
2884 BINARY = 0x01,
2885 #[doc = "Free running BCD calendar and Binary modes"]
2886 BIN_BCD = 0x02,
2887 #[doc = "Free running BCD calendar and Binary modes"]
2888 BIN_BCD2 = 0x03,
2889 }
2890 impl Bin {
2891 #[inline(always)]
2892 pub const fn from_bits(val: u8) -> Bin {
2893 unsafe { core::mem::transmute(val & 0x03) }
2894 }
2895 #[inline(always)]
2896 pub const fn to_bits(self) -> u8 {
2897 unsafe { core::mem::transmute(self) }
2898 }
2899 }
2900 impl From<u8> for Bin {
2901 #[inline(always)]
2902 fn from(val: u8) -> Bin {
2903 Bin::from_bits(val)
2904 }
2905 }
2906 impl From<Bin> for u8 {
2907 #[inline(always)]
2908 fn from(val: Bin) -> u8 {
2909 Bin::to_bits(val)
2910 }
2911 }
2912 #[repr(u8)]
2913 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
2914 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2915 pub enum Calp {
2916 #[doc = "No RTCCLK pulses are added"]
2917 NO_CHANGE = 0x0,
2918 #[doc = "One RTCCLK pulse is effectively inserted every 2^11 pulses (frequency increased by 488.5 ppm)"]
2919 INCREASE_FREQ = 0x01,
2920 }
2921 impl Calp {
2922 #[inline(always)]
2923 pub const fn from_bits(val: u8) -> Calp {
2924 unsafe { core::mem::transmute(val & 0x01) }
2925 }
2926 #[inline(always)]
2927 pub const fn to_bits(self) -> u8 {
2928 unsafe { core::mem::transmute(self) }
2929 }
2930 }
2931 impl From<u8> for Calp {
2932 #[inline(always)]
2933 fn from(val: u8) -> Calp {
2934 Calp::from_bits(val)
2935 }
2936 }
2937 impl From<Calp> for u8 {
2938 #[inline(always)]
2939 fn from(val: Calp) -> u8 {
2940 Calp::to_bits(val)
2941 }
2942 }
2943 #[repr(u8)]
2944 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
2945 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2946 pub enum Calrf {
2947 _RESERVED_0 = 0x0,
2948 #[doc = "Clear interrupt flag by writing 1"]
2949 CLEAR = 0x01,
2950 }
2951 impl Calrf {
2952 #[inline(always)]
2953 pub const fn from_bits(val: u8) -> Calrf {
2954 unsafe { core::mem::transmute(val & 0x01) }
2955 }
2956 #[inline(always)]
2957 pub const fn to_bits(self) -> u8 {
2958 unsafe { core::mem::transmute(self) }
2959 }
2960 }
2961 impl From<u8> for Calrf {
2962 #[inline(always)]
2963 fn from(val: u8) -> Calrf {
2964 Calrf::from_bits(val)
2965 }
2966 }
2967 impl From<Calrf> for u8 {
2968 #[inline(always)]
2969 fn from(val: Calrf) -> u8 {
2970 Calrf::to_bits(val)
2971 }
2972 }
2973 #[repr(u8)]
2974 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
2975 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
2976 pub enum Calw16 {
2977 _RESERVED_0 = 0x0,
2978 #[doc = "When CALW16 is set to ‘1’, the 16-second calibration cycle period is selected.This bit must not be set to ‘1’ if CALW8=1"]
2979 SIXTEEN_SECONDS = 0x01,
2980 }
2981 impl Calw16 {
2982 #[inline(always)]
2983 pub const fn from_bits(val: u8) -> Calw16 {
2984 unsafe { core::mem::transmute(val & 0x01) }
2985 }
2986 #[inline(always)]
2987 pub const fn to_bits(self) -> u8 {
2988 unsafe { core::mem::transmute(self) }
2989 }
2990 }
2991 impl From<u8> for Calw16 {
2992 #[inline(always)]
2993 fn from(val: u8) -> Calw16 {
2994 Calw16::from_bits(val)
2995 }
2996 }
2997 impl From<Calw16> for u8 {
2998 #[inline(always)]
2999 fn from(val: Calw16) -> u8 {
3000 Calw16::to_bits(val)
3001 }
3002 }
3003 #[repr(u8)]
3004 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3005 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3006 pub enum Calw8 {
3007 _RESERVED_0 = 0x0,
3008 #[doc = "When CALW8 is set to ‘1’, the 8-second calibration cycle period is selected"]
3009 EIGHT_SECONDS = 0x01,
3010 }
3011 impl Calw8 {
3012 #[inline(always)]
3013 pub const fn from_bits(val: u8) -> Calw8 {
3014 unsafe { core::mem::transmute(val & 0x01) }
3015 }
3016 #[inline(always)]
3017 pub const fn to_bits(self) -> u8 {
3018 unsafe { core::mem::transmute(self) }
3019 }
3020 }
3021 impl From<u8> for Calw8 {
3022 #[inline(always)]
3023 fn from(val: u8) -> Calw8 {
3024 Calw8::from_bits(val)
3025 }
3026 }
3027 impl From<Calw8> for u8 {
3028 #[inline(always)]
3029 fn from(val: Calw8) -> u8 {
3030 Calw8::to_bits(val)
3031 }
3032 }
3033 #[repr(u8)]
3034 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3035 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3036 pub enum Cosel {
3037 #[doc = "Calibration output is 512 Hz (with default prescaler setting)"]
3038 CAL_FREQ_512HZ = 0x0,
3039 #[doc = "Calibration output is 1 Hz (with default prescaler setting)"]
3040 CAL_FREQ_1HZ = 0x01,
3041 }
3042 impl Cosel {
3043 #[inline(always)]
3044 pub const fn from_bits(val: u8) -> Cosel {
3045 unsafe { core::mem::transmute(val & 0x01) }
3046 }
3047 #[inline(always)]
3048 pub const fn to_bits(self) -> u8 {
3049 unsafe { core::mem::transmute(self) }
3050 }
3051 }
3052 impl From<u8> for Cosel {
3053 #[inline(always)]
3054 fn from(val: u8) -> Cosel {
3055 Cosel::from_bits(val)
3056 }
3057 }
3058 impl From<Cosel> for u8 {
3059 #[inline(always)]
3060 fn from(val: Cosel) -> u8 {
3061 Cosel::to_bits(val)
3062 }
3063 }
3064 #[repr(u8)]
3065 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3066 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3067 pub enum Fmt {
3068 #[doc = "24 hour/day format"]
3069 TWENTY_FOUR_HOUR = 0x0,
3070 #[doc = "AM/PM hour format"]
3071 AM_PM = 0x01,
3072 }
3073 impl Fmt {
3074 #[inline(always)]
3075 pub const fn from_bits(val: u8) -> Fmt {
3076 unsafe { core::mem::transmute(val & 0x01) }
3077 }
3078 #[inline(always)]
3079 pub const fn to_bits(self) -> u8 {
3080 unsafe { core::mem::transmute(self) }
3081 }
3082 }
3083 impl From<u8> for Fmt {
3084 #[inline(always)]
3085 fn from(val: u8) -> Fmt {
3086 Fmt::from_bits(val)
3087 }
3088 }
3089 impl From<Fmt> for u8 {
3090 #[inline(always)]
3091 fn from(val: Fmt) -> u8 {
3092 Fmt::to_bits(val)
3093 }
3094 }
3095 #[repr(u8)]
3096 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3097 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3098 pub enum Itsf {
3099 _RESERVED_0 = 0x0,
3100 #[doc = "This flag is set by hardware when a timestamp on the internal event occurs"]
3101 TIMESTAMP_EVENT = 0x01,
3102 }
3103 impl Itsf {
3104 #[inline(always)]
3105 pub const fn from_bits(val: u8) -> Itsf {
3106 unsafe { core::mem::transmute(val & 0x01) }
3107 }
3108 #[inline(always)]
3109 pub const fn to_bits(self) -> u8 {
3110 unsafe { core::mem::transmute(self) }
3111 }
3112 }
3113 impl From<u8> for Itsf {
3114 #[inline(always)]
3115 fn from(val: u8) -> Itsf {
3116 Itsf::from_bits(val)
3117 }
3118 }
3119 impl From<Itsf> for u8 {
3120 #[inline(always)]
3121 fn from(val: Itsf) -> u8 {
3122 Itsf::to_bits(val)
3123 }
3124 }
3125 #[repr(u8)]
3126 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3127 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3128 pub enum Itsmf {
3129 _RESERVED_0 = 0x0,
3130 #[doc = "This flag is set by hardware when a timestamp on the internal event occurs"]
3131 TIMESTAMP_EVENT = 0x01,
3132 }
3133 impl Itsmf {
3134 #[inline(always)]
3135 pub const fn from_bits(val: u8) -> Itsmf {
3136 unsafe { core::mem::transmute(val & 0x01) }
3137 }
3138 #[inline(always)]
3139 pub const fn to_bits(self) -> u8 {
3140 unsafe { core::mem::transmute(self) }
3141 }
3142 }
3143 impl From<u8> for Itsmf {
3144 #[inline(always)]
3145 fn from(val: u8) -> Itsmf {
3146 Itsmf::from_bits(val)
3147 }
3148 }
3149 impl From<Itsmf> for u8 {
3150 #[inline(always)]
3151 fn from(val: Itsmf) -> u8 {
3152 Itsmf::to_bits(val)
3153 }
3154 }
3155 #[repr(transparent)]
3156 #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
3157 pub struct Key(pub u8);
3158 impl Key {
3159 #[doc = "Activate write protection (any value that is not the keys)"]
3160 pub const ACTIVATE: Self = Self(0x0);
3161 #[doc = "Key 2"]
3162 pub const DEACTIVATE2: Self = Self(0x53);
3163 #[doc = "Key 1"]
3164 pub const DEACTIVATE1: Self = Self(0xca);
3165 }
3166 impl Key {
3167 pub const fn from_bits(val: u8) -> Key {
3168 Self(val & 0xff)
3169 }
3170 pub const fn to_bits(self) -> u8 {
3171 self.0
3172 }
3173 }
3174 impl core::fmt::Debug for Key {
3175 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
3176 match self.0 {
3177 0x0 => f.write_str("ACTIVATE"),
3178 0x53 => f.write_str("DEACTIVATE2"),
3179 0xca => f.write_str("DEACTIVATE1"),
3180 other => core::write!(f, "0x{:02X}", other),
3181 }
3182 }
3183 }
3184 #[cfg(feature = "defmt")]
3185 impl defmt::Format for Key {
3186 fn format(&self, f: defmt::Formatter) {
3187 match self.0 {
3188 0x0 => defmt::write!(f, "ACTIVATE"),
3189 0x53 => defmt::write!(f, "DEACTIVATE2"),
3190 0xca => defmt::write!(f, "DEACTIVATE1"),
3191 other => defmt::write!(f, "0x{:02X}", other),
3192 }
3193 }
3194 }
3195 impl From<u8> for Key {
3196 #[inline(always)]
3197 fn from(val: u8) -> Key {
3198 Key::from_bits(val)
3199 }
3200 }
3201 impl From<Key> for u8 {
3202 #[inline(always)]
3203 fn from(val: Key) -> u8 {
3204 Key::to_bits(val)
3205 }
3206 }
3207 #[repr(u8)]
3208 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3209 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3210 pub enum Lpcal {
3211 #[doc = "Calibration window is 220 RTCCLK, which is a high-consumption mode. This mode should be set only when less than 32s calibration window is required"]
3212 RTCCLK = 0x0,
3213 #[doc = "Calibration window is 220 ck_apre, which is the required configuration for ultra-low consumption mode"]
3214 CK_APRE = 0x01,
3215 }
3216 impl Lpcal {
3217 #[inline(always)]
3218 pub const fn from_bits(val: u8) -> Lpcal {
3219 unsafe { core::mem::transmute(val & 0x01) }
3220 }
3221 #[inline(always)]
3222 pub const fn to_bits(self) -> u8 {
3223 unsafe { core::mem::transmute(self) }
3224 }
3225 }
3226 impl From<u8> for Lpcal {
3227 #[inline(always)]
3228 fn from(val: u8) -> Lpcal {
3229 Lpcal::from_bits(val)
3230 }
3231 }
3232 impl From<Lpcal> for u8 {
3233 #[inline(always)]
3234 fn from(val: Lpcal) -> u8 {
3235 Lpcal::to_bits(val)
3236 }
3237 }
3238 #[repr(u8)]
3239 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3240 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3241 pub enum Osel {
3242 #[doc = "Output disabled"]
3243 DISABLED = 0x0,
3244 #[doc = "Alarm A output enabled"]
3245 ALARM_A = 0x01,
3246 #[doc = "Alarm B output enabled"]
3247 ALARM_B = 0x02,
3248 #[doc = "Wakeup output enabled"]
3249 WAKEUP = 0x03,
3250 }
3251 impl Osel {
3252 #[inline(always)]
3253 pub const fn from_bits(val: u8) -> Osel {
3254 unsafe { core::mem::transmute(val & 0x03) }
3255 }
3256 #[inline(always)]
3257 pub const fn to_bits(self) -> u8 {
3258 unsafe { core::mem::transmute(self) }
3259 }
3260 }
3261 impl From<u8> for Osel {
3262 #[inline(always)]
3263 fn from(val: u8) -> Osel {
3264 Osel::from_bits(val)
3265 }
3266 }
3267 impl From<Osel> for u8 {
3268 #[inline(always)]
3269 fn from(val: Osel) -> u8 {
3270 Osel::to_bits(val)
3271 }
3272 }
3273 #[repr(u8)]
3274 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3275 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3276 pub enum Pol {
3277 #[doc = "The pin is high when ALRAF/ALRBF/WUTF is asserted (depending on OSEL\\[1:0\\])"]
3278 HIGH = 0x0,
3279 #[doc = "The pin is low when ALRAF/ALRBF/WUTF is asserted (depending on OSEL\\[1:0\\])"]
3280 LOW = 0x01,
3281 }
3282 impl Pol {
3283 #[inline(always)]
3284 pub const fn from_bits(val: u8) -> Pol {
3285 unsafe { core::mem::transmute(val & 0x01) }
3286 }
3287 #[inline(always)]
3288 pub const fn to_bits(self) -> u8 {
3289 unsafe { core::mem::transmute(self) }
3290 }
3291 }
3292 impl From<u8> for Pol {
3293 #[inline(always)]
3294 fn from(val: u8) -> Pol {
3295 Pol::from_bits(val)
3296 }
3297 }
3298 impl From<Pol> for u8 {
3299 #[inline(always)]
3300 fn from(val: Pol) -> u8 {
3301 Pol::to_bits(val)
3302 }
3303 }
3304 #[repr(u8)]
3305 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3306 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3307 pub enum Recalpf {
3308 _RESERVED_0 = 0x0,
3309 #[doc = "The RECALPF status flag is automatically set to 1 when software writes to the RTC_CALR register, indicating that the RTC_CALR register is blocked. When the new calibration settings are taken into account, this bit returns to 0"]
3310 PENDING = 0x01,
3311 }
3312 impl Recalpf {
3313 #[inline(always)]
3314 pub const fn from_bits(val: u8) -> Recalpf {
3315 unsafe { core::mem::transmute(val & 0x01) }
3316 }
3317 #[inline(always)]
3318 pub const fn to_bits(self) -> u8 {
3319 unsafe { core::mem::transmute(self) }
3320 }
3321 }
3322 impl From<u8> for Recalpf {
3323 #[inline(always)]
3324 fn from(val: u8) -> Recalpf {
3325 Recalpf::from_bits(val)
3326 }
3327 }
3328 impl From<Recalpf> for u8 {
3329 #[inline(always)]
3330 fn from(val: Recalpf) -> u8 {
3331 Recalpf::to_bits(val)
3332 }
3333 }
3334 #[repr(u8)]
3335 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3336 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3337 pub enum Ssruf {
3338 _RESERVED_0 = 0x0,
3339 #[doc = "This flag is set by hardware when the SSR rolls under 0. SSRUF is not set when SSCLR=1"]
3340 UNDERFLOW = 0x01,
3341 }
3342 impl Ssruf {
3343 #[inline(always)]
3344 pub const fn from_bits(val: u8) -> Ssruf {
3345 unsafe { core::mem::transmute(val & 0x01) }
3346 }
3347 #[inline(always)]
3348 pub const fn to_bits(self) -> u8 {
3349 unsafe { core::mem::transmute(self) }
3350 }
3351 }
3352 impl From<u8> for Ssruf {
3353 #[inline(always)]
3354 fn from(val: u8) -> Ssruf {
3355 Ssruf::from_bits(val)
3356 }
3357 }
3358 impl From<Ssruf> for u8 {
3359 #[inline(always)]
3360 fn from(val: Ssruf) -> u8 {
3361 Ssruf::to_bits(val)
3362 }
3363 }
3364 #[repr(u8)]
3365 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3366 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3367 pub enum Ssrumf {
3368 _RESERVED_0 = 0x0,
3369 #[doc = "This flag is set by hardware when the SSR rolls under 0. SSRUF is not set when SSCLR=1"]
3370 UNDERFLOW = 0x01,
3371 }
3372 impl Ssrumf {
3373 #[inline(always)]
3374 pub const fn from_bits(val: u8) -> Ssrumf {
3375 unsafe { core::mem::transmute(val & 0x01) }
3376 }
3377 #[inline(always)]
3378 pub const fn to_bits(self) -> u8 {
3379 unsafe { core::mem::transmute(self) }
3380 }
3381 }
3382 impl From<u8> for Ssrumf {
3383 #[inline(always)]
3384 fn from(val: u8) -> Ssrumf {
3385 Ssrumf::from_bits(val)
3386 }
3387 }
3388 impl From<Ssrumf> for u8 {
3389 #[inline(always)]
3390 fn from(val: Ssrumf) -> u8 {
3391 Ssrumf::to_bits(val)
3392 }
3393 }
3394 #[repr(u8)]
3395 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3396 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3397 pub enum TampalrmType {
3398 #[doc = "TAMPALRM is push-pull output"]
3399 PUSH_PULL = 0x0,
3400 #[doc = "TAMPALRM is open-drain output"]
3401 OPEN_DRAIN = 0x01,
3402 }
3403 impl TampalrmType {
3404 #[inline(always)]
3405 pub const fn from_bits(val: u8) -> TampalrmType {
3406 unsafe { core::mem::transmute(val & 0x01) }
3407 }
3408 #[inline(always)]
3409 pub const fn to_bits(self) -> u8 {
3410 unsafe { core::mem::transmute(self) }
3411 }
3412 }
3413 impl From<u8> for TampalrmType {
3414 #[inline(always)]
3415 fn from(val: u8) -> TampalrmType {
3416 TampalrmType::from_bits(val)
3417 }
3418 }
3419 impl From<TampalrmType> for u8 {
3420 #[inline(always)]
3421 fn from(val: TampalrmType) -> u8 {
3422 TampalrmType::to_bits(val)
3423 }
3424 }
3425 #[repr(u8)]
3426 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3427 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3428 pub enum Tsedge {
3429 #[doc = "RTC_TS input rising edge generates a time-stamp event"]
3430 RISING_EDGE = 0x0,
3431 #[doc = "RTC_TS input falling edge generates a time-stamp event"]
3432 FALLING_EDGE = 0x01,
3433 }
3434 impl Tsedge {
3435 #[inline(always)]
3436 pub const fn from_bits(val: u8) -> Tsedge {
3437 unsafe { core::mem::transmute(val & 0x01) }
3438 }
3439 #[inline(always)]
3440 pub const fn to_bits(self) -> u8 {
3441 unsafe { core::mem::transmute(self) }
3442 }
3443 }
3444 impl From<u8> for Tsedge {
3445 #[inline(always)]
3446 fn from(val: u8) -> Tsedge {
3447 Tsedge::from_bits(val)
3448 }
3449 }
3450 impl From<Tsedge> for u8 {
3451 #[inline(always)]
3452 fn from(val: Tsedge) -> u8 {
3453 Tsedge::to_bits(val)
3454 }
3455 }
3456 #[repr(u8)]
3457 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3458 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3459 pub enum Tsf {
3460 _RESERVED_0 = 0x0,
3461 #[doc = "This flag is set by hardware when a time-stamp event occurs"]
3462 TIMESTAMP_EVENT = 0x01,
3463 }
3464 impl Tsf {
3465 #[inline(always)]
3466 pub const fn from_bits(val: u8) -> Tsf {
3467 unsafe { core::mem::transmute(val & 0x01) }
3468 }
3469 #[inline(always)]
3470 pub const fn to_bits(self) -> u8 {
3471 unsafe { core::mem::transmute(self) }
3472 }
3473 }
3474 impl From<u8> for Tsf {
3475 #[inline(always)]
3476 fn from(val: u8) -> Tsf {
3477 Tsf::from_bits(val)
3478 }
3479 }
3480 impl From<Tsf> for u8 {
3481 #[inline(always)]
3482 fn from(val: Tsf) -> u8 {
3483 Tsf::to_bits(val)
3484 }
3485 }
3486 #[repr(u8)]
3487 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3488 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3489 pub enum Tsmf {
3490 _RESERVED_0 = 0x0,
3491 #[doc = "This flag is set by hardware when a time-stamp event occurs"]
3492 TIMESTAMP_EVENT = 0x01,
3493 }
3494 impl Tsmf {
3495 #[inline(always)]
3496 pub const fn from_bits(val: u8) -> Tsmf {
3497 unsafe { core::mem::transmute(val & 0x01) }
3498 }
3499 #[inline(always)]
3500 pub const fn to_bits(self) -> u8 {
3501 unsafe { core::mem::transmute(self) }
3502 }
3503 }
3504 impl From<u8> for Tsmf {
3505 #[inline(always)]
3506 fn from(val: u8) -> Tsmf {
3507 Tsmf::from_bits(val)
3508 }
3509 }
3510 impl From<Tsmf> for u8 {
3511 #[inline(always)]
3512 fn from(val: Tsmf) -> u8 {
3513 Tsmf::to_bits(val)
3514 }
3515 }
3516 #[repr(u8)]
3517 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3518 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3519 pub enum Tsovf {
3520 _RESERVED_0 = 0x0,
3521 #[doc = "This flag is set by hardware when a time-stamp event occurs while TSF is already set"]
3522 OVERFLOW = 0x01,
3523 }
3524 impl Tsovf {
3525 #[inline(always)]
3526 pub const fn from_bits(val: u8) -> Tsovf {
3527 unsafe { core::mem::transmute(val & 0x01) }
3528 }
3529 #[inline(always)]
3530 pub const fn to_bits(self) -> u8 {
3531 unsafe { core::mem::transmute(self) }
3532 }
3533 }
3534 impl From<u8> for Tsovf {
3535 #[inline(always)]
3536 fn from(val: u8) -> Tsovf {
3537 Tsovf::from_bits(val)
3538 }
3539 }
3540 impl From<Tsovf> for u8 {
3541 #[inline(always)]
3542 fn from(val: Tsovf) -> u8 {
3543 Tsovf::to_bits(val)
3544 }
3545 }
3546 #[repr(u8)]
3547 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3548 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3549 pub enum Tsovmf {
3550 _RESERVED_0 = 0x0,
3551 #[doc = "This flag is set by hardware when a time-stamp event occurs while TSF is already set"]
3552 OVERFLOW = 0x01,
3553 }
3554 impl Tsovmf {
3555 #[inline(always)]
3556 pub const fn from_bits(val: u8) -> Tsovmf {
3557 unsafe { core::mem::transmute(val & 0x01) }
3558 }
3559 #[inline(always)]
3560 pub const fn to_bits(self) -> u8 {
3561 unsafe { core::mem::transmute(self) }
3562 }
3563 }
3564 impl From<u8> for Tsovmf {
3565 #[inline(always)]
3566 fn from(val: u8) -> Tsovmf {
3567 Tsovmf::from_bits(val)
3568 }
3569 }
3570 impl From<Tsovmf> for u8 {
3571 #[inline(always)]
3572 fn from(val: Tsovmf) -> u8 {
3573 Tsovmf::to_bits(val)
3574 }
3575 }
3576 #[repr(u8)]
3577 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3578 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3579 pub enum Wucksel {
3580 #[doc = "RTC/16 clock is selected"]
3581 DIV16 = 0x0,
3582 #[doc = "RTC/8 clock is selected"]
3583 DIV8 = 0x01,
3584 #[doc = "RTC/4 clock is selected"]
3585 DIV4 = 0x02,
3586 #[doc = "RTC/2 clock is selected"]
3587 DIV2 = 0x03,
3588 #[doc = "ck_spre (usually 1 Hz) clock is selected"]
3589 CLOCK_SPARE = 0x04,
3590 _RESERVED_5 = 0x05,
3591 #[doc = "ck_spre (usually 1 Hz) clock is selected and 2^16 is added to the WUT counter value"]
3592 CLOCK_SPARE_WITH_OFFSET = 0x06,
3593 _RESERVED_7 = 0x07,
3594 }
3595 impl Wucksel {
3596 #[inline(always)]
3597 pub const fn from_bits(val: u8) -> Wucksel {
3598 unsafe { core::mem::transmute(val & 0x07) }
3599 }
3600 #[inline(always)]
3601 pub const fn to_bits(self) -> u8 {
3602 unsafe { core::mem::transmute(self) }
3603 }
3604 }
3605 impl From<u8> for Wucksel {
3606 #[inline(always)]
3607 fn from(val: u8) -> Wucksel {
3608 Wucksel::from_bits(val)
3609 }
3610 }
3611 impl From<Wucksel> for u8 {
3612 #[inline(always)]
3613 fn from(val: Wucksel) -> u8 {
3614 Wucksel::to_bits(val)
3615 }
3616 }
3617 #[repr(u8)]
3618 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3619 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3620 pub enum Wutf {
3621 _RESERVED_0 = 0x0,
3622 #[doc = "This flag is set by hardware when the wakeup auto-reload counter reaches 0"]
3623 ZERO = 0x01,
3624 }
3625 impl Wutf {
3626 #[inline(always)]
3627 pub const fn from_bits(val: u8) -> Wutf {
3628 unsafe { core::mem::transmute(val & 0x01) }
3629 }
3630 #[inline(always)]
3631 pub const fn to_bits(self) -> u8 {
3632 unsafe { core::mem::transmute(self) }
3633 }
3634 }
3635 impl From<u8> for Wutf {
3636 #[inline(always)]
3637 fn from(val: u8) -> Wutf {
3638 Wutf::from_bits(val)
3639 }
3640 }
3641 impl From<Wutf> for u8 {
3642 #[inline(always)]
3643 fn from(val: Wutf) -> u8 {
3644 Wutf::to_bits(val)
3645 }
3646 }
3647 #[repr(u8)]
3648 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
3649 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
3650 pub enum Wutmf {
3651 _RESERVED_0 = 0x0,
3652 #[doc = "This flag is set by hardware when the wakeup auto-reload counter reaches 0"]
3653 ZERO = 0x01,
3654 }
3655 impl Wutmf {
3656 #[inline(always)]
3657 pub const fn from_bits(val: u8) -> Wutmf {
3658 unsafe { core::mem::transmute(val & 0x01) }
3659 }
3660 #[inline(always)]
3661 pub const fn to_bits(self) -> u8 {
3662 unsafe { core::mem::transmute(self) }
3663 }
3664 }
3665 impl From<u8> for Wutmf {
3666 #[inline(always)]
3667 fn from(val: u8) -> Wutmf {
3668 Wutmf::from_bits(val)
3669 }
3670 }
3671 impl From<Wutmf> for u8 {
3672 #[inline(always)]
3673 fn from(val: Wutmf) -> u8 {
3674 Wutmf::to_bits(val)
3675 }
3676 }
3677}
3678