1#[doc = "Register `RTC_MR` reader"]
2pub struct R(crate::R<RTC_MR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<RTC_MR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<RTC_MR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<RTC_MR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `RTC_MR` writer"]
17pub struct W(crate::W<RTC_MR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<RTC_MR_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<RTC_MR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<RTC_MR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `HRMOD` reader - 12-/24-hour Mode"]
38pub struct HRMOD_R(crate::FieldReader<bool, bool>);
39impl HRMOD_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: bool) -> Self {
42 HRMOD_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for HRMOD_R {
46 type Target = crate::FieldReader<bool, bool>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `HRMOD` writer - 12-/24-hour Mode"]
53pub struct HRMOD_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> HRMOD_W<'a> {
57 #[doc = r"Sets the field bit"]
58 #[inline(always)]
59 pub fn set_bit(self) -> &'a mut W {
60 self.bit(true)
61 }
62 #[doc = r"Clears the field bit"]
63 #[inline(always)]
64 pub fn clear_bit(self) -> &'a mut W {
65 self.bit(false)
66 }
67 #[doc = r"Writes raw bits to the field"]
68 #[inline(always)]
69 pub fn bit(self, value: bool) -> &'a mut W {
70 self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
71 self.w
72 }
73}
74#[doc = "Field `PERSIAN` reader - PERSIAN Calendar"]
75pub struct PERSIAN_R(crate::FieldReader<bool, bool>);
76impl PERSIAN_R {
77 #[inline(always)]
78 pub(crate) fn new(bits: bool) -> Self {
79 PERSIAN_R(crate::FieldReader::new(bits))
80 }
81}
82impl core::ops::Deref for PERSIAN_R {
83 type Target = crate::FieldReader<bool, bool>;
84 #[inline(always)]
85 fn deref(&self) -> &Self::Target {
86 &self.0
87 }
88}
89#[doc = "Field `PERSIAN` writer - PERSIAN Calendar"]
90pub struct PERSIAN_W<'a> {
91 w: &'a mut W,
92}
93impl<'a> PERSIAN_W<'a> {
94 #[doc = r"Sets the field bit"]
95 #[inline(always)]
96 pub fn set_bit(self) -> &'a mut W {
97 self.bit(true)
98 }
99 #[doc = r"Clears the field bit"]
100 #[inline(always)]
101 pub fn clear_bit(self) -> &'a mut W {
102 self.bit(false)
103 }
104 #[doc = r"Writes raw bits to the field"]
105 #[inline(always)]
106 pub fn bit(self, value: bool) -> &'a mut W {
107 self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
108 self.w
109 }
110}
111#[doc = "Field `NEGPPM` reader - NEGative PPM Correction"]
112pub struct NEGPPM_R(crate::FieldReader<bool, bool>);
113impl NEGPPM_R {
114 #[inline(always)]
115 pub(crate) fn new(bits: bool) -> Self {
116 NEGPPM_R(crate::FieldReader::new(bits))
117 }
118}
119impl core::ops::Deref for NEGPPM_R {
120 type Target = crate::FieldReader<bool, bool>;
121 #[inline(always)]
122 fn deref(&self) -> &Self::Target {
123 &self.0
124 }
125}
126#[doc = "Field `NEGPPM` writer - NEGative PPM Correction"]
127pub struct NEGPPM_W<'a> {
128 w: &'a mut W,
129}
130impl<'a> NEGPPM_W<'a> {
131 #[doc = r"Sets the field bit"]
132 #[inline(always)]
133 pub fn set_bit(self) -> &'a mut W {
134 self.bit(true)
135 }
136 #[doc = r"Clears the field bit"]
137 #[inline(always)]
138 pub fn clear_bit(self) -> &'a mut W {
139 self.bit(false)
140 }
141 #[doc = r"Writes raw bits to the field"]
142 #[inline(always)]
143 pub fn bit(self, value: bool) -> &'a mut W {
144 self.w.bits = (self.w.bits & !(0x01 << 4)) | ((value as u32 & 0x01) << 4);
145 self.w
146 }
147}
148#[doc = "Field `CORRECTION` reader - Slow Clock Correction"]
149pub struct CORRECTION_R(crate::FieldReader<u8, u8>);
150impl CORRECTION_R {
151 #[inline(always)]
152 pub(crate) fn new(bits: u8) -> Self {
153 CORRECTION_R(crate::FieldReader::new(bits))
154 }
155}
156impl core::ops::Deref for CORRECTION_R {
157 type Target = crate::FieldReader<u8, u8>;
158 #[inline(always)]
159 fn deref(&self) -> &Self::Target {
160 &self.0
161 }
162}
163#[doc = "Field `CORRECTION` writer - Slow Clock Correction"]
164pub struct CORRECTION_W<'a> {
165 w: &'a mut W,
166}
167impl<'a> CORRECTION_W<'a> {
168 #[doc = r"Writes raw bits to the field"]
169 #[inline(always)]
170 pub unsafe fn bits(self, value: u8) -> &'a mut W {
171 self.w.bits = (self.w.bits & !(0x7f << 8)) | ((value as u32 & 0x7f) << 8);
172 self.w
173 }
174}
175#[doc = "Field `HIGHPPM` reader - HIGH PPM Correction"]
176pub struct HIGHPPM_R(crate::FieldReader<bool, bool>);
177impl HIGHPPM_R {
178 #[inline(always)]
179 pub(crate) fn new(bits: bool) -> Self {
180 HIGHPPM_R(crate::FieldReader::new(bits))
181 }
182}
183impl core::ops::Deref for HIGHPPM_R {
184 type Target = crate::FieldReader<bool, bool>;
185 #[inline(always)]
186 fn deref(&self) -> &Self::Target {
187 &self.0
188 }
189}
190#[doc = "Field `HIGHPPM` writer - HIGH PPM Correction"]
191pub struct HIGHPPM_W<'a> {
192 w: &'a mut W,
193}
194impl<'a> HIGHPPM_W<'a> {
195 #[doc = r"Sets the field bit"]
196 #[inline(always)]
197 pub fn set_bit(self) -> &'a mut W {
198 self.bit(true)
199 }
200 #[doc = r"Clears the field bit"]
201 #[inline(always)]
202 pub fn clear_bit(self) -> &'a mut W {
203 self.bit(false)
204 }
205 #[doc = r"Writes raw bits to the field"]
206 #[inline(always)]
207 pub fn bit(self, value: bool) -> &'a mut W {
208 self.w.bits = (self.w.bits & !(0x01 << 15)) | ((value as u32 & 0x01) << 15);
209 self.w
210 }
211}
212#[doc = "RTCOUT0 OutputSource Selection\n\nValue on reset: 0"]
213#[derive(Clone, Copy, Debug, PartialEq)]
214#[repr(u8)]
215pub enum OUT0_A {
216 #[doc = "0: No waveform, stuck at '0'"]
217 NO_WAVE = 0,
218 #[doc = "1: 1 Hz square wave"]
219 FREQ1HZ = 1,
220 #[doc = "2: 32 Hz square wave"]
221 FREQ32HZ = 2,
222 #[doc = "3: 64 Hz square wave"]
223 FREQ64HZ = 3,
224 #[doc = "4: 512 Hz square wave"]
225 FREQ512HZ = 4,
226 #[doc = "5: Output toggles when alarm flag rises"]
227 ALARM_TOGGLE = 5,
228 #[doc = "6: Output is a copy of the alarm flag"]
229 ALARM_FLAG = 6,
230 #[doc = "7: Duty cycle programmable pulse"]
231 PROG_PULSE = 7,
232}
233impl From<OUT0_A> for u8 {
234 #[inline(always)]
235 fn from(variant: OUT0_A) -> Self {
236 variant as _
237 }
238}
239#[doc = "Field `OUT0` reader - RTCOUT0 OutputSource Selection"]
240pub struct OUT0_R(crate::FieldReader<u8, OUT0_A>);
241impl OUT0_R {
242 #[inline(always)]
243 pub(crate) fn new(bits: u8) -> Self {
244 OUT0_R(crate::FieldReader::new(bits))
245 }
246 #[doc = r"Get enumerated values variant"]
247 #[inline(always)]
248 pub fn variant(&self) -> OUT0_A {
249 match self.bits {
250 0 => OUT0_A::NO_WAVE,
251 1 => OUT0_A::FREQ1HZ,
252 2 => OUT0_A::FREQ32HZ,
253 3 => OUT0_A::FREQ64HZ,
254 4 => OUT0_A::FREQ512HZ,
255 5 => OUT0_A::ALARM_TOGGLE,
256 6 => OUT0_A::ALARM_FLAG,
257 7 => OUT0_A::PROG_PULSE,
258 _ => unreachable!(),
259 }
260 }
261 #[doc = "Checks if the value of the field is `NO_WAVE`"]
262 #[inline(always)]
263 pub fn is_no_wave(&self) -> bool {
264 **self == OUT0_A::NO_WAVE
265 }
266 #[doc = "Checks if the value of the field is `FREQ1HZ`"]
267 #[inline(always)]
268 pub fn is_freq1hz(&self) -> bool {
269 **self == OUT0_A::FREQ1HZ
270 }
271 #[doc = "Checks if the value of the field is `FREQ32HZ`"]
272 #[inline(always)]
273 pub fn is_freq32hz(&self) -> bool {
274 **self == OUT0_A::FREQ32HZ
275 }
276 #[doc = "Checks if the value of the field is `FREQ64HZ`"]
277 #[inline(always)]
278 pub fn is_freq64hz(&self) -> bool {
279 **self == OUT0_A::FREQ64HZ
280 }
281 #[doc = "Checks if the value of the field is `FREQ512HZ`"]
282 #[inline(always)]
283 pub fn is_freq512hz(&self) -> bool {
284 **self == OUT0_A::FREQ512HZ
285 }
286 #[doc = "Checks if the value of the field is `ALARM_TOGGLE`"]
287 #[inline(always)]
288 pub fn is_alarm_toggle(&self) -> bool {
289 **self == OUT0_A::ALARM_TOGGLE
290 }
291 #[doc = "Checks if the value of the field is `ALARM_FLAG`"]
292 #[inline(always)]
293 pub fn is_alarm_flag(&self) -> bool {
294 **self == OUT0_A::ALARM_FLAG
295 }
296 #[doc = "Checks if the value of the field is `PROG_PULSE`"]
297 #[inline(always)]
298 pub fn is_prog_pulse(&self) -> bool {
299 **self == OUT0_A::PROG_PULSE
300 }
301}
302impl core::ops::Deref for OUT0_R {
303 type Target = crate::FieldReader<u8, OUT0_A>;
304 #[inline(always)]
305 fn deref(&self) -> &Self::Target {
306 &self.0
307 }
308}
309#[doc = "Field `OUT0` writer - RTCOUT0 OutputSource Selection"]
310pub struct OUT0_W<'a> {
311 w: &'a mut W,
312}
313impl<'a> OUT0_W<'a> {
314 #[doc = r"Writes `variant` to the field"]
315 #[inline(always)]
316 pub fn variant(self, variant: OUT0_A) -> &'a mut W {
317 self.bits(variant.into())
318 }
319 #[doc = "No waveform, stuck at '0'"]
320 #[inline(always)]
321 pub fn no_wave(self) -> &'a mut W {
322 self.variant(OUT0_A::NO_WAVE)
323 }
324 #[doc = "1 Hz square wave"]
325 #[inline(always)]
326 pub fn freq1hz(self) -> &'a mut W {
327 self.variant(OUT0_A::FREQ1HZ)
328 }
329 #[doc = "32 Hz square wave"]
330 #[inline(always)]
331 pub fn freq32hz(self) -> &'a mut W {
332 self.variant(OUT0_A::FREQ32HZ)
333 }
334 #[doc = "64 Hz square wave"]
335 #[inline(always)]
336 pub fn freq64hz(self) -> &'a mut W {
337 self.variant(OUT0_A::FREQ64HZ)
338 }
339 #[doc = "512 Hz square wave"]
340 #[inline(always)]
341 pub fn freq512hz(self) -> &'a mut W {
342 self.variant(OUT0_A::FREQ512HZ)
343 }
344 #[doc = "Output toggles when alarm flag rises"]
345 #[inline(always)]
346 pub fn alarm_toggle(self) -> &'a mut W {
347 self.variant(OUT0_A::ALARM_TOGGLE)
348 }
349 #[doc = "Output is a copy of the alarm flag"]
350 #[inline(always)]
351 pub fn alarm_flag(self) -> &'a mut W {
352 self.variant(OUT0_A::ALARM_FLAG)
353 }
354 #[doc = "Duty cycle programmable pulse"]
355 #[inline(always)]
356 pub fn prog_pulse(self) -> &'a mut W {
357 self.variant(OUT0_A::PROG_PULSE)
358 }
359 #[doc = r"Writes raw bits to the field"]
360 #[inline(always)]
361 pub fn bits(self, value: u8) -> &'a mut W {
362 self.w.bits = (self.w.bits & !(0x07 << 16)) | ((value as u32 & 0x07) << 16);
363 self.w
364 }
365}
366#[doc = "RTCOUT1 Output Source Selection\n\nValue on reset: 0"]
367#[derive(Clone, Copy, Debug, PartialEq)]
368#[repr(u8)]
369pub enum OUT1_A {
370 #[doc = "0: No waveform, stuck at '0'"]
371 NO_WAVE = 0,
372 #[doc = "1: 1 Hz square wave"]
373 FREQ1HZ = 1,
374 #[doc = "2: 32 Hz square wave"]
375 FREQ32HZ = 2,
376 #[doc = "3: 64 Hz square wave"]
377 FREQ64HZ = 3,
378 #[doc = "4: 512 Hz square wave"]
379 FREQ512HZ = 4,
380 #[doc = "5: Output toggles when alarm flag rises"]
381 ALARM_TOGGLE = 5,
382 #[doc = "6: Output is a copy of the alarm flag"]
383 ALARM_FLAG = 6,
384 #[doc = "7: Duty cycle programmable pulse"]
385 PROG_PULSE = 7,
386}
387impl From<OUT1_A> for u8 {
388 #[inline(always)]
389 fn from(variant: OUT1_A) -> Self {
390 variant as _
391 }
392}
393#[doc = "Field `OUT1` reader - RTCOUT1 Output Source Selection"]
394pub struct OUT1_R(crate::FieldReader<u8, OUT1_A>);
395impl OUT1_R {
396 #[inline(always)]
397 pub(crate) fn new(bits: u8) -> Self {
398 OUT1_R(crate::FieldReader::new(bits))
399 }
400 #[doc = r"Get enumerated values variant"]
401 #[inline(always)]
402 pub fn variant(&self) -> OUT1_A {
403 match self.bits {
404 0 => OUT1_A::NO_WAVE,
405 1 => OUT1_A::FREQ1HZ,
406 2 => OUT1_A::FREQ32HZ,
407 3 => OUT1_A::FREQ64HZ,
408 4 => OUT1_A::FREQ512HZ,
409 5 => OUT1_A::ALARM_TOGGLE,
410 6 => OUT1_A::ALARM_FLAG,
411 7 => OUT1_A::PROG_PULSE,
412 _ => unreachable!(),
413 }
414 }
415 #[doc = "Checks if the value of the field is `NO_WAVE`"]
416 #[inline(always)]
417 pub fn is_no_wave(&self) -> bool {
418 **self == OUT1_A::NO_WAVE
419 }
420 #[doc = "Checks if the value of the field is `FREQ1HZ`"]
421 #[inline(always)]
422 pub fn is_freq1hz(&self) -> bool {
423 **self == OUT1_A::FREQ1HZ
424 }
425 #[doc = "Checks if the value of the field is `FREQ32HZ`"]
426 #[inline(always)]
427 pub fn is_freq32hz(&self) -> bool {
428 **self == OUT1_A::FREQ32HZ
429 }
430 #[doc = "Checks if the value of the field is `FREQ64HZ`"]
431 #[inline(always)]
432 pub fn is_freq64hz(&self) -> bool {
433 **self == OUT1_A::FREQ64HZ
434 }
435 #[doc = "Checks if the value of the field is `FREQ512HZ`"]
436 #[inline(always)]
437 pub fn is_freq512hz(&self) -> bool {
438 **self == OUT1_A::FREQ512HZ
439 }
440 #[doc = "Checks if the value of the field is `ALARM_TOGGLE`"]
441 #[inline(always)]
442 pub fn is_alarm_toggle(&self) -> bool {
443 **self == OUT1_A::ALARM_TOGGLE
444 }
445 #[doc = "Checks if the value of the field is `ALARM_FLAG`"]
446 #[inline(always)]
447 pub fn is_alarm_flag(&self) -> bool {
448 **self == OUT1_A::ALARM_FLAG
449 }
450 #[doc = "Checks if the value of the field is `PROG_PULSE`"]
451 #[inline(always)]
452 pub fn is_prog_pulse(&self) -> bool {
453 **self == OUT1_A::PROG_PULSE
454 }
455}
456impl core::ops::Deref for OUT1_R {
457 type Target = crate::FieldReader<u8, OUT1_A>;
458 #[inline(always)]
459 fn deref(&self) -> &Self::Target {
460 &self.0
461 }
462}
463#[doc = "Field `OUT1` writer - RTCOUT1 Output Source Selection"]
464pub struct OUT1_W<'a> {
465 w: &'a mut W,
466}
467impl<'a> OUT1_W<'a> {
468 #[doc = r"Writes `variant` to the field"]
469 #[inline(always)]
470 pub fn variant(self, variant: OUT1_A) -> &'a mut W {
471 self.bits(variant.into())
472 }
473 #[doc = "No waveform, stuck at '0'"]
474 #[inline(always)]
475 pub fn no_wave(self) -> &'a mut W {
476 self.variant(OUT1_A::NO_WAVE)
477 }
478 #[doc = "1 Hz square wave"]
479 #[inline(always)]
480 pub fn freq1hz(self) -> &'a mut W {
481 self.variant(OUT1_A::FREQ1HZ)
482 }
483 #[doc = "32 Hz square wave"]
484 #[inline(always)]
485 pub fn freq32hz(self) -> &'a mut W {
486 self.variant(OUT1_A::FREQ32HZ)
487 }
488 #[doc = "64 Hz square wave"]
489 #[inline(always)]
490 pub fn freq64hz(self) -> &'a mut W {
491 self.variant(OUT1_A::FREQ64HZ)
492 }
493 #[doc = "512 Hz square wave"]
494 #[inline(always)]
495 pub fn freq512hz(self) -> &'a mut W {
496 self.variant(OUT1_A::FREQ512HZ)
497 }
498 #[doc = "Output toggles when alarm flag rises"]
499 #[inline(always)]
500 pub fn alarm_toggle(self) -> &'a mut W {
501 self.variant(OUT1_A::ALARM_TOGGLE)
502 }
503 #[doc = "Output is a copy of the alarm flag"]
504 #[inline(always)]
505 pub fn alarm_flag(self) -> &'a mut W {
506 self.variant(OUT1_A::ALARM_FLAG)
507 }
508 #[doc = "Duty cycle programmable pulse"]
509 #[inline(always)]
510 pub fn prog_pulse(self) -> &'a mut W {
511 self.variant(OUT1_A::PROG_PULSE)
512 }
513 #[doc = r"Writes raw bits to the field"]
514 #[inline(always)]
515 pub fn bits(self, value: u8) -> &'a mut W {
516 self.w.bits = (self.w.bits & !(0x07 << 20)) | ((value as u32 & 0x07) << 20);
517 self.w
518 }
519}
520#[doc = "High Duration of the Output Pulse\n\nValue on reset: 0"]
521#[derive(Clone, Copy, Debug, PartialEq)]
522#[repr(u8)]
523pub enum THIGH_A {
524 #[doc = "0: 31.2 ms"]
525 H_31MS = 0,
526 #[doc = "1: 15.6 ms"]
527 H_16MS = 1,
528 #[doc = "2: 3.91 ms"]
529 H_4MS = 2,
530 #[doc = "3: 976 us"]
531 H_976US = 3,
532 #[doc = "4: 488 us"]
533 H_488US = 4,
534 #[doc = "5: 122 us"]
535 H_122US = 5,
536 #[doc = "6: 30.5 us"]
537 H_30US = 6,
538 #[doc = "7: 15.2 us"]
539 H_15US = 7,
540}
541impl From<THIGH_A> for u8 {
542 #[inline(always)]
543 fn from(variant: THIGH_A) -> Self {
544 variant as _
545 }
546}
547#[doc = "Field `THIGH` reader - High Duration of the Output Pulse"]
548pub struct THIGH_R(crate::FieldReader<u8, THIGH_A>);
549impl THIGH_R {
550 #[inline(always)]
551 pub(crate) fn new(bits: u8) -> Self {
552 THIGH_R(crate::FieldReader::new(bits))
553 }
554 #[doc = r"Get enumerated values variant"]
555 #[inline(always)]
556 pub fn variant(&self) -> THIGH_A {
557 match self.bits {
558 0 => THIGH_A::H_31MS,
559 1 => THIGH_A::H_16MS,
560 2 => THIGH_A::H_4MS,
561 3 => THIGH_A::H_976US,
562 4 => THIGH_A::H_488US,
563 5 => THIGH_A::H_122US,
564 6 => THIGH_A::H_30US,
565 7 => THIGH_A::H_15US,
566 _ => unreachable!(),
567 }
568 }
569 #[doc = "Checks if the value of the field is `H_31MS`"]
570 #[inline(always)]
571 pub fn is_h_31ms(&self) -> bool {
572 **self == THIGH_A::H_31MS
573 }
574 #[doc = "Checks if the value of the field is `H_16MS`"]
575 #[inline(always)]
576 pub fn is_h_16ms(&self) -> bool {
577 **self == THIGH_A::H_16MS
578 }
579 #[doc = "Checks if the value of the field is `H_4MS`"]
580 #[inline(always)]
581 pub fn is_h_4ms(&self) -> bool {
582 **self == THIGH_A::H_4MS
583 }
584 #[doc = "Checks if the value of the field is `H_976US`"]
585 #[inline(always)]
586 pub fn is_h_976us(&self) -> bool {
587 **self == THIGH_A::H_976US
588 }
589 #[doc = "Checks if the value of the field is `H_488US`"]
590 #[inline(always)]
591 pub fn is_h_488us(&self) -> bool {
592 **self == THIGH_A::H_488US
593 }
594 #[doc = "Checks if the value of the field is `H_122US`"]
595 #[inline(always)]
596 pub fn is_h_122us(&self) -> bool {
597 **self == THIGH_A::H_122US
598 }
599 #[doc = "Checks if the value of the field is `H_30US`"]
600 #[inline(always)]
601 pub fn is_h_30us(&self) -> bool {
602 **self == THIGH_A::H_30US
603 }
604 #[doc = "Checks if the value of the field is `H_15US`"]
605 #[inline(always)]
606 pub fn is_h_15us(&self) -> bool {
607 **self == THIGH_A::H_15US
608 }
609}
610impl core::ops::Deref for THIGH_R {
611 type Target = crate::FieldReader<u8, THIGH_A>;
612 #[inline(always)]
613 fn deref(&self) -> &Self::Target {
614 &self.0
615 }
616}
617#[doc = "Field `THIGH` writer - High Duration of the Output Pulse"]
618pub struct THIGH_W<'a> {
619 w: &'a mut W,
620}
621impl<'a> THIGH_W<'a> {
622 #[doc = r"Writes `variant` to the field"]
623 #[inline(always)]
624 pub fn variant(self, variant: THIGH_A) -> &'a mut W {
625 self.bits(variant.into())
626 }
627 #[doc = "31.2 ms"]
628 #[inline(always)]
629 pub fn h_31ms(self) -> &'a mut W {
630 self.variant(THIGH_A::H_31MS)
631 }
632 #[doc = "15.6 ms"]
633 #[inline(always)]
634 pub fn h_16ms(self) -> &'a mut W {
635 self.variant(THIGH_A::H_16MS)
636 }
637 #[doc = "3.91 ms"]
638 #[inline(always)]
639 pub fn h_4ms(self) -> &'a mut W {
640 self.variant(THIGH_A::H_4MS)
641 }
642 #[doc = "976 us"]
643 #[inline(always)]
644 pub fn h_976us(self) -> &'a mut W {
645 self.variant(THIGH_A::H_976US)
646 }
647 #[doc = "488 us"]
648 #[inline(always)]
649 pub fn h_488us(self) -> &'a mut W {
650 self.variant(THIGH_A::H_488US)
651 }
652 #[doc = "122 us"]
653 #[inline(always)]
654 pub fn h_122us(self) -> &'a mut W {
655 self.variant(THIGH_A::H_122US)
656 }
657 #[doc = "30.5 us"]
658 #[inline(always)]
659 pub fn h_30us(self) -> &'a mut W {
660 self.variant(THIGH_A::H_30US)
661 }
662 #[doc = "15.2 us"]
663 #[inline(always)]
664 pub fn h_15us(self) -> &'a mut W {
665 self.variant(THIGH_A::H_15US)
666 }
667 #[doc = r"Writes raw bits to the field"]
668 #[inline(always)]
669 pub fn bits(self, value: u8) -> &'a mut W {
670 self.w.bits = (self.w.bits & !(0x07 << 24)) | ((value as u32 & 0x07) << 24);
671 self.w
672 }
673}
674#[doc = "Period of the Output Pulse\n\nValue on reset: 0"]
675#[derive(Clone, Copy, Debug, PartialEq)]
676#[repr(u8)]
677pub enum TPERIOD_A {
678 #[doc = "0: 1 second"]
679 P_1S = 0,
680 #[doc = "1: 500 ms"]
681 P_500MS = 1,
682 #[doc = "2: 250 ms"]
683 P_250MS = 2,
684 #[doc = "3: 125 ms"]
685 P_125MS = 3,
686}
687impl From<TPERIOD_A> for u8 {
688 #[inline(always)]
689 fn from(variant: TPERIOD_A) -> Self {
690 variant as _
691 }
692}
693#[doc = "Field `TPERIOD` reader - Period of the Output Pulse"]
694pub struct TPERIOD_R(crate::FieldReader<u8, TPERIOD_A>);
695impl TPERIOD_R {
696 #[inline(always)]
697 pub(crate) fn new(bits: u8) -> Self {
698 TPERIOD_R(crate::FieldReader::new(bits))
699 }
700 #[doc = r"Get enumerated values variant"]
701 #[inline(always)]
702 pub fn variant(&self) -> TPERIOD_A {
703 match self.bits {
704 0 => TPERIOD_A::P_1S,
705 1 => TPERIOD_A::P_500MS,
706 2 => TPERIOD_A::P_250MS,
707 3 => TPERIOD_A::P_125MS,
708 _ => unreachable!(),
709 }
710 }
711 #[doc = "Checks if the value of the field is `P_1S`"]
712 #[inline(always)]
713 pub fn is_p_1s(&self) -> bool {
714 **self == TPERIOD_A::P_1S
715 }
716 #[doc = "Checks if the value of the field is `P_500MS`"]
717 #[inline(always)]
718 pub fn is_p_500ms(&self) -> bool {
719 **self == TPERIOD_A::P_500MS
720 }
721 #[doc = "Checks if the value of the field is `P_250MS`"]
722 #[inline(always)]
723 pub fn is_p_250ms(&self) -> bool {
724 **self == TPERIOD_A::P_250MS
725 }
726 #[doc = "Checks if the value of the field is `P_125MS`"]
727 #[inline(always)]
728 pub fn is_p_125ms(&self) -> bool {
729 **self == TPERIOD_A::P_125MS
730 }
731}
732impl core::ops::Deref for TPERIOD_R {
733 type Target = crate::FieldReader<u8, TPERIOD_A>;
734 #[inline(always)]
735 fn deref(&self) -> &Self::Target {
736 &self.0
737 }
738}
739#[doc = "Field `TPERIOD` writer - Period of the Output Pulse"]
740pub struct TPERIOD_W<'a> {
741 w: &'a mut W,
742}
743impl<'a> TPERIOD_W<'a> {
744 #[doc = r"Writes `variant` to the field"]
745 #[inline(always)]
746 pub fn variant(self, variant: TPERIOD_A) -> &'a mut W {
747 self.bits(variant.into())
748 }
749 #[doc = "1 second"]
750 #[inline(always)]
751 pub fn p_1s(self) -> &'a mut W {
752 self.variant(TPERIOD_A::P_1S)
753 }
754 #[doc = "500 ms"]
755 #[inline(always)]
756 pub fn p_500ms(self) -> &'a mut W {
757 self.variant(TPERIOD_A::P_500MS)
758 }
759 #[doc = "250 ms"]
760 #[inline(always)]
761 pub fn p_250ms(self) -> &'a mut W {
762 self.variant(TPERIOD_A::P_250MS)
763 }
764 #[doc = "125 ms"]
765 #[inline(always)]
766 pub fn p_125ms(self) -> &'a mut W {
767 self.variant(TPERIOD_A::P_125MS)
768 }
769 #[doc = r"Writes raw bits to the field"]
770 #[inline(always)]
771 pub fn bits(self, value: u8) -> &'a mut W {
772 self.w.bits = (self.w.bits & !(0x03 << 28)) | ((value as u32 & 0x03) << 28);
773 self.w
774 }
775}
776impl R {
777 #[doc = "Bit 0 - 12-/24-hour Mode"]
778 #[inline(always)]
779 pub fn hrmod(&self) -> HRMOD_R {
780 HRMOD_R::new((self.bits & 0x01) != 0)
781 }
782 #[doc = "Bit 1 - PERSIAN Calendar"]
783 #[inline(always)]
784 pub fn persian(&self) -> PERSIAN_R {
785 PERSIAN_R::new(((self.bits >> 1) & 0x01) != 0)
786 }
787 #[doc = "Bit 4 - NEGative PPM Correction"]
788 #[inline(always)]
789 pub fn negppm(&self) -> NEGPPM_R {
790 NEGPPM_R::new(((self.bits >> 4) & 0x01) != 0)
791 }
792 #[doc = "Bits 8:14 - Slow Clock Correction"]
793 #[inline(always)]
794 pub fn correction(&self) -> CORRECTION_R {
795 CORRECTION_R::new(((self.bits >> 8) & 0x7f) as u8)
796 }
797 #[doc = "Bit 15 - HIGH PPM Correction"]
798 #[inline(always)]
799 pub fn highppm(&self) -> HIGHPPM_R {
800 HIGHPPM_R::new(((self.bits >> 15) & 0x01) != 0)
801 }
802 #[doc = "Bits 16:18 - RTCOUT0 OutputSource Selection"]
803 #[inline(always)]
804 pub fn out0(&self) -> OUT0_R {
805 OUT0_R::new(((self.bits >> 16) & 0x07) as u8)
806 }
807 #[doc = "Bits 20:22 - RTCOUT1 Output Source Selection"]
808 #[inline(always)]
809 pub fn out1(&self) -> OUT1_R {
810 OUT1_R::new(((self.bits >> 20) & 0x07) as u8)
811 }
812 #[doc = "Bits 24:26 - High Duration of the Output Pulse"]
813 #[inline(always)]
814 pub fn thigh(&self) -> THIGH_R {
815 THIGH_R::new(((self.bits >> 24) & 0x07) as u8)
816 }
817 #[doc = "Bits 28:29 - Period of the Output Pulse"]
818 #[inline(always)]
819 pub fn tperiod(&self) -> TPERIOD_R {
820 TPERIOD_R::new(((self.bits >> 28) & 0x03) as u8)
821 }
822}
823impl W {
824 #[doc = "Bit 0 - 12-/24-hour Mode"]
825 #[inline(always)]
826 pub fn hrmod(&mut self) -> HRMOD_W {
827 HRMOD_W { w: self }
828 }
829 #[doc = "Bit 1 - PERSIAN Calendar"]
830 #[inline(always)]
831 pub fn persian(&mut self) -> PERSIAN_W {
832 PERSIAN_W { w: self }
833 }
834 #[doc = "Bit 4 - NEGative PPM Correction"]
835 #[inline(always)]
836 pub fn negppm(&mut self) -> NEGPPM_W {
837 NEGPPM_W { w: self }
838 }
839 #[doc = "Bits 8:14 - Slow Clock Correction"]
840 #[inline(always)]
841 pub fn correction(&mut self) -> CORRECTION_W {
842 CORRECTION_W { w: self }
843 }
844 #[doc = "Bit 15 - HIGH PPM Correction"]
845 #[inline(always)]
846 pub fn highppm(&mut self) -> HIGHPPM_W {
847 HIGHPPM_W { w: self }
848 }
849 #[doc = "Bits 16:18 - RTCOUT0 OutputSource Selection"]
850 #[inline(always)]
851 pub fn out0(&mut self) -> OUT0_W {
852 OUT0_W { w: self }
853 }
854 #[doc = "Bits 20:22 - RTCOUT1 Output Source Selection"]
855 #[inline(always)]
856 pub fn out1(&mut self) -> OUT1_W {
857 OUT1_W { w: self }
858 }
859 #[doc = "Bits 24:26 - High Duration of the Output Pulse"]
860 #[inline(always)]
861 pub fn thigh(&mut self) -> THIGH_W {
862 THIGH_W { w: self }
863 }
864 #[doc = "Bits 28:29 - Period of the Output Pulse"]
865 #[inline(always)]
866 pub fn tperiod(&mut self) -> TPERIOD_W {
867 TPERIOD_W { w: self }
868 }
869 #[doc = "Writes raw bits to the register."]
870 #[inline(always)]
871 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
872 self.0.bits(bits);
873 self
874 }
875}
876#[doc = "Mode Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [rtc_mr](index.html) module"]
877pub struct RTC_MR_SPEC;
878impl crate::RegisterSpec for RTC_MR_SPEC {
879 type Ux = u32;
880}
881#[doc = "`read()` method returns [rtc_mr::R](R) reader structure"]
882impl crate::Readable for RTC_MR_SPEC {
883 type Reader = R;
884}
885#[doc = "`write(|w| ..)` method takes [rtc_mr::W](W) writer structure"]
886impl crate::Writable for RTC_MR_SPEC {
887 type Writer = W;
888}
889#[doc = "`reset()` method sets RTC_MR to value 0"]
890impl crate::Resettable for RTC_MR_SPEC {
891 #[inline(always)]
892 fn reset_value() -> Self::Ux {
893 0
894 }
895}