1#[doc = "Register `RCR2` reader"]
2pub struct R(crate::R<RCR2_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<RCR2_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<RCR2_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<RCR2_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `RCR2` writer"]
17pub struct W(crate::W<RCR2_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<RCR2_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<RCR2_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<RCR2_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `START` reader - Start"]
38pub type START_R = crate::BitReader<START_A>;
39#[doc = "Start\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum START_A {
42 #[doc = "0: Prescaler and time counter are stopped."]
43 _0 = 0,
44 #[doc = "1: Prescaler and time counter operate normally."]
45 _1 = 1,
46}
47impl From<START_A> for bool {
48 #[inline(always)]
49 fn from(variant: START_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl START_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> START_A {
57 match self.bits {
58 false => START_A::_0,
59 true => START_A::_1,
60 }
61 }
62 #[doc = "Checks if the value of the field is `_0`"]
63 #[inline(always)]
64 pub fn is_0(&self) -> bool {
65 *self == START_A::_0
66 }
67 #[doc = "Checks if the value of the field is `_1`"]
68 #[inline(always)]
69 pub fn is_1(&self) -> bool {
70 *self == START_A::_1
71 }
72}
73#[doc = "Field `START` writer - Start"]
74pub type START_W<'a, const O: u8> = crate::BitWriter<'a, u8, RCR2_SPEC, START_A, O>;
75impl<'a, const O: u8> START_W<'a, O> {
76 #[doc = "Prescaler and time counter are stopped."]
77 #[inline(always)]
78 pub fn _0(self) -> &'a mut W {
79 self.variant(START_A::_0)
80 }
81 #[doc = "Prescaler and time counter operate normally."]
82 #[inline(always)]
83 pub fn _1(self) -> &'a mut W {
84 self.variant(START_A::_1)
85 }
86}
87#[doc = "Field `RESET` reader - RTC Software Reset"]
88pub type RESET_R = crate::BitReader<RESET_A>;
89#[doc = "RTC Software Reset\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum RESET_A {
92 #[doc = "0: Writing is invalid.(write) / In normal time operation, or an RTC software reset has completed.(read)"]
93 _0 = 0,
94 #[doc = "1: The prescaler and the target registers for RTC software reset *1 are initialized.(write) / During an RTC software reset.(read)"]
95 _1 = 1,
96}
97impl From<RESET_A> for bool {
98 #[inline(always)]
99 fn from(variant: RESET_A) -> Self {
100 variant as u8 != 0
101 }
102}
103impl RESET_R {
104 #[doc = "Get enumerated values variant"]
105 #[inline(always)]
106 pub fn variant(&self) -> RESET_A {
107 match self.bits {
108 false => RESET_A::_0,
109 true => RESET_A::_1,
110 }
111 }
112 #[doc = "Checks if the value of the field is `_0`"]
113 #[inline(always)]
114 pub fn is_0(&self) -> bool {
115 *self == RESET_A::_0
116 }
117 #[doc = "Checks if the value of the field is `_1`"]
118 #[inline(always)]
119 pub fn is_1(&self) -> bool {
120 *self == RESET_A::_1
121 }
122}
123#[doc = "Field `RESET` writer - RTC Software Reset"]
124pub type RESET_W<'a, const O: u8> = crate::BitWriter<'a, u8, RCR2_SPEC, RESET_A, O>;
125impl<'a, const O: u8> RESET_W<'a, O> {
126 #[doc = "Writing is invalid.(write) / In normal time operation, or an RTC software reset has completed.(read)"]
127 #[inline(always)]
128 pub fn _0(self) -> &'a mut W {
129 self.variant(RESET_A::_0)
130 }
131 #[doc = "The prescaler and the target registers for RTC software reset *1 are initialized.(write) / During an RTC software reset.(read)"]
132 #[inline(always)]
133 pub fn _1(self) -> &'a mut W {
134 self.variant(RESET_A::_1)
135 }
136}
137#[doc = "Field `ADJ30` reader - 30-Second Adjustment"]
138pub type ADJ30_R = crate::BitReader<ADJ30_A>;
139#[doc = "30-Second Adjustment\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141pub enum ADJ30_A {
142 #[doc = "0: Writing is invalid.(write) / In normal time operation, or 30-second adjustment has completed.(read)"]
143 _0 = 0,
144 #[doc = "1: 30-second adjustment is executed.(write) / During 30-second adjustment.(read)"]
145 _1 = 1,
146}
147impl From<ADJ30_A> for bool {
148 #[inline(always)]
149 fn from(variant: ADJ30_A) -> Self {
150 variant as u8 != 0
151 }
152}
153impl ADJ30_R {
154 #[doc = "Get enumerated values variant"]
155 #[inline(always)]
156 pub fn variant(&self) -> ADJ30_A {
157 match self.bits {
158 false => ADJ30_A::_0,
159 true => ADJ30_A::_1,
160 }
161 }
162 #[doc = "Checks if the value of the field is `_0`"]
163 #[inline(always)]
164 pub fn is_0(&self) -> bool {
165 *self == ADJ30_A::_0
166 }
167 #[doc = "Checks if the value of the field is `_1`"]
168 #[inline(always)]
169 pub fn is_1(&self) -> bool {
170 *self == ADJ30_A::_1
171 }
172}
173#[doc = "Field `ADJ30` writer - 30-Second Adjustment"]
174pub type ADJ30_W<'a, const O: u8> = crate::BitWriter<'a, u8, RCR2_SPEC, ADJ30_A, O>;
175impl<'a, const O: u8> ADJ30_W<'a, O> {
176 #[doc = "Writing is invalid.(write) / In normal time operation, or 30-second adjustment has completed.(read)"]
177 #[inline(always)]
178 pub fn _0(self) -> &'a mut W {
179 self.variant(ADJ30_A::_0)
180 }
181 #[doc = "30-second adjustment is executed.(write) / During 30-second adjustment.(read)"]
182 #[inline(always)]
183 pub fn _1(self) -> &'a mut W {
184 self.variant(ADJ30_A::_1)
185 }
186}
187#[doc = "Field `RTCOE` reader - RTCOUT Output Enable"]
188pub type RTCOE_R = crate::BitReader<RTCOE_A>;
189#[doc = "RTCOUT Output Enable\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq, Eq)]
191pub enum RTCOE_A {
192 #[doc = "0: RTCOUT output disabled."]
193 _0 = 0,
194 #[doc = "1: RTCOUT output enabled."]
195 _1 = 1,
196}
197impl From<RTCOE_A> for bool {
198 #[inline(always)]
199 fn from(variant: RTCOE_A) -> Self {
200 variant as u8 != 0
201 }
202}
203impl RTCOE_R {
204 #[doc = "Get enumerated values variant"]
205 #[inline(always)]
206 pub fn variant(&self) -> RTCOE_A {
207 match self.bits {
208 false => RTCOE_A::_0,
209 true => RTCOE_A::_1,
210 }
211 }
212 #[doc = "Checks if the value of the field is `_0`"]
213 #[inline(always)]
214 pub fn is_0(&self) -> bool {
215 *self == RTCOE_A::_0
216 }
217 #[doc = "Checks if the value of the field is `_1`"]
218 #[inline(always)]
219 pub fn is_1(&self) -> bool {
220 *self == RTCOE_A::_1
221 }
222}
223#[doc = "Field `RTCOE` writer - RTCOUT Output Enable"]
224pub type RTCOE_W<'a, const O: u8> = crate::BitWriter<'a, u8, RCR2_SPEC, RTCOE_A, O>;
225impl<'a, const O: u8> RTCOE_W<'a, O> {
226 #[doc = "RTCOUT output disabled."]
227 #[inline(always)]
228 pub fn _0(self) -> &'a mut W {
229 self.variant(RTCOE_A::_0)
230 }
231 #[doc = "RTCOUT output enabled."]
232 #[inline(always)]
233 pub fn _1(self) -> &'a mut W {
234 self.variant(RTCOE_A::_1)
235 }
236}
237#[doc = "Field `AADJE` reader - Automatic Adjustment Enable (When the LOCO clock is selected, the setting of this bit is disabled.)"]
238pub type AADJE_R = crate::BitReader<AADJE_A>;
239#[doc = "Automatic Adjustment Enable (When the LOCO clock is selected, the setting of this bit is disabled.)\n\nValue on reset: 0"]
240#[derive(Clone, Copy, Debug, PartialEq, Eq)]
241pub enum AADJE_A {
242 #[doc = "0: Automatic adjustment is disabled."]
243 _0 = 0,
244 #[doc = "1: Automatic adjustment is enabled."]
245 _1 = 1,
246}
247impl From<AADJE_A> for bool {
248 #[inline(always)]
249 fn from(variant: AADJE_A) -> Self {
250 variant as u8 != 0
251 }
252}
253impl AADJE_R {
254 #[doc = "Get enumerated values variant"]
255 #[inline(always)]
256 pub fn variant(&self) -> AADJE_A {
257 match self.bits {
258 false => AADJE_A::_0,
259 true => AADJE_A::_1,
260 }
261 }
262 #[doc = "Checks if the value of the field is `_0`"]
263 #[inline(always)]
264 pub fn is_0(&self) -> bool {
265 *self == AADJE_A::_0
266 }
267 #[doc = "Checks if the value of the field is `_1`"]
268 #[inline(always)]
269 pub fn is_1(&self) -> bool {
270 *self == AADJE_A::_1
271 }
272}
273#[doc = "Field `AADJE` writer - Automatic Adjustment Enable (When the LOCO clock is selected, the setting of this bit is disabled.)"]
274pub type AADJE_W<'a, const O: u8> = crate::BitWriter<'a, u8, RCR2_SPEC, AADJE_A, O>;
275impl<'a, const O: u8> AADJE_W<'a, O> {
276 #[doc = "Automatic adjustment is disabled."]
277 #[inline(always)]
278 pub fn _0(self) -> &'a mut W {
279 self.variant(AADJE_A::_0)
280 }
281 #[doc = "Automatic adjustment is enabled."]
282 #[inline(always)]
283 pub fn _1(self) -> &'a mut W {
284 self.variant(AADJE_A::_1)
285 }
286}
287#[doc = "Field `AADJP` reader - Automatic Adjustment Period Select (When the LOCO clock is selected, the setting of this bit is disabled.)"]
288pub type AADJP_R = crate::BitReader<AADJP_A>;
289#[doc = "Automatic Adjustment Period Select (When the LOCO clock is selected, the setting of this bit is disabled.)\n\nValue on reset: 0"]
290#[derive(Clone, Copy, Debug, PartialEq, Eq)]
291pub enum AADJP_A {
292 #[doc = "0: The RADJ.ADJ\\[5:0\\]
293setting value is adjusted from the count value of the prescaler every minute."]
294 _0 = 0,
295 #[doc = "1: The RADJ.ADJ\\[5:0\\]
296setting value is adjusted from the count value of the prescaler every 10 seconds."]
297 _1 = 1,
298}
299impl From<AADJP_A> for bool {
300 #[inline(always)]
301 fn from(variant: AADJP_A) -> Self {
302 variant as u8 != 0
303 }
304}
305impl AADJP_R {
306 #[doc = "Get enumerated values variant"]
307 #[inline(always)]
308 pub fn variant(&self) -> AADJP_A {
309 match self.bits {
310 false => AADJP_A::_0,
311 true => AADJP_A::_1,
312 }
313 }
314 #[doc = "Checks if the value of the field is `_0`"]
315 #[inline(always)]
316 pub fn is_0(&self) -> bool {
317 *self == AADJP_A::_0
318 }
319 #[doc = "Checks if the value of the field is `_1`"]
320 #[inline(always)]
321 pub fn is_1(&self) -> bool {
322 *self == AADJP_A::_1
323 }
324}
325#[doc = "Field `AADJP` writer - Automatic Adjustment Period Select (When the LOCO clock is selected, the setting of this bit is disabled.)"]
326pub type AADJP_W<'a, const O: u8> = crate::BitWriter<'a, u8, RCR2_SPEC, AADJP_A, O>;
327impl<'a, const O: u8> AADJP_W<'a, O> {
328 #[doc = "The RADJ.ADJ\\[5:0\\]
329setting value is adjusted from the count value of the prescaler every minute."]
330 #[inline(always)]
331 pub fn _0(self) -> &'a mut W {
332 self.variant(AADJP_A::_0)
333 }
334 #[doc = "The RADJ.ADJ\\[5:0\\]
335setting value is adjusted from the count value of the prescaler every 10 seconds."]
336 #[inline(always)]
337 pub fn _1(self) -> &'a mut W {
338 self.variant(AADJP_A::_1)
339 }
340}
341#[doc = "Field `HR24` reader - Hours Mode"]
342pub type HR24_R = crate::BitReader<HR24_A>;
343#[doc = "Hours Mode\n\nValue on reset: 0"]
344#[derive(Clone, Copy, Debug, PartialEq, Eq)]
345pub enum HR24_A {
346 #[doc = "0: The RTC operates in 12-hour mode."]
347 _0 = 0,
348 #[doc = "1: The RTC operates in 24-hour mode."]
349 _1 = 1,
350}
351impl From<HR24_A> for bool {
352 #[inline(always)]
353 fn from(variant: HR24_A) -> Self {
354 variant as u8 != 0
355 }
356}
357impl HR24_R {
358 #[doc = "Get enumerated values variant"]
359 #[inline(always)]
360 pub fn variant(&self) -> HR24_A {
361 match self.bits {
362 false => HR24_A::_0,
363 true => HR24_A::_1,
364 }
365 }
366 #[doc = "Checks if the value of the field is `_0`"]
367 #[inline(always)]
368 pub fn is_0(&self) -> bool {
369 *self == HR24_A::_0
370 }
371 #[doc = "Checks if the value of the field is `_1`"]
372 #[inline(always)]
373 pub fn is_1(&self) -> bool {
374 *self == HR24_A::_1
375 }
376}
377#[doc = "Field `HR24` writer - Hours Mode"]
378pub type HR24_W<'a, const O: u8> = crate::BitWriter<'a, u8, RCR2_SPEC, HR24_A, O>;
379impl<'a, const O: u8> HR24_W<'a, O> {
380 #[doc = "The RTC operates in 12-hour mode."]
381 #[inline(always)]
382 pub fn _0(self) -> &'a mut W {
383 self.variant(HR24_A::_0)
384 }
385 #[doc = "The RTC operates in 24-hour mode."]
386 #[inline(always)]
387 pub fn _1(self) -> &'a mut W {
388 self.variant(HR24_A::_1)
389 }
390}
391#[doc = "Field `CNTMD` reader - Count Mode Select"]
392pub type CNTMD_R = crate::BitReader<CNTMD_A>;
393#[doc = "Count Mode Select\n\nValue on reset: 0"]
394#[derive(Clone, Copy, Debug, PartialEq, Eq)]
395pub enum CNTMD_A {
396 #[doc = "0: The calendar count mode."]
397 _0 = 0,
398 #[doc = "1: The binary count mode."]
399 _1 = 1,
400}
401impl From<CNTMD_A> for bool {
402 #[inline(always)]
403 fn from(variant: CNTMD_A) -> Self {
404 variant as u8 != 0
405 }
406}
407impl CNTMD_R {
408 #[doc = "Get enumerated values variant"]
409 #[inline(always)]
410 pub fn variant(&self) -> CNTMD_A {
411 match self.bits {
412 false => CNTMD_A::_0,
413 true => CNTMD_A::_1,
414 }
415 }
416 #[doc = "Checks if the value of the field is `_0`"]
417 #[inline(always)]
418 pub fn is_0(&self) -> bool {
419 *self == CNTMD_A::_0
420 }
421 #[doc = "Checks if the value of the field is `_1`"]
422 #[inline(always)]
423 pub fn is_1(&self) -> bool {
424 *self == CNTMD_A::_1
425 }
426}
427#[doc = "Field `CNTMD` writer - Count Mode Select"]
428pub type CNTMD_W<'a, const O: u8> = crate::BitWriter<'a, u8, RCR2_SPEC, CNTMD_A, O>;
429impl<'a, const O: u8> CNTMD_W<'a, O> {
430 #[doc = "The calendar count mode."]
431 #[inline(always)]
432 pub fn _0(self) -> &'a mut W {
433 self.variant(CNTMD_A::_0)
434 }
435 #[doc = "The binary count mode."]
436 #[inline(always)]
437 pub fn _1(self) -> &'a mut W {
438 self.variant(CNTMD_A::_1)
439 }
440}
441impl R {
442 #[doc = "Bit 0 - Start"]
443 #[inline(always)]
444 pub fn start(&self) -> START_R {
445 START_R::new((self.bits & 1) != 0)
446 }
447 #[doc = "Bit 1 - RTC Software Reset"]
448 #[inline(always)]
449 pub fn reset(&self) -> RESET_R {
450 RESET_R::new(((self.bits >> 1) & 1) != 0)
451 }
452 #[doc = "Bit 2 - 30-Second Adjustment"]
453 #[inline(always)]
454 pub fn adj30(&self) -> ADJ30_R {
455 ADJ30_R::new(((self.bits >> 2) & 1) != 0)
456 }
457 #[doc = "Bit 3 - RTCOUT Output Enable"]
458 #[inline(always)]
459 pub fn rtcoe(&self) -> RTCOE_R {
460 RTCOE_R::new(((self.bits >> 3) & 1) != 0)
461 }
462 #[doc = "Bit 4 - Automatic Adjustment Enable (When the LOCO clock is selected, the setting of this bit is disabled.)"]
463 #[inline(always)]
464 pub fn aadje(&self) -> AADJE_R {
465 AADJE_R::new(((self.bits >> 4) & 1) != 0)
466 }
467 #[doc = "Bit 5 - Automatic Adjustment Period Select (When the LOCO clock is selected, the setting of this bit is disabled.)"]
468 #[inline(always)]
469 pub fn aadjp(&self) -> AADJP_R {
470 AADJP_R::new(((self.bits >> 5) & 1) != 0)
471 }
472 #[doc = "Bit 6 - Hours Mode"]
473 #[inline(always)]
474 pub fn hr24(&self) -> HR24_R {
475 HR24_R::new(((self.bits >> 6) & 1) != 0)
476 }
477 #[doc = "Bit 7 - Count Mode Select"]
478 #[inline(always)]
479 pub fn cntmd(&self) -> CNTMD_R {
480 CNTMD_R::new(((self.bits >> 7) & 1) != 0)
481 }
482}
483impl W {
484 #[doc = "Bit 0 - Start"]
485 #[inline(always)]
486 #[must_use]
487 pub fn start(&mut self) -> START_W<0> {
488 START_W::new(self)
489 }
490 #[doc = "Bit 1 - RTC Software Reset"]
491 #[inline(always)]
492 #[must_use]
493 pub fn reset(&mut self) -> RESET_W<1> {
494 RESET_W::new(self)
495 }
496 #[doc = "Bit 2 - 30-Second Adjustment"]
497 #[inline(always)]
498 #[must_use]
499 pub fn adj30(&mut self) -> ADJ30_W<2> {
500 ADJ30_W::new(self)
501 }
502 #[doc = "Bit 3 - RTCOUT Output Enable"]
503 #[inline(always)]
504 #[must_use]
505 pub fn rtcoe(&mut self) -> RTCOE_W<3> {
506 RTCOE_W::new(self)
507 }
508 #[doc = "Bit 4 - Automatic Adjustment Enable (When the LOCO clock is selected, the setting of this bit is disabled.)"]
509 #[inline(always)]
510 #[must_use]
511 pub fn aadje(&mut self) -> AADJE_W<4> {
512 AADJE_W::new(self)
513 }
514 #[doc = "Bit 5 - Automatic Adjustment Period Select (When the LOCO clock is selected, the setting of this bit is disabled.)"]
515 #[inline(always)]
516 #[must_use]
517 pub fn aadjp(&mut self) -> AADJP_W<5> {
518 AADJP_W::new(self)
519 }
520 #[doc = "Bit 6 - Hours Mode"]
521 #[inline(always)]
522 #[must_use]
523 pub fn hr24(&mut self) -> HR24_W<6> {
524 HR24_W::new(self)
525 }
526 #[doc = "Bit 7 - Count Mode Select"]
527 #[inline(always)]
528 #[must_use]
529 pub fn cntmd(&mut self) -> CNTMD_W<7> {
530 CNTMD_W::new(self)
531 }
532 #[doc = "Writes raw bits to the register."]
533 #[inline(always)]
534 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
535 self.0.bits(bits);
536 self
537 }
538}
539#[doc = "RTC Control Register 2\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 [rcr2](index.html) module"]
540pub struct RCR2_SPEC;
541impl crate::RegisterSpec for RCR2_SPEC {
542 type Ux = u8;
543}
544#[doc = "`read()` method returns [rcr2::R](R) reader structure"]
545impl crate::Readable for RCR2_SPEC {
546 type Reader = R;
547}
548#[doc = "`write(|w| ..)` method takes [rcr2::W](W) writer structure"]
549impl crate::Writable for RCR2_SPEC {
550 type Writer = W;
551 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
552 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
553}
554#[doc = "`reset()` method sets RCR2 to value 0"]
555impl crate::Resettable for RCR2_SPEC {
556 const RESET_VALUE: Self::Ux = 0;
557}