stm32f1/stm32f101/rtc/
crh.rs1#[doc = "Register `CRH` reader"]
2pub struct R(crate::R<CRH_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CRH_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CRH_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CRH_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CRH` writer"]
17pub struct W(crate::W<CRH_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CRH_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<CRH_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CRH_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Second interrupt Enable\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum SECIE_A {
40 #[doc = "0: Second interrupt is masked"]
41 Disabled = 0,
42 #[doc = "1: Second interrupt is enabled"]
43 Enabled = 1,
44}
45impl From<SECIE_A> for bool {
46 #[inline(always)]
47 fn from(variant: SECIE_A) -> Self {
48 variant as u8 != 0
49 }
50}
51#[doc = "Field `SECIE` reader - Second interrupt Enable"]
52pub type SECIE_R = crate::BitReader<SECIE_A>;
53impl SECIE_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> SECIE_A {
57 match self.bits {
58 false => SECIE_A::Disabled,
59 true => SECIE_A::Enabled,
60 }
61 }
62 #[doc = "Checks if the value of the field is `Disabled`"]
63 #[inline(always)]
64 pub fn is_disabled(&self) -> bool {
65 *self == SECIE_A::Disabled
66 }
67 #[doc = "Checks if the value of the field is `Enabled`"]
68 #[inline(always)]
69 pub fn is_enabled(&self) -> bool {
70 *self == SECIE_A::Enabled
71 }
72}
73#[doc = "Field `SECIE` writer - Second interrupt Enable"]
74pub type SECIE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CRH_SPEC, SECIE_A, O>;
75impl<'a, const O: u8> SECIE_W<'a, O> {
76 #[doc = "Second interrupt is masked"]
77 #[inline(always)]
78 pub fn disabled(self) -> &'a mut W {
79 self.variant(SECIE_A::Disabled)
80 }
81 #[doc = "Second interrupt is enabled"]
82 #[inline(always)]
83 pub fn enabled(self) -> &'a mut W {
84 self.variant(SECIE_A::Enabled)
85 }
86}
87#[doc = "Alarm interrupt Enable\n\nValue on reset: 0"]
88#[derive(Clone, Copy, Debug, PartialEq)]
89pub enum ALRIE_A {
90 #[doc = "0: Alarm interrupt is masked"]
91 Disabled = 0,
92 #[doc = "1: Alarm interrupt is enabled"]
93 Enabled = 1,
94}
95impl From<ALRIE_A> for bool {
96 #[inline(always)]
97 fn from(variant: ALRIE_A) -> Self {
98 variant as u8 != 0
99 }
100}
101#[doc = "Field `ALRIE` reader - Alarm interrupt Enable"]
102pub type ALRIE_R = crate::BitReader<ALRIE_A>;
103impl ALRIE_R {
104 #[doc = "Get enumerated values variant"]
105 #[inline(always)]
106 pub fn variant(&self) -> ALRIE_A {
107 match self.bits {
108 false => ALRIE_A::Disabled,
109 true => ALRIE_A::Enabled,
110 }
111 }
112 #[doc = "Checks if the value of the field is `Disabled`"]
113 #[inline(always)]
114 pub fn is_disabled(&self) -> bool {
115 *self == ALRIE_A::Disabled
116 }
117 #[doc = "Checks if the value of the field is `Enabled`"]
118 #[inline(always)]
119 pub fn is_enabled(&self) -> bool {
120 *self == ALRIE_A::Enabled
121 }
122}
123#[doc = "Field `ALRIE` writer - Alarm interrupt Enable"]
124pub type ALRIE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CRH_SPEC, ALRIE_A, O>;
125impl<'a, const O: u8> ALRIE_W<'a, O> {
126 #[doc = "Alarm interrupt is masked"]
127 #[inline(always)]
128 pub fn disabled(self) -> &'a mut W {
129 self.variant(ALRIE_A::Disabled)
130 }
131 #[doc = "Alarm interrupt is enabled"]
132 #[inline(always)]
133 pub fn enabled(self) -> &'a mut W {
134 self.variant(ALRIE_A::Enabled)
135 }
136}
137#[doc = "Overflow interrupt Enable\n\nValue on reset: 0"]
138#[derive(Clone, Copy, Debug, PartialEq)]
139pub enum OWIE_A {
140 #[doc = "0: Overflow interrupt is masked"]
141 Disabled = 0,
142 #[doc = "1: Overflow interrupt is enabled"]
143 Enabled = 1,
144}
145impl From<OWIE_A> for bool {
146 #[inline(always)]
147 fn from(variant: OWIE_A) -> Self {
148 variant as u8 != 0
149 }
150}
151#[doc = "Field `OWIE` reader - Overflow interrupt Enable"]
152pub type OWIE_R = crate::BitReader<OWIE_A>;
153impl OWIE_R {
154 #[doc = "Get enumerated values variant"]
155 #[inline(always)]
156 pub fn variant(&self) -> OWIE_A {
157 match self.bits {
158 false => OWIE_A::Disabled,
159 true => OWIE_A::Enabled,
160 }
161 }
162 #[doc = "Checks if the value of the field is `Disabled`"]
163 #[inline(always)]
164 pub fn is_disabled(&self) -> bool {
165 *self == OWIE_A::Disabled
166 }
167 #[doc = "Checks if the value of the field is `Enabled`"]
168 #[inline(always)]
169 pub fn is_enabled(&self) -> bool {
170 *self == OWIE_A::Enabled
171 }
172}
173#[doc = "Field `OWIE` writer - Overflow interrupt Enable"]
174pub type OWIE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CRH_SPEC, OWIE_A, O>;
175impl<'a, const O: u8> OWIE_W<'a, O> {
176 #[doc = "Overflow interrupt is masked"]
177 #[inline(always)]
178 pub fn disabled(self) -> &'a mut W {
179 self.variant(OWIE_A::Disabled)
180 }
181 #[doc = "Overflow interrupt is enabled"]
182 #[inline(always)]
183 pub fn enabled(self) -> &'a mut W {
184 self.variant(OWIE_A::Enabled)
185 }
186}
187impl R {
188 #[doc = "Bit 0 - Second interrupt Enable"]
189 #[inline(always)]
190 pub fn secie(&self) -> SECIE_R {
191 SECIE_R::new((self.bits & 1) != 0)
192 }
193 #[doc = "Bit 1 - Alarm interrupt Enable"]
194 #[inline(always)]
195 pub fn alrie(&self) -> ALRIE_R {
196 ALRIE_R::new(((self.bits >> 1) & 1) != 0)
197 }
198 #[doc = "Bit 2 - Overflow interrupt Enable"]
199 #[inline(always)]
200 pub fn owie(&self) -> OWIE_R {
201 OWIE_R::new(((self.bits >> 2) & 1) != 0)
202 }
203}
204impl W {
205 #[doc = "Bit 0 - Second interrupt Enable"]
206 #[inline(always)]
207 pub fn secie(&mut self) -> SECIE_W<0> {
208 SECIE_W::new(self)
209 }
210 #[doc = "Bit 1 - Alarm interrupt Enable"]
211 #[inline(always)]
212 pub fn alrie(&mut self) -> ALRIE_W<1> {
213 ALRIE_W::new(self)
214 }
215 #[doc = "Bit 2 - Overflow interrupt Enable"]
216 #[inline(always)]
217 pub fn owie(&mut self) -> OWIE_W<2> {
218 OWIE_W::new(self)
219 }
220 #[doc = "Writes raw bits to the register."]
221 #[inline(always)]
222 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
223 self.0.bits(bits);
224 self
225 }
226}
227#[doc = "RTC Control Register High\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 [crh](index.html) module"]
228pub struct CRH_SPEC;
229impl crate::RegisterSpec for CRH_SPEC {
230 type Ux = u32;
231}
232#[doc = "`read()` method returns [crh::R](R) reader structure"]
233impl crate::Readable for CRH_SPEC {
234 type Reader = R;
235}
236#[doc = "`write(|w| ..)` method takes [crh::W](W) writer structure"]
237impl crate::Writable for CRH_SPEC {
238 type Writer = W;
239}
240#[doc = "`reset()` method sets CRH to value 0"]
241impl crate::Resettable for CRH_SPEC {
242 #[inline(always)]
243 fn reset_value() -> Self::Ux {
244 0
245 }
246}