stm32f1_staging/stm32f100/bkp/
rtccr.rs1pub type R = crate::R<RTCCRrs>;
3pub type W = crate::W<RTCCRrs>;
5pub type CAL_R = crate::FieldReader;
7pub type CAL_W<'a, REG> = crate::FieldWriter<'a, REG, 7>;
9pub type CCO_R = crate::BitReader;
11pub type CCO_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[cfg_attr(feature = "defmt", derive(defmt::Format))]
17#[derive(Clone, Copy, Debug, PartialEq, Eq)]
18pub enum ASOE {
19 Disabled = 0,
21 Enabled = 1,
23}
24impl From<ASOE> for bool {
25 #[inline(always)]
26 fn from(variant: ASOE) -> Self {
27 variant as u8 != 0
28 }
29}
30pub type ASOE_R = crate::BitReader<ASOE>;
32impl ASOE_R {
33 #[inline(always)]
35 pub const fn variant(&self) -> ASOE {
36 match self.bits {
37 false => ASOE::Disabled,
38 true => ASOE::Enabled,
39 }
40 }
41 #[inline(always)]
43 pub fn is_disabled(&self) -> bool {
44 *self == ASOE::Disabled
45 }
46 #[inline(always)]
48 pub fn is_enabled(&self) -> bool {
49 *self == ASOE::Enabled
50 }
51}
52pub type ASOE_W<'a, REG> = crate::BitWriter<'a, REG, ASOE>;
54impl<'a, REG> ASOE_W<'a, REG>
55where
56 REG: crate::Writable + crate::RegisterSpec,
57{
58 #[inline(always)]
60 pub fn disabled(self) -> &'a mut crate::W<REG> {
61 self.variant(ASOE::Disabled)
62 }
63 #[inline(always)]
65 pub fn enabled(self) -> &'a mut crate::W<REG> {
66 self.variant(ASOE::Enabled)
67 }
68}
69#[cfg_attr(feature = "defmt", derive(defmt::Format))]
73#[derive(Clone, Copy, Debug, PartialEq, Eq)]
74pub enum ASOS {
75 Alarm = 0,
77 Second = 1,
79}
80impl From<ASOS> for bool {
81 #[inline(always)]
82 fn from(variant: ASOS) -> Self {
83 variant as u8 != 0
84 }
85}
86pub type ASOS_R = crate::BitReader<ASOS>;
88impl ASOS_R {
89 #[inline(always)]
91 pub const fn variant(&self) -> ASOS {
92 match self.bits {
93 false => ASOS::Alarm,
94 true => ASOS::Second,
95 }
96 }
97 #[inline(always)]
99 pub fn is_alarm(&self) -> bool {
100 *self == ASOS::Alarm
101 }
102 #[inline(always)]
104 pub fn is_second(&self) -> bool {
105 *self == ASOS::Second
106 }
107}
108pub type ASOS_W<'a, REG> = crate::BitWriter<'a, REG, ASOS>;
110impl<'a, REG> ASOS_W<'a, REG>
111where
112 REG: crate::Writable + crate::RegisterSpec,
113{
114 #[inline(always)]
116 pub fn alarm(self) -> &'a mut crate::W<REG> {
117 self.variant(ASOS::Alarm)
118 }
119 #[inline(always)]
121 pub fn second(self) -> &'a mut crate::W<REG> {
122 self.variant(ASOS::Second)
123 }
124}
125impl R {
126 #[inline(always)]
128 pub fn cal(&self) -> CAL_R {
129 CAL_R::new((self.bits & 0x7f) as u8)
130 }
131 #[inline(always)]
133 pub fn cco(&self) -> CCO_R {
134 CCO_R::new(((self.bits >> 7) & 1) != 0)
135 }
136 #[inline(always)]
138 pub fn asoe(&self) -> ASOE_R {
139 ASOE_R::new(((self.bits >> 8) & 1) != 0)
140 }
141 #[inline(always)]
143 pub fn asos(&self) -> ASOS_R {
144 ASOS_R::new(((self.bits >> 9) & 1) != 0)
145 }
146}
147impl core::fmt::Debug for R {
148 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
149 f.debug_struct("RTCCR")
150 .field("cal", &self.cal())
151 .field("cco", &self.cco())
152 .field("asoe", &self.asoe())
153 .field("asos", &self.asos())
154 .finish()
155 }
156}
157impl W {
158 #[inline(always)]
160 pub fn cal(&mut self) -> CAL_W<RTCCRrs> {
161 CAL_W::new(self, 0)
162 }
163 #[inline(always)]
165 pub fn cco(&mut self) -> CCO_W<RTCCRrs> {
166 CCO_W::new(self, 7)
167 }
168 #[inline(always)]
170 pub fn asoe(&mut self) -> ASOE_W<RTCCRrs> {
171 ASOE_W::new(self, 8)
172 }
173 #[inline(always)]
175 pub fn asos(&mut self) -> ASOS_W<RTCCRrs> {
176 ASOS_W::new(self, 9)
177 }
178}
179pub struct RTCCRrs;
185impl crate::RegisterSpec for RTCCRrs {
186 type Ux = u32;
187}
188impl crate::Readable for RTCCRrs {}
190impl crate::Writable for RTCCRrs {
192 type Safety = crate::Unsafe;
193}
194impl crate::Resettable for RTCCRrs {}