stm32f1_staging/stm32f103/rtc/
crl.rs1pub type R = crate::R<CRLrs>;
3pub type W = crate::W<CRLrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum SECFR {
11 NoPrescalerOverflow = 0,
13 PrescalerOverflow = 1,
15}
16impl From<SECFR> for bool {
17 #[inline(always)]
18 fn from(variant: SECFR) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type SECF_R = crate::BitReader<SECFR>;
24impl SECF_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> SECFR {
28 match self.bits {
29 false => SECFR::NoPrescalerOverflow,
30 true => SECFR::PrescalerOverflow,
31 }
32 }
33 #[inline(always)]
35 pub fn is_no_prescaler_overflow(&self) -> bool {
36 *self == SECFR::NoPrescalerOverflow
37 }
38 #[inline(always)]
40 pub fn is_prescaler_overflow(&self) -> bool {
41 *self == SECFR::PrescalerOverflow
42 }
43}
44#[cfg_attr(feature = "defmt", derive(defmt::Format))]
48#[derive(Clone, Copy, Debug, PartialEq, Eq)]
49pub enum CLEAR {
50 Clear = 0,
52}
53impl From<CLEAR> for bool {
54 #[inline(always)]
55 fn from(variant: CLEAR) -> Self {
56 variant as u8 != 0
57 }
58}
59pub type SECF_W<'a, REG> = crate::BitWriter0C<'a, REG, CLEAR>;
61impl<'a, REG> SECF_W<'a, REG>
62where
63 REG: crate::Writable + crate::RegisterSpec,
64{
65 #[inline(always)]
67 pub fn clear(self) -> &'a mut crate::W<REG> {
68 self.variant(CLEAR::Clear)
69 }
70}
71#[cfg_attr(feature = "defmt", derive(defmt::Format))]
75#[derive(Clone, Copy, Debug, PartialEq, Eq)]
76pub enum ALRFR {
77 NoAlarm = 0,
79 Alarm = 1,
81}
82impl From<ALRFR> for bool {
83 #[inline(always)]
84 fn from(variant: ALRFR) -> Self {
85 variant as u8 != 0
86 }
87}
88pub type ALRF_R = crate::BitReader<ALRFR>;
90impl ALRF_R {
91 #[inline(always)]
93 pub const fn variant(&self) -> ALRFR {
94 match self.bits {
95 false => ALRFR::NoAlarm,
96 true => ALRFR::Alarm,
97 }
98 }
99 #[inline(always)]
101 pub fn is_no_alarm(&self) -> bool {
102 *self == ALRFR::NoAlarm
103 }
104 #[inline(always)]
106 pub fn is_alarm(&self) -> bool {
107 *self == ALRFR::Alarm
108 }
109}
110pub use SECF_W as ALRF_W;
112#[cfg_attr(feature = "defmt", derive(defmt::Format))]
116#[derive(Clone, Copy, Debug, PartialEq, Eq)]
117pub enum OWFR {
118 NoOverflow = 0,
120 Overflow = 1,
122}
123impl From<OWFR> for bool {
124 #[inline(always)]
125 fn from(variant: OWFR) -> Self {
126 variant as u8 != 0
127 }
128}
129pub type OWF_R = crate::BitReader<OWFR>;
131impl OWF_R {
132 #[inline(always)]
134 pub const fn variant(&self) -> OWFR {
135 match self.bits {
136 false => OWFR::NoOverflow,
137 true => OWFR::Overflow,
138 }
139 }
140 #[inline(always)]
142 pub fn is_no_overflow(&self) -> bool {
143 *self == OWFR::NoOverflow
144 }
145 #[inline(always)]
147 pub fn is_overflow(&self) -> bool {
148 *self == OWFR::Overflow
149 }
150}
151pub use SECF_W as OWF_W;
153#[cfg_attr(feature = "defmt", derive(defmt::Format))]
157#[derive(Clone, Copy, Debug, PartialEq, Eq)]
158pub enum RSFR {
159 NotSynchronized = 0,
161 Synchronized = 1,
163}
164impl From<RSFR> for bool {
165 #[inline(always)]
166 fn from(variant: RSFR) -> Self {
167 variant as u8 != 0
168 }
169}
170pub type RSF_R = crate::BitReader<RSFR>;
172impl RSF_R {
173 #[inline(always)]
175 pub const fn variant(&self) -> RSFR {
176 match self.bits {
177 false => RSFR::NotSynchronized,
178 true => RSFR::Synchronized,
179 }
180 }
181 #[inline(always)]
183 pub fn is_not_synchronized(&self) -> bool {
184 *self == RSFR::NotSynchronized
185 }
186 #[inline(always)]
188 pub fn is_synchronized(&self) -> bool {
189 *self == RSFR::Synchronized
190 }
191}
192pub use SECF_W as RSF_W;
194#[cfg_attr(feature = "defmt", derive(defmt::Format))]
198#[derive(Clone, Copy, Debug, PartialEq, Eq)]
199pub enum CNF {
200 Exit = 0,
202 Enter = 1,
204}
205impl From<CNF> for bool {
206 #[inline(always)]
207 fn from(variant: CNF) -> Self {
208 variant as u8 != 0
209 }
210}
211pub type CNF_R = crate::BitReader<CNF>;
213impl CNF_R {
214 #[inline(always)]
216 pub const fn variant(&self) -> CNF {
217 match self.bits {
218 false => CNF::Exit,
219 true => CNF::Enter,
220 }
221 }
222 #[inline(always)]
224 pub fn is_exit(&self) -> bool {
225 *self == CNF::Exit
226 }
227 #[inline(always)]
229 pub fn is_enter(&self) -> bool {
230 *self == CNF::Enter
231 }
232}
233pub type CNF_W<'a, REG> = crate::BitWriter<'a, REG, CNF>;
235impl<'a, REG> CNF_W<'a, REG>
236where
237 REG: crate::Writable + crate::RegisterSpec,
238{
239 #[inline(always)]
241 pub fn exit(self) -> &'a mut crate::W<REG> {
242 self.variant(CNF::Exit)
243 }
244 #[inline(always)]
246 pub fn enter(self) -> &'a mut crate::W<REG> {
247 self.variant(CNF::Enter)
248 }
249}
250#[cfg_attr(feature = "defmt", derive(defmt::Format))]
254#[derive(Clone, Copy, Debug, PartialEq, Eq)]
255pub enum RTOFF {
256 Enabled = 0,
258 Disabled = 1,
260}
261impl From<RTOFF> for bool {
262 #[inline(always)]
263 fn from(variant: RTOFF) -> Self {
264 variant as u8 != 0
265 }
266}
267pub type RTOFF_R = crate::BitReader<RTOFF>;
269impl RTOFF_R {
270 #[inline(always)]
272 pub const fn variant(&self) -> RTOFF {
273 match self.bits {
274 false => RTOFF::Enabled,
275 true => RTOFF::Disabled,
276 }
277 }
278 #[inline(always)]
280 pub fn is_enabled(&self) -> bool {
281 *self == RTOFF::Enabled
282 }
283 #[inline(always)]
285 pub fn is_disabled(&self) -> bool {
286 *self == RTOFF::Disabled
287 }
288}
289impl R {
290 #[inline(always)]
292 pub fn secf(&self) -> SECF_R {
293 SECF_R::new((self.bits & 1) != 0)
294 }
295 #[inline(always)]
297 pub fn alrf(&self) -> ALRF_R {
298 ALRF_R::new(((self.bits >> 1) & 1) != 0)
299 }
300 #[inline(always)]
302 pub fn owf(&self) -> OWF_R {
303 OWF_R::new(((self.bits >> 2) & 1) != 0)
304 }
305 #[inline(always)]
307 pub fn rsf(&self) -> RSF_R {
308 RSF_R::new(((self.bits >> 3) & 1) != 0)
309 }
310 #[inline(always)]
312 pub fn cnf(&self) -> CNF_R {
313 CNF_R::new(((self.bits >> 4) & 1) != 0)
314 }
315 #[inline(always)]
317 pub fn rtoff(&self) -> RTOFF_R {
318 RTOFF_R::new(((self.bits >> 5) & 1) != 0)
319 }
320}
321impl core::fmt::Debug for R {
322 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
323 f.debug_struct("CRL")
324 .field("secf", &self.secf())
325 .field("alrf", &self.alrf())
326 .field("owf", &self.owf())
327 .field("rsf", &self.rsf())
328 .field("cnf", &self.cnf())
329 .field("rtoff", &self.rtoff())
330 .finish()
331 }
332}
333impl W {
334 #[inline(always)]
336 pub fn secf(&mut self) -> SECF_W<CRLrs> {
337 SECF_W::new(self, 0)
338 }
339 #[inline(always)]
341 pub fn alrf(&mut self) -> ALRF_W<CRLrs> {
342 ALRF_W::new(self, 1)
343 }
344 #[inline(always)]
346 pub fn owf(&mut self) -> OWF_W<CRLrs> {
347 OWF_W::new(self, 2)
348 }
349 #[inline(always)]
351 pub fn rsf(&mut self) -> RSF_W<CRLrs> {
352 RSF_W::new(self, 3)
353 }
354 #[inline(always)]
356 pub fn cnf(&mut self) -> CNF_W<CRLrs> {
357 CNF_W::new(self, 4)
358 }
359}
360pub struct CRLrs;
366impl crate::RegisterSpec for CRLrs {
367 type Ux = u32;
368}
369impl crate::Readable for CRLrs {}
371impl crate::Writable for CRLrs {
373 type Safety = crate::Unsafe;
374 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0x0f;
375}
376impl crate::Resettable for CRLrs {
378 const RESET_VALUE: u32 = 0x20;
379}