1#[doc = "Register `RCR1` reader"]
2pub struct R(crate::R<RCR1_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<RCR1_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<RCR1_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<RCR1_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `RCR1` writer"]
17pub struct W(crate::W<RCR1_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<RCR1_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<RCR1_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<RCR1_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `AIE` reader - Alarm Interrupt Enable"]
38pub type AIE_R = crate::BitReader<AIE_A>;
39#[doc = "Alarm Interrupt Enable\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum AIE_A {
42 #[doc = "0: An alarm interrupt request is disabled."]
43 _0 = 0,
44 #[doc = "1: An alarm interrupt request is enabled."]
45 _1 = 1,
46}
47impl From<AIE_A> for bool {
48 #[inline(always)]
49 fn from(variant: AIE_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl AIE_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> AIE_A {
57 match self.bits {
58 false => AIE_A::_0,
59 true => AIE_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 == AIE_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 == AIE_A::_1
71 }
72}
73#[doc = "Field `AIE` writer - Alarm Interrupt Enable"]
74pub type AIE_W<'a, const O: u8> = crate::BitWriter<'a, u8, RCR1_SPEC, AIE_A, O>;
75impl<'a, const O: u8> AIE_W<'a, O> {
76 #[doc = "An alarm interrupt request is disabled."]
77 #[inline(always)]
78 pub fn _0(self) -> &'a mut W {
79 self.variant(AIE_A::_0)
80 }
81 #[doc = "An alarm interrupt request is enabled."]
82 #[inline(always)]
83 pub fn _1(self) -> &'a mut W {
84 self.variant(AIE_A::_1)
85 }
86}
87#[doc = "Field `CIE` reader - Carry Interrupt Enable"]
88pub type CIE_R = crate::BitReader<CIE_A>;
89#[doc = "Carry Interrupt Enable\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum CIE_A {
92 #[doc = "0: A carry interrupt request is disabled."]
93 _0 = 0,
94 #[doc = "1: A carry interrupt request is enabled."]
95 _1 = 1,
96}
97impl From<CIE_A> for bool {
98 #[inline(always)]
99 fn from(variant: CIE_A) -> Self {
100 variant as u8 != 0
101 }
102}
103impl CIE_R {
104 #[doc = "Get enumerated values variant"]
105 #[inline(always)]
106 pub fn variant(&self) -> CIE_A {
107 match self.bits {
108 false => CIE_A::_0,
109 true => CIE_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 == CIE_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 == CIE_A::_1
121 }
122}
123#[doc = "Field `CIE` writer - Carry Interrupt Enable"]
124pub type CIE_W<'a, const O: u8> = crate::BitWriter<'a, u8, RCR1_SPEC, CIE_A, O>;
125impl<'a, const O: u8> CIE_W<'a, O> {
126 #[doc = "A carry interrupt request is disabled."]
127 #[inline(always)]
128 pub fn _0(self) -> &'a mut W {
129 self.variant(CIE_A::_0)
130 }
131 #[doc = "A carry interrupt request is enabled."]
132 #[inline(always)]
133 pub fn _1(self) -> &'a mut W {
134 self.variant(CIE_A::_1)
135 }
136}
137#[doc = "Field `PIE` reader - Periodic Interrupt Enable"]
138pub type PIE_R = crate::BitReader<PIE_A>;
139#[doc = "Periodic Interrupt Enable\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141pub enum PIE_A {
142 #[doc = "0: A periodic interrupt request is disabled."]
143 _0 = 0,
144 #[doc = "1: A periodic interrupt request is enabled."]
145 _1 = 1,
146}
147impl From<PIE_A> for bool {
148 #[inline(always)]
149 fn from(variant: PIE_A) -> Self {
150 variant as u8 != 0
151 }
152}
153impl PIE_R {
154 #[doc = "Get enumerated values variant"]
155 #[inline(always)]
156 pub fn variant(&self) -> PIE_A {
157 match self.bits {
158 false => PIE_A::_0,
159 true => PIE_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 == PIE_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 == PIE_A::_1
171 }
172}
173#[doc = "Field `PIE` writer - Periodic Interrupt Enable"]
174pub type PIE_W<'a, const O: u8> = crate::BitWriter<'a, u8, RCR1_SPEC, PIE_A, O>;
175impl<'a, const O: u8> PIE_W<'a, O> {
176 #[doc = "A periodic interrupt request is disabled."]
177 #[inline(always)]
178 pub fn _0(self) -> &'a mut W {
179 self.variant(PIE_A::_0)
180 }
181 #[doc = "A periodic interrupt request is enabled."]
182 #[inline(always)]
183 pub fn _1(self) -> &'a mut W {
184 self.variant(PIE_A::_1)
185 }
186}
187#[doc = "Field `RTCOS` reader - RTCOUT Output Select"]
188pub type RTCOS_R = crate::BitReader<RTCOS_A>;
189#[doc = "RTCOUT Output Select\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq, Eq)]
191pub enum RTCOS_A {
192 #[doc = "0: RTCOUT outputs 1 Hz."]
193 _0 = 0,
194 #[doc = "1: RTCOUT outputs 64 Hz."]
195 _1 = 1,
196}
197impl From<RTCOS_A> for bool {
198 #[inline(always)]
199 fn from(variant: RTCOS_A) -> Self {
200 variant as u8 != 0
201 }
202}
203impl RTCOS_R {
204 #[doc = "Get enumerated values variant"]
205 #[inline(always)]
206 pub fn variant(&self) -> RTCOS_A {
207 match self.bits {
208 false => RTCOS_A::_0,
209 true => RTCOS_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 == RTCOS_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 == RTCOS_A::_1
221 }
222}
223#[doc = "Field `RTCOS` writer - RTCOUT Output Select"]
224pub type RTCOS_W<'a, const O: u8> = crate::BitWriter<'a, u8, RCR1_SPEC, RTCOS_A, O>;
225impl<'a, const O: u8> RTCOS_W<'a, O> {
226 #[doc = "RTCOUT outputs 1 Hz."]
227 #[inline(always)]
228 pub fn _0(self) -> &'a mut W {
229 self.variant(RTCOS_A::_0)
230 }
231 #[doc = "RTCOUT outputs 64 Hz."]
232 #[inline(always)]
233 pub fn _1(self) -> &'a mut W {
234 self.variant(RTCOS_A::_1)
235 }
236}
237#[doc = "Field `PES` reader - Periodic Interrupt Select"]
238pub type PES_R = crate::FieldReader<u8, PES_A>;
239#[doc = "Periodic Interrupt Select\n\nValue on reset: 0"]
240#[derive(Clone, Copy, Debug, PartialEq, Eq)]
241#[repr(u8)]
242pub enum PES_A {
243 #[doc = "6: A periodic interrupt is generated every 1/256 second((RCR4.RCKSEL = 0)./A periodic interrupt is generated every 1/128 second((RCR4.RCKSEL = 1)."]
244 _0110 = 6,
245 #[doc = "7: A periodic interrupt is generated every 1/128 second."]
246 _0111 = 7,
247 #[doc = "8: A periodic interrupt is generated every 1/64 second."]
248 _1000 = 8,
249 #[doc = "9: A periodic interrupt is generated every 1/32 second."]
250 _1001 = 9,
251 #[doc = "10: A periodic interrupt is generated every 1/16 second."]
252 _1010 = 10,
253 #[doc = "11: A periodic interrupt is generated every 1/8 second."]
254 _1011 = 11,
255 #[doc = "12: A periodic interrupt is generated every 1/4 second."]
256 _1100 = 12,
257 #[doc = "13: A periodic interrupt is generated every 1/2 second."]
258 _1101 = 13,
259 #[doc = "14: A periodic interrupt is generated every 1 second."]
260 _1110 = 14,
261 #[doc = "15: A periodic interrupt is generated every 2 seconds."]
262 _1111 = 15,
263}
264impl From<PES_A> for u8 {
265 #[inline(always)]
266 fn from(variant: PES_A) -> Self {
267 variant as _
268 }
269}
270impl PES_R {
271 #[doc = "Get enumerated values variant"]
272 #[inline(always)]
273 pub fn variant(&self) -> Option<PES_A> {
274 match self.bits {
275 6 => Some(PES_A::_0110),
276 7 => Some(PES_A::_0111),
277 8 => Some(PES_A::_1000),
278 9 => Some(PES_A::_1001),
279 10 => Some(PES_A::_1010),
280 11 => Some(PES_A::_1011),
281 12 => Some(PES_A::_1100),
282 13 => Some(PES_A::_1101),
283 14 => Some(PES_A::_1110),
284 15 => Some(PES_A::_1111),
285 _ => None,
286 }
287 }
288 #[doc = "Checks if the value of the field is `_0110`"]
289 #[inline(always)]
290 pub fn is_0110(&self) -> bool {
291 *self == PES_A::_0110
292 }
293 #[doc = "Checks if the value of the field is `_0111`"]
294 #[inline(always)]
295 pub fn is_0111(&self) -> bool {
296 *self == PES_A::_0111
297 }
298 #[doc = "Checks if the value of the field is `_1000`"]
299 #[inline(always)]
300 pub fn is_1000(&self) -> bool {
301 *self == PES_A::_1000
302 }
303 #[doc = "Checks if the value of the field is `_1001`"]
304 #[inline(always)]
305 pub fn is_1001(&self) -> bool {
306 *self == PES_A::_1001
307 }
308 #[doc = "Checks if the value of the field is `_1010`"]
309 #[inline(always)]
310 pub fn is_1010(&self) -> bool {
311 *self == PES_A::_1010
312 }
313 #[doc = "Checks if the value of the field is `_1011`"]
314 #[inline(always)]
315 pub fn is_1011(&self) -> bool {
316 *self == PES_A::_1011
317 }
318 #[doc = "Checks if the value of the field is `_1100`"]
319 #[inline(always)]
320 pub fn is_1100(&self) -> bool {
321 *self == PES_A::_1100
322 }
323 #[doc = "Checks if the value of the field is `_1101`"]
324 #[inline(always)]
325 pub fn is_1101(&self) -> bool {
326 *self == PES_A::_1101
327 }
328 #[doc = "Checks if the value of the field is `_1110`"]
329 #[inline(always)]
330 pub fn is_1110(&self) -> bool {
331 *self == PES_A::_1110
332 }
333 #[doc = "Checks if the value of the field is `_1111`"]
334 #[inline(always)]
335 pub fn is_1111(&self) -> bool {
336 *self == PES_A::_1111
337 }
338}
339#[doc = "Field `PES` writer - Periodic Interrupt Select"]
340pub type PES_W<'a, const O: u8> = crate::FieldWriter<'a, u8, RCR1_SPEC, u8, PES_A, 4, O>;
341impl<'a, const O: u8> PES_W<'a, O> {
342 #[doc = "A periodic interrupt is generated every 1/256 second((RCR4.RCKSEL = 0)./A periodic interrupt is generated every 1/128 second((RCR4.RCKSEL = 1)."]
343 #[inline(always)]
344 pub fn _0110(self) -> &'a mut W {
345 self.variant(PES_A::_0110)
346 }
347 #[doc = "A periodic interrupt is generated every 1/128 second."]
348 #[inline(always)]
349 pub fn _0111(self) -> &'a mut W {
350 self.variant(PES_A::_0111)
351 }
352 #[doc = "A periodic interrupt is generated every 1/64 second."]
353 #[inline(always)]
354 pub fn _1000(self) -> &'a mut W {
355 self.variant(PES_A::_1000)
356 }
357 #[doc = "A periodic interrupt is generated every 1/32 second."]
358 #[inline(always)]
359 pub fn _1001(self) -> &'a mut W {
360 self.variant(PES_A::_1001)
361 }
362 #[doc = "A periodic interrupt is generated every 1/16 second."]
363 #[inline(always)]
364 pub fn _1010(self) -> &'a mut W {
365 self.variant(PES_A::_1010)
366 }
367 #[doc = "A periodic interrupt is generated every 1/8 second."]
368 #[inline(always)]
369 pub fn _1011(self) -> &'a mut W {
370 self.variant(PES_A::_1011)
371 }
372 #[doc = "A periodic interrupt is generated every 1/4 second."]
373 #[inline(always)]
374 pub fn _1100(self) -> &'a mut W {
375 self.variant(PES_A::_1100)
376 }
377 #[doc = "A periodic interrupt is generated every 1/2 second."]
378 #[inline(always)]
379 pub fn _1101(self) -> &'a mut W {
380 self.variant(PES_A::_1101)
381 }
382 #[doc = "A periodic interrupt is generated every 1 second."]
383 #[inline(always)]
384 pub fn _1110(self) -> &'a mut W {
385 self.variant(PES_A::_1110)
386 }
387 #[doc = "A periodic interrupt is generated every 2 seconds."]
388 #[inline(always)]
389 pub fn _1111(self) -> &'a mut W {
390 self.variant(PES_A::_1111)
391 }
392}
393impl R {
394 #[doc = "Bit 0 - Alarm Interrupt Enable"]
395 #[inline(always)]
396 pub fn aie(&self) -> AIE_R {
397 AIE_R::new((self.bits & 1) != 0)
398 }
399 #[doc = "Bit 1 - Carry Interrupt Enable"]
400 #[inline(always)]
401 pub fn cie(&self) -> CIE_R {
402 CIE_R::new(((self.bits >> 1) & 1) != 0)
403 }
404 #[doc = "Bit 2 - Periodic Interrupt Enable"]
405 #[inline(always)]
406 pub fn pie(&self) -> PIE_R {
407 PIE_R::new(((self.bits >> 2) & 1) != 0)
408 }
409 #[doc = "Bit 3 - RTCOUT Output Select"]
410 #[inline(always)]
411 pub fn rtcos(&self) -> RTCOS_R {
412 RTCOS_R::new(((self.bits >> 3) & 1) != 0)
413 }
414 #[doc = "Bits 4:7 - Periodic Interrupt Select"]
415 #[inline(always)]
416 pub fn pes(&self) -> PES_R {
417 PES_R::new((self.bits >> 4) & 0x0f)
418 }
419}
420impl W {
421 #[doc = "Bit 0 - Alarm Interrupt Enable"]
422 #[inline(always)]
423 #[must_use]
424 pub fn aie(&mut self) -> AIE_W<0> {
425 AIE_W::new(self)
426 }
427 #[doc = "Bit 1 - Carry Interrupt Enable"]
428 #[inline(always)]
429 #[must_use]
430 pub fn cie(&mut self) -> CIE_W<1> {
431 CIE_W::new(self)
432 }
433 #[doc = "Bit 2 - Periodic Interrupt Enable"]
434 #[inline(always)]
435 #[must_use]
436 pub fn pie(&mut self) -> PIE_W<2> {
437 PIE_W::new(self)
438 }
439 #[doc = "Bit 3 - RTCOUT Output Select"]
440 #[inline(always)]
441 #[must_use]
442 pub fn rtcos(&mut self) -> RTCOS_W<3> {
443 RTCOS_W::new(self)
444 }
445 #[doc = "Bits 4:7 - Periodic Interrupt Select"]
446 #[inline(always)]
447 #[must_use]
448 pub fn pes(&mut self) -> PES_W<4> {
449 PES_W::new(self)
450 }
451 #[doc = "Writes raw bits to the register."]
452 #[inline(always)]
453 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
454 self.0.bits(bits);
455 self
456 }
457}
458#[doc = "RTC Control Register 1\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 [rcr1](index.html) module"]
459pub struct RCR1_SPEC;
460impl crate::RegisterSpec for RCR1_SPEC {
461 type Ux = u8;
462}
463#[doc = "`read()` method returns [rcr1::R](R) reader structure"]
464impl crate::Readable for RCR1_SPEC {
465 type Reader = R;
466}
467#[doc = "`write(|w| ..)` method takes [rcr1::W](W) writer structure"]
468impl crate::Writable for RCR1_SPEC {
469 type Writer = W;
470 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
471 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
472}
473#[doc = "`reset()` method sets RCR1 to value 0"]
474impl crate::Resettable for RCR1_SPEC {
475 const RESET_VALUE: Self::Ux = 0;
476}