stm32f1/stm32f102/rtc/
crl.rs

1#[doc = "Register `CRL` reader"]
2pub struct R(crate::R<CRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CRL` writer"]
17pub struct W(crate::W<CRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CRL_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<CRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Second Flag\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum SECF_A {
40    #[doc = "0: Second flag condition not met"]
41    NoPrescalerOverflow = 0,
42    #[doc = "1: Second flag condition met"]
43    PrescalerOverflow = 1,
44}
45impl From<SECF_A> for bool {
46    #[inline(always)]
47    fn from(variant: SECF_A) -> Self {
48        variant as u8 != 0
49    }
50}
51#[doc = "Field `SECF` reader - Second Flag"]
52pub type SECF_R = crate::BitReader<SECF_A>;
53impl SECF_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> SECF_A {
57        match self.bits {
58            false => SECF_A::NoPrescalerOverflow,
59            true => SECF_A::PrescalerOverflow,
60        }
61    }
62    #[doc = "Checks if the value of the field is `NoPrescalerOverflow`"]
63    #[inline(always)]
64    pub fn is_no_prescaler_overflow(&self) -> bool {
65        *self == SECF_A::NoPrescalerOverflow
66    }
67    #[doc = "Checks if the value of the field is `PrescalerOverflow`"]
68    #[inline(always)]
69    pub fn is_prescaler_overflow(&self) -> bool {
70        *self == SECF_A::PrescalerOverflow
71    }
72}
73#[doc = "Second Flag\n\nValue on reset: 0"]
74#[derive(Clone, Copy, Debug, PartialEq)]
75pub enum SECF_AW {
76    #[doc = "0: Clear flag"]
77    Clear = 0,
78}
79impl From<SECF_AW> for bool {
80    #[inline(always)]
81    fn from(variant: SECF_AW) -> Self {
82        variant as u8 != 0
83    }
84}
85#[doc = "Field `SECF` writer - Second Flag"]
86pub type SECF_W<'a, const O: u8> = crate::BitWriter<'a, u32, CRL_SPEC, SECF_AW, O>;
87impl<'a, const O: u8> SECF_W<'a, O> {
88    #[doc = "Clear flag"]
89    #[inline(always)]
90    pub fn clear(self) -> &'a mut W {
91        self.variant(SECF_AW::Clear)
92    }
93}
94#[doc = "Alarm Flag\n\nValue on reset: 0"]
95#[derive(Clone, Copy, Debug, PartialEq)]
96pub enum ALRF_A {
97    #[doc = "0: Alarm not detected"]
98    NoAlarm = 0,
99    #[doc = "1: Alarm detected"]
100    Alarm = 1,
101}
102impl From<ALRF_A> for bool {
103    #[inline(always)]
104    fn from(variant: ALRF_A) -> Self {
105        variant as u8 != 0
106    }
107}
108#[doc = "Field `ALRF` reader - Alarm Flag"]
109pub type ALRF_R = crate::BitReader<ALRF_A>;
110impl ALRF_R {
111    #[doc = "Get enumerated values variant"]
112    #[inline(always)]
113    pub fn variant(&self) -> ALRF_A {
114        match self.bits {
115            false => ALRF_A::NoAlarm,
116            true => ALRF_A::Alarm,
117        }
118    }
119    #[doc = "Checks if the value of the field is `NoAlarm`"]
120    #[inline(always)]
121    pub fn is_no_alarm(&self) -> bool {
122        *self == ALRF_A::NoAlarm
123    }
124    #[doc = "Checks if the value of the field is `Alarm`"]
125    #[inline(always)]
126    pub fn is_alarm(&self) -> bool {
127        *self == ALRF_A::Alarm
128    }
129}
130#[doc = "Alarm Flag\n\nValue on reset: 0"]
131#[derive(Clone, Copy, Debug, PartialEq)]
132pub enum ALRF_AW {
133    #[doc = "0: Clear flag"]
134    Clear = 0,
135}
136impl From<ALRF_AW> for bool {
137    #[inline(always)]
138    fn from(variant: ALRF_AW) -> Self {
139        variant as u8 != 0
140    }
141}
142#[doc = "Field `ALRF` writer - Alarm Flag"]
143pub type ALRF_W<'a, const O: u8> = crate::BitWriter<'a, u32, CRL_SPEC, ALRF_AW, O>;
144impl<'a, const O: u8> ALRF_W<'a, O> {
145    #[doc = "Clear flag"]
146    #[inline(always)]
147    pub fn clear(self) -> &'a mut W {
148        self.variant(ALRF_AW::Clear)
149    }
150}
151#[doc = "Overflow Flag\n\nValue on reset: 0"]
152#[derive(Clone, Copy, Debug, PartialEq)]
153pub enum OWF_A {
154    #[doc = "0: Overflow not detected"]
155    NoOverflow = 0,
156    #[doc = "1: 32-bit programmable counter overflow occurred"]
157    Overflow = 1,
158}
159impl From<OWF_A> for bool {
160    #[inline(always)]
161    fn from(variant: OWF_A) -> Self {
162        variant as u8 != 0
163    }
164}
165#[doc = "Field `OWF` reader - Overflow Flag"]
166pub type OWF_R = crate::BitReader<OWF_A>;
167impl OWF_R {
168    #[doc = "Get enumerated values variant"]
169    #[inline(always)]
170    pub fn variant(&self) -> OWF_A {
171        match self.bits {
172            false => OWF_A::NoOverflow,
173            true => OWF_A::Overflow,
174        }
175    }
176    #[doc = "Checks if the value of the field is `NoOverflow`"]
177    #[inline(always)]
178    pub fn is_no_overflow(&self) -> bool {
179        *self == OWF_A::NoOverflow
180    }
181    #[doc = "Checks if the value of the field is `Overflow`"]
182    #[inline(always)]
183    pub fn is_overflow(&self) -> bool {
184        *self == OWF_A::Overflow
185    }
186}
187#[doc = "Overflow Flag\n\nValue on reset: 0"]
188#[derive(Clone, Copy, Debug, PartialEq)]
189pub enum OWF_AW {
190    #[doc = "0: Clear flag"]
191    Clear = 0,
192}
193impl From<OWF_AW> for bool {
194    #[inline(always)]
195    fn from(variant: OWF_AW) -> Self {
196        variant as u8 != 0
197    }
198}
199#[doc = "Field `OWF` writer - Overflow Flag"]
200pub type OWF_W<'a, const O: u8> = crate::BitWriter<'a, u32, CRL_SPEC, OWF_AW, O>;
201impl<'a, const O: u8> OWF_W<'a, O> {
202    #[doc = "Clear flag"]
203    #[inline(always)]
204    pub fn clear(self) -> &'a mut W {
205        self.variant(OWF_AW::Clear)
206    }
207}
208#[doc = "Registers Synchronized Flag\n\nValue on reset: 0"]
209#[derive(Clone, Copy, Debug, PartialEq)]
210pub enum RSF_A {
211    #[doc = "0: Registers not yet synchronized"]
212    NotSynchronized = 0,
213    #[doc = "1: Registers synchronized"]
214    Synchronized = 1,
215}
216impl From<RSF_A> for bool {
217    #[inline(always)]
218    fn from(variant: RSF_A) -> Self {
219        variant as u8 != 0
220    }
221}
222#[doc = "Field `RSF` reader - Registers Synchronized Flag"]
223pub type RSF_R = crate::BitReader<RSF_A>;
224impl RSF_R {
225    #[doc = "Get enumerated values variant"]
226    #[inline(always)]
227    pub fn variant(&self) -> RSF_A {
228        match self.bits {
229            false => RSF_A::NotSynchronized,
230            true => RSF_A::Synchronized,
231        }
232    }
233    #[doc = "Checks if the value of the field is `NotSynchronized`"]
234    #[inline(always)]
235    pub fn is_not_synchronized(&self) -> bool {
236        *self == RSF_A::NotSynchronized
237    }
238    #[doc = "Checks if the value of the field is `Synchronized`"]
239    #[inline(always)]
240    pub fn is_synchronized(&self) -> bool {
241        *self == RSF_A::Synchronized
242    }
243}
244#[doc = "Registers Synchronized Flag\n\nValue on reset: 0"]
245#[derive(Clone, Copy, Debug, PartialEq)]
246pub enum RSF_AW {
247    #[doc = "0: Clear flag"]
248    Clear = 0,
249}
250impl From<RSF_AW> for bool {
251    #[inline(always)]
252    fn from(variant: RSF_AW) -> Self {
253        variant as u8 != 0
254    }
255}
256#[doc = "Field `RSF` writer - Registers Synchronized Flag"]
257pub type RSF_W<'a, const O: u8> = crate::BitWriter<'a, u32, CRL_SPEC, RSF_AW, O>;
258impl<'a, const O: u8> RSF_W<'a, O> {
259    #[doc = "Clear flag"]
260    #[inline(always)]
261    pub fn clear(self) -> &'a mut W {
262        self.variant(RSF_AW::Clear)
263    }
264}
265#[doc = "Configuration Flag\n\nValue on reset: 0"]
266#[derive(Clone, Copy, Debug, PartialEq)]
267pub enum CNF_A {
268    #[doc = "0: Exit configuration mode (start update of RTC registers)"]
269    Exit = 0,
270    #[doc = "1: Enter configuration mode"]
271    Enter = 1,
272}
273impl From<CNF_A> for bool {
274    #[inline(always)]
275    fn from(variant: CNF_A) -> Self {
276        variant as u8 != 0
277    }
278}
279#[doc = "Field `CNF` reader - Configuration Flag"]
280pub type CNF_R = crate::BitReader<CNF_A>;
281impl CNF_R {
282    #[doc = "Get enumerated values variant"]
283    #[inline(always)]
284    pub fn variant(&self) -> CNF_A {
285        match self.bits {
286            false => CNF_A::Exit,
287            true => CNF_A::Enter,
288        }
289    }
290    #[doc = "Checks if the value of the field is `Exit`"]
291    #[inline(always)]
292    pub fn is_exit(&self) -> bool {
293        *self == CNF_A::Exit
294    }
295    #[doc = "Checks if the value of the field is `Enter`"]
296    #[inline(always)]
297    pub fn is_enter(&self) -> bool {
298        *self == CNF_A::Enter
299    }
300}
301#[doc = "Field `CNF` writer - Configuration Flag"]
302pub type CNF_W<'a, const O: u8> = crate::BitWriter<'a, u32, CRL_SPEC, CNF_A, O>;
303impl<'a, const O: u8> CNF_W<'a, O> {
304    #[doc = "Exit configuration mode (start update of RTC registers)"]
305    #[inline(always)]
306    pub fn exit(self) -> &'a mut W {
307        self.variant(CNF_A::Exit)
308    }
309    #[doc = "Enter configuration mode"]
310    #[inline(always)]
311    pub fn enter(self) -> &'a mut W {
312        self.variant(CNF_A::Enter)
313    }
314}
315#[doc = "RTC operation OFF\n\nValue on reset: 1"]
316#[derive(Clone, Copy, Debug, PartialEq)]
317pub enum RTOFF_A {
318    #[doc = "0: Last write operation on RTC registers is still ongoing"]
319    Enabled = 0,
320    #[doc = "1: Last write operation on RTC registers terminated"]
321    Disabled = 1,
322}
323impl From<RTOFF_A> for bool {
324    #[inline(always)]
325    fn from(variant: RTOFF_A) -> Self {
326        variant as u8 != 0
327    }
328}
329#[doc = "Field `RTOFF` reader - RTC operation OFF"]
330pub type RTOFF_R = crate::BitReader<RTOFF_A>;
331impl RTOFF_R {
332    #[doc = "Get enumerated values variant"]
333    #[inline(always)]
334    pub fn variant(&self) -> RTOFF_A {
335        match self.bits {
336            false => RTOFF_A::Enabled,
337            true => RTOFF_A::Disabled,
338        }
339    }
340    #[doc = "Checks if the value of the field is `Enabled`"]
341    #[inline(always)]
342    pub fn is_enabled(&self) -> bool {
343        *self == RTOFF_A::Enabled
344    }
345    #[doc = "Checks if the value of the field is `Disabled`"]
346    #[inline(always)]
347    pub fn is_disabled(&self) -> bool {
348        *self == RTOFF_A::Disabled
349    }
350}
351impl R {
352    #[doc = "Bit 0 - Second Flag"]
353    #[inline(always)]
354    pub fn secf(&self) -> SECF_R {
355        SECF_R::new((self.bits & 1) != 0)
356    }
357    #[doc = "Bit 1 - Alarm Flag"]
358    #[inline(always)]
359    pub fn alrf(&self) -> ALRF_R {
360        ALRF_R::new(((self.bits >> 1) & 1) != 0)
361    }
362    #[doc = "Bit 2 - Overflow Flag"]
363    #[inline(always)]
364    pub fn owf(&self) -> OWF_R {
365        OWF_R::new(((self.bits >> 2) & 1) != 0)
366    }
367    #[doc = "Bit 3 - Registers Synchronized Flag"]
368    #[inline(always)]
369    pub fn rsf(&self) -> RSF_R {
370        RSF_R::new(((self.bits >> 3) & 1) != 0)
371    }
372    #[doc = "Bit 4 - Configuration Flag"]
373    #[inline(always)]
374    pub fn cnf(&self) -> CNF_R {
375        CNF_R::new(((self.bits >> 4) & 1) != 0)
376    }
377    #[doc = "Bit 5 - RTC operation OFF"]
378    #[inline(always)]
379    pub fn rtoff(&self) -> RTOFF_R {
380        RTOFF_R::new(((self.bits >> 5) & 1) != 0)
381    }
382}
383impl W {
384    #[doc = "Bit 0 - Second Flag"]
385    #[inline(always)]
386    pub fn secf(&mut self) -> SECF_W<0> {
387        SECF_W::new(self)
388    }
389    #[doc = "Bit 1 - Alarm Flag"]
390    #[inline(always)]
391    pub fn alrf(&mut self) -> ALRF_W<1> {
392        ALRF_W::new(self)
393    }
394    #[doc = "Bit 2 - Overflow Flag"]
395    #[inline(always)]
396    pub fn owf(&mut self) -> OWF_W<2> {
397        OWF_W::new(self)
398    }
399    #[doc = "Bit 3 - Registers Synchronized Flag"]
400    #[inline(always)]
401    pub fn rsf(&mut self) -> RSF_W<3> {
402        RSF_W::new(self)
403    }
404    #[doc = "Bit 4 - Configuration Flag"]
405    #[inline(always)]
406    pub fn cnf(&mut self) -> CNF_W<4> {
407        CNF_W::new(self)
408    }
409    #[doc = "Writes raw bits to the register."]
410    #[inline(always)]
411    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
412        self.0.bits(bits);
413        self
414    }
415}
416#[doc = "RTC Control Register Low\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 [crl](index.html) module"]
417pub struct CRL_SPEC;
418impl crate::RegisterSpec for CRL_SPEC {
419    type Ux = u32;
420}
421#[doc = "`read()` method returns [crl::R](R) reader structure"]
422impl crate::Readable for CRL_SPEC {
423    type Reader = R;
424}
425#[doc = "`write(|w| ..)` method takes [crl::W](W) writer structure"]
426impl crate::Writable for CRL_SPEC {
427    type Writer = W;
428}
429#[doc = "`reset()` method sets CRL to value 0x20"]
430impl crate::Resettable for CRL_SPEC {
431    #[inline(always)]
432    fn reset_value() -> Self::Ux {
433        0x20
434    }
435}