efm32hg309_pac/cmu/
lfapresc0.rs1#[doc = "Register `LFAPRESC0` reader"]
2pub struct R(crate::R<LFAPRESC0_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<LFAPRESC0_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<LFAPRESC0_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<LFAPRESC0_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `LFAPRESC0` writer"]
17pub struct W(crate::W<LFAPRESC0_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<LFAPRESC0_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<LFAPRESC0_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<LFAPRESC0_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Real-Time Counter Prescaler\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum RTC_A {
41 #[doc = "0: LFACLKRTC = LFACLK"]
42 DIV1 = 0,
43 #[doc = "1: LFACLKRTC = LFACLK/2"]
44 DIV2 = 1,
45 #[doc = "2: LFACLKRTC = LFACLK/4"]
46 DIV4 = 2,
47 #[doc = "3: LFACLKRTC = LFACLK/8"]
48 DIV8 = 3,
49 #[doc = "4: LFACLKRTC = LFACLK/16"]
50 DIV16 = 4,
51 #[doc = "5: LFACLKRTC = LFACLK/32"]
52 DIV32 = 5,
53 #[doc = "6: LFACLKRTC = LFACLK/64"]
54 DIV64 = 6,
55 #[doc = "7: LFACLKRTC = LFACLK/128"]
56 DIV128 = 7,
57 #[doc = "8: LFACLKRTC = LFACLK/256"]
58 DIV256 = 8,
59 #[doc = "9: LFACLKRTC = LFACLK/512"]
60 DIV512 = 9,
61 #[doc = "10: LFACLKRTC = LFACLK/1024"]
62 DIV1024 = 10,
63 #[doc = "11: LFACLKRTC = LFACLK/2048"]
64 DIV2048 = 11,
65 #[doc = "12: LFACLKRTC = LFACLK/4096"]
66 DIV4096 = 12,
67 #[doc = "13: LFACLKRTC = LFACLK/8192"]
68 DIV8192 = 13,
69 #[doc = "14: LFACLKRTC = LFACLK/16384"]
70 DIV16384 = 14,
71 #[doc = "15: LFACLKRTC = LFACLK/32768"]
72 DIV32768 = 15,
73}
74impl From<RTC_A> for u8 {
75 #[inline(always)]
76 fn from(variant: RTC_A) -> Self {
77 variant as _
78 }
79}
80#[doc = "Field `RTC` reader - Real-Time Counter Prescaler"]
81pub type RTC_R = crate::FieldReader<u8, RTC_A>;
82impl RTC_R {
83 #[doc = "Get enumerated values variant"]
84 #[inline(always)]
85 pub fn variant(&self) -> RTC_A {
86 match self.bits {
87 0 => RTC_A::DIV1,
88 1 => RTC_A::DIV2,
89 2 => RTC_A::DIV4,
90 3 => RTC_A::DIV8,
91 4 => RTC_A::DIV16,
92 5 => RTC_A::DIV32,
93 6 => RTC_A::DIV64,
94 7 => RTC_A::DIV128,
95 8 => RTC_A::DIV256,
96 9 => RTC_A::DIV512,
97 10 => RTC_A::DIV1024,
98 11 => RTC_A::DIV2048,
99 12 => RTC_A::DIV4096,
100 13 => RTC_A::DIV8192,
101 14 => RTC_A::DIV16384,
102 15 => RTC_A::DIV32768,
103 _ => unreachable!(),
104 }
105 }
106 #[doc = "Checks if the value of the field is `DIV1`"]
107 #[inline(always)]
108 pub fn is_div1(&self) -> bool {
109 *self == RTC_A::DIV1
110 }
111 #[doc = "Checks if the value of the field is `DIV2`"]
112 #[inline(always)]
113 pub fn is_div2(&self) -> bool {
114 *self == RTC_A::DIV2
115 }
116 #[doc = "Checks if the value of the field is `DIV4`"]
117 #[inline(always)]
118 pub fn is_div4(&self) -> bool {
119 *self == RTC_A::DIV4
120 }
121 #[doc = "Checks if the value of the field is `DIV8`"]
122 #[inline(always)]
123 pub fn is_div8(&self) -> bool {
124 *self == RTC_A::DIV8
125 }
126 #[doc = "Checks if the value of the field is `DIV16`"]
127 #[inline(always)]
128 pub fn is_div16(&self) -> bool {
129 *self == RTC_A::DIV16
130 }
131 #[doc = "Checks if the value of the field is `DIV32`"]
132 #[inline(always)]
133 pub fn is_div32(&self) -> bool {
134 *self == RTC_A::DIV32
135 }
136 #[doc = "Checks if the value of the field is `DIV64`"]
137 #[inline(always)]
138 pub fn is_div64(&self) -> bool {
139 *self == RTC_A::DIV64
140 }
141 #[doc = "Checks if the value of the field is `DIV128`"]
142 #[inline(always)]
143 pub fn is_div128(&self) -> bool {
144 *self == RTC_A::DIV128
145 }
146 #[doc = "Checks if the value of the field is `DIV256`"]
147 #[inline(always)]
148 pub fn is_div256(&self) -> bool {
149 *self == RTC_A::DIV256
150 }
151 #[doc = "Checks if the value of the field is `DIV512`"]
152 #[inline(always)]
153 pub fn is_div512(&self) -> bool {
154 *self == RTC_A::DIV512
155 }
156 #[doc = "Checks if the value of the field is `DIV1024`"]
157 #[inline(always)]
158 pub fn is_div1024(&self) -> bool {
159 *self == RTC_A::DIV1024
160 }
161 #[doc = "Checks if the value of the field is `DIV2048`"]
162 #[inline(always)]
163 pub fn is_div2048(&self) -> bool {
164 *self == RTC_A::DIV2048
165 }
166 #[doc = "Checks if the value of the field is `DIV4096`"]
167 #[inline(always)]
168 pub fn is_div4096(&self) -> bool {
169 *self == RTC_A::DIV4096
170 }
171 #[doc = "Checks if the value of the field is `DIV8192`"]
172 #[inline(always)]
173 pub fn is_div8192(&self) -> bool {
174 *self == RTC_A::DIV8192
175 }
176 #[doc = "Checks if the value of the field is `DIV16384`"]
177 #[inline(always)]
178 pub fn is_div16384(&self) -> bool {
179 *self == RTC_A::DIV16384
180 }
181 #[doc = "Checks if the value of the field is `DIV32768`"]
182 #[inline(always)]
183 pub fn is_div32768(&self) -> bool {
184 *self == RTC_A::DIV32768
185 }
186}
187#[doc = "Field `RTC` writer - Real-Time Counter Prescaler"]
188pub type RTC_W<'a> = crate::FieldWriterSafe<'a, u32, LFAPRESC0_SPEC, u8, RTC_A, 4, 0>;
189impl<'a> RTC_W<'a> {
190 #[doc = "LFACLKRTC = LFACLK"]
191 #[inline(always)]
192 pub fn div1(self) -> &'a mut W {
193 self.variant(RTC_A::DIV1)
194 }
195 #[doc = "LFACLKRTC = LFACLK/2"]
196 #[inline(always)]
197 pub fn div2(self) -> &'a mut W {
198 self.variant(RTC_A::DIV2)
199 }
200 #[doc = "LFACLKRTC = LFACLK/4"]
201 #[inline(always)]
202 pub fn div4(self) -> &'a mut W {
203 self.variant(RTC_A::DIV4)
204 }
205 #[doc = "LFACLKRTC = LFACLK/8"]
206 #[inline(always)]
207 pub fn div8(self) -> &'a mut W {
208 self.variant(RTC_A::DIV8)
209 }
210 #[doc = "LFACLKRTC = LFACLK/16"]
211 #[inline(always)]
212 pub fn div16(self) -> &'a mut W {
213 self.variant(RTC_A::DIV16)
214 }
215 #[doc = "LFACLKRTC = LFACLK/32"]
216 #[inline(always)]
217 pub fn div32(self) -> &'a mut W {
218 self.variant(RTC_A::DIV32)
219 }
220 #[doc = "LFACLKRTC = LFACLK/64"]
221 #[inline(always)]
222 pub fn div64(self) -> &'a mut W {
223 self.variant(RTC_A::DIV64)
224 }
225 #[doc = "LFACLKRTC = LFACLK/128"]
226 #[inline(always)]
227 pub fn div128(self) -> &'a mut W {
228 self.variant(RTC_A::DIV128)
229 }
230 #[doc = "LFACLKRTC = LFACLK/256"]
231 #[inline(always)]
232 pub fn div256(self) -> &'a mut W {
233 self.variant(RTC_A::DIV256)
234 }
235 #[doc = "LFACLKRTC = LFACLK/512"]
236 #[inline(always)]
237 pub fn div512(self) -> &'a mut W {
238 self.variant(RTC_A::DIV512)
239 }
240 #[doc = "LFACLKRTC = LFACLK/1024"]
241 #[inline(always)]
242 pub fn div1024(self) -> &'a mut W {
243 self.variant(RTC_A::DIV1024)
244 }
245 #[doc = "LFACLKRTC = LFACLK/2048"]
246 #[inline(always)]
247 pub fn div2048(self) -> &'a mut W {
248 self.variant(RTC_A::DIV2048)
249 }
250 #[doc = "LFACLKRTC = LFACLK/4096"]
251 #[inline(always)]
252 pub fn div4096(self) -> &'a mut W {
253 self.variant(RTC_A::DIV4096)
254 }
255 #[doc = "LFACLKRTC = LFACLK/8192"]
256 #[inline(always)]
257 pub fn div8192(self) -> &'a mut W {
258 self.variant(RTC_A::DIV8192)
259 }
260 #[doc = "LFACLKRTC = LFACLK/16384"]
261 #[inline(always)]
262 pub fn div16384(self) -> &'a mut W {
263 self.variant(RTC_A::DIV16384)
264 }
265 #[doc = "LFACLKRTC = LFACLK/32768"]
266 #[inline(always)]
267 pub fn div32768(self) -> &'a mut W {
268 self.variant(RTC_A::DIV32768)
269 }
270}
271impl R {
272 #[doc = "Bits 0:3 - Real-Time Counter Prescaler"]
273 #[inline(always)]
274 pub fn rtc(&self) -> RTC_R {
275 RTC_R::new((self.bits & 0x0f) as u8)
276 }
277}
278impl W {
279 #[doc = "Bits 0:3 - Real-Time Counter Prescaler"]
280 #[inline(always)]
281 pub fn rtc(&mut self) -> RTC_W {
282 RTC_W::new(self)
283 }
284 #[doc = "Writes raw bits to the register."]
285 #[inline(always)]
286 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
287 self.0.bits(bits);
288 self
289 }
290}
291#[doc = "Low Frequency A Prescaler Register 0 (Async Reg)\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 [lfapresc0](index.html) module"]
292pub struct LFAPRESC0_SPEC;
293impl crate::RegisterSpec for LFAPRESC0_SPEC {
294 type Ux = u32;
295}
296#[doc = "`read()` method returns [lfapresc0::R](R) reader structure"]
297impl crate::Readable for LFAPRESC0_SPEC {
298 type Reader = R;
299}
300#[doc = "`write(|w| ..)` method takes [lfapresc0::W](W) writer structure"]
301impl crate::Writable for LFAPRESC0_SPEC {
302 type Writer = W;
303}
304#[doc = "`reset()` method sets LFAPRESC0 to value 0"]
305impl crate::Resettable for LFAPRESC0_SPEC {
306 #[inline(always)]
307 fn reset_value() -> Self::Ux {
308 0
309 }
310}