1#[doc = "Register `SR` reader"]
2pub struct R(crate::R<SR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<SR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<SR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<SR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Field `ACKUPD` reader - Acknowledge for Update"]
17pub type ACKUPD_R = crate::BitReader<ACKUPD_A>;
18#[doc = "Acknowledge for Update\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20pub enum ACKUPD_A {
21 #[doc = "0: Time and calendar registers cannot be updated."]
22 FREERUN = 0,
23 #[doc = "1: Time and calendar registers can be updated."]
24 UPDATE = 1,
25}
26impl From<ACKUPD_A> for bool {
27 #[inline(always)]
28 fn from(variant: ACKUPD_A) -> Self {
29 variant as u8 != 0
30 }
31}
32impl ACKUPD_R {
33 #[doc = "Get enumerated values variant"]
34 #[inline(always)]
35 pub fn variant(&self) -> ACKUPD_A {
36 match self.bits {
37 false => ACKUPD_A::FREERUN,
38 true => ACKUPD_A::UPDATE,
39 }
40 }
41 #[doc = "Checks if the value of the field is `FREERUN`"]
42 #[inline(always)]
43 pub fn is_freerun(&self) -> bool {
44 *self == ACKUPD_A::FREERUN
45 }
46 #[doc = "Checks if the value of the field is `UPDATE`"]
47 #[inline(always)]
48 pub fn is_update(&self) -> bool {
49 *self == ACKUPD_A::UPDATE
50 }
51}
52#[doc = "Field `ALARM` reader - Alarm Flag"]
53pub type ALARM_R = crate::BitReader<ALARM_A>;
54#[doc = "Alarm Flag\n\nValue on reset: 0"]
55#[derive(Clone, Copy, Debug, PartialEq, Eq)]
56pub enum ALARM_A {
57 #[doc = "0: No alarm matching condition occurred."]
58 NO_ALARMEVENT = 0,
59 #[doc = "1: An alarm matching condition has occurred."]
60 ALARMEVENT = 1,
61}
62impl From<ALARM_A> for bool {
63 #[inline(always)]
64 fn from(variant: ALARM_A) -> Self {
65 variant as u8 != 0
66 }
67}
68impl ALARM_R {
69 #[doc = "Get enumerated values variant"]
70 #[inline(always)]
71 pub fn variant(&self) -> ALARM_A {
72 match self.bits {
73 false => ALARM_A::NO_ALARMEVENT,
74 true => ALARM_A::ALARMEVENT,
75 }
76 }
77 #[doc = "Checks if the value of the field is `NO_ALARMEVENT`"]
78 #[inline(always)]
79 pub fn is_no_alarmevent(&self) -> bool {
80 *self == ALARM_A::NO_ALARMEVENT
81 }
82 #[doc = "Checks if the value of the field is `ALARMEVENT`"]
83 #[inline(always)]
84 pub fn is_alarmevent(&self) -> bool {
85 *self == ALARM_A::ALARMEVENT
86 }
87}
88#[doc = "Field `SEC` reader - Second Event"]
89pub type SEC_R = crate::BitReader<SEC_A>;
90#[doc = "Second Event\n\nValue on reset: 0"]
91#[derive(Clone, Copy, Debug, PartialEq, Eq)]
92pub enum SEC_A {
93 #[doc = "0: No second event has occurred since the last clear."]
94 NO_SECEVENT = 0,
95 #[doc = "1: At least one second event has occurred since the last clear."]
96 SECEVENT = 1,
97}
98impl From<SEC_A> for bool {
99 #[inline(always)]
100 fn from(variant: SEC_A) -> Self {
101 variant as u8 != 0
102 }
103}
104impl SEC_R {
105 #[doc = "Get enumerated values variant"]
106 #[inline(always)]
107 pub fn variant(&self) -> SEC_A {
108 match self.bits {
109 false => SEC_A::NO_SECEVENT,
110 true => SEC_A::SECEVENT,
111 }
112 }
113 #[doc = "Checks if the value of the field is `NO_SECEVENT`"]
114 #[inline(always)]
115 pub fn is_no_secevent(&self) -> bool {
116 *self == SEC_A::NO_SECEVENT
117 }
118 #[doc = "Checks if the value of the field is `SECEVENT`"]
119 #[inline(always)]
120 pub fn is_secevent(&self) -> bool {
121 *self == SEC_A::SECEVENT
122 }
123}
124#[doc = "Field `TIMEV` reader - Time Event"]
125pub type TIMEV_R = crate::BitReader<TIMEV_A>;
126#[doc = "Time Event\n\nValue on reset: 0"]
127#[derive(Clone, Copy, Debug, PartialEq, Eq)]
128pub enum TIMEV_A {
129 #[doc = "0: No time event has occurred since the last clear."]
130 NO_TIMEVENT = 0,
131 #[doc = "1: At least one time event has occurred since the last clear."]
132 TIMEVENT = 1,
133}
134impl From<TIMEV_A> for bool {
135 #[inline(always)]
136 fn from(variant: TIMEV_A) -> Self {
137 variant as u8 != 0
138 }
139}
140impl TIMEV_R {
141 #[doc = "Get enumerated values variant"]
142 #[inline(always)]
143 pub fn variant(&self) -> TIMEV_A {
144 match self.bits {
145 false => TIMEV_A::NO_TIMEVENT,
146 true => TIMEV_A::TIMEVENT,
147 }
148 }
149 #[doc = "Checks if the value of the field is `NO_TIMEVENT`"]
150 #[inline(always)]
151 pub fn is_no_timevent(&self) -> bool {
152 *self == TIMEV_A::NO_TIMEVENT
153 }
154 #[doc = "Checks if the value of the field is `TIMEVENT`"]
155 #[inline(always)]
156 pub fn is_timevent(&self) -> bool {
157 *self == TIMEV_A::TIMEVENT
158 }
159}
160#[doc = "Field `CALEV` reader - Calendar Event"]
161pub type CALEV_R = crate::BitReader<CALEV_A>;
162#[doc = "Calendar Event\n\nValue on reset: 0"]
163#[derive(Clone, Copy, Debug, PartialEq, Eq)]
164pub enum CALEV_A {
165 #[doc = "0: No calendar event has occurred since the last clear."]
166 NO_CALEVENT = 0,
167 #[doc = "1: At least one calendar event has occurred since the last clear."]
168 CALEVENT = 1,
169}
170impl From<CALEV_A> for bool {
171 #[inline(always)]
172 fn from(variant: CALEV_A) -> Self {
173 variant as u8 != 0
174 }
175}
176impl CALEV_R {
177 #[doc = "Get enumerated values variant"]
178 #[inline(always)]
179 pub fn variant(&self) -> CALEV_A {
180 match self.bits {
181 false => CALEV_A::NO_CALEVENT,
182 true => CALEV_A::CALEVENT,
183 }
184 }
185 #[doc = "Checks if the value of the field is `NO_CALEVENT`"]
186 #[inline(always)]
187 pub fn is_no_calevent(&self) -> bool {
188 *self == CALEV_A::NO_CALEVENT
189 }
190 #[doc = "Checks if the value of the field is `CALEVENT`"]
191 #[inline(always)]
192 pub fn is_calevent(&self) -> bool {
193 *self == CALEV_A::CALEVENT
194 }
195}
196#[doc = "Field `TDERR` reader - Time and/or Date Free Running Error"]
197pub type TDERR_R = crate::BitReader<TDERR_A>;
198#[doc = "Time and/or Date Free Running Error\n\nValue on reset: 0"]
199#[derive(Clone, Copy, Debug, PartialEq, Eq)]
200pub enum TDERR_A {
201 #[doc = "0: The internal free running counters are carrying valid values since the last read of the Status Register (RTC_SR)."]
202 CORRECT = 0,
203 #[doc = "1: The internal free running counters have been corrupted (invalid date or time, non-BCD values) since the last read and/or they are still invalid."]
204 ERR_TIMEDATE = 1,
205}
206impl From<TDERR_A> for bool {
207 #[inline(always)]
208 fn from(variant: TDERR_A) -> Self {
209 variant as u8 != 0
210 }
211}
212impl TDERR_R {
213 #[doc = "Get enumerated values variant"]
214 #[inline(always)]
215 pub fn variant(&self) -> TDERR_A {
216 match self.bits {
217 false => TDERR_A::CORRECT,
218 true => TDERR_A::ERR_TIMEDATE,
219 }
220 }
221 #[doc = "Checks if the value of the field is `CORRECT`"]
222 #[inline(always)]
223 pub fn is_correct(&self) -> bool {
224 *self == TDERR_A::CORRECT
225 }
226 #[doc = "Checks if the value of the field is `ERR_TIMEDATE`"]
227 #[inline(always)]
228 pub fn is_err_timedate(&self) -> bool {
229 *self == TDERR_A::ERR_TIMEDATE
230 }
231}
232impl R {
233 #[doc = "Bit 0 - Acknowledge for Update"]
234 #[inline(always)]
235 pub fn ackupd(&self) -> ACKUPD_R {
236 ACKUPD_R::new((self.bits & 1) != 0)
237 }
238 #[doc = "Bit 1 - Alarm Flag"]
239 #[inline(always)]
240 pub fn alarm(&self) -> ALARM_R {
241 ALARM_R::new(((self.bits >> 1) & 1) != 0)
242 }
243 #[doc = "Bit 2 - Second Event"]
244 #[inline(always)]
245 pub fn sec(&self) -> SEC_R {
246 SEC_R::new(((self.bits >> 2) & 1) != 0)
247 }
248 #[doc = "Bit 3 - Time Event"]
249 #[inline(always)]
250 pub fn timev(&self) -> TIMEV_R {
251 TIMEV_R::new(((self.bits >> 3) & 1) != 0)
252 }
253 #[doc = "Bit 4 - Calendar Event"]
254 #[inline(always)]
255 pub fn calev(&self) -> CALEV_R {
256 CALEV_R::new(((self.bits >> 4) & 1) != 0)
257 }
258 #[doc = "Bit 5 - Time and/or Date Free Running Error"]
259 #[inline(always)]
260 pub fn tderr(&self) -> TDERR_R {
261 TDERR_R::new(((self.bits >> 5) & 1) != 0)
262 }
263}
264#[doc = "Status Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [sr](index.html) module"]
265pub struct SR_SPEC;
266impl crate::RegisterSpec for SR_SPEC {
267 type Ux = u32;
268}
269#[doc = "`read()` method returns [sr::R](R) reader structure"]
270impl crate::Readable for SR_SPEC {
271 type Reader = R;
272}
273#[doc = "`reset()` method sets SR to value 0"]
274impl crate::Resettable for SR_SPEC {
275 const RESET_VALUE: Self::Ux = 0;
276}