efm32jg12b_pac/efm32jg12b500/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 = "Field `LETIMER0` reader - Low Energy Timer 0 Prescaler"]
38pub type LETIMER0_R = crate::FieldReader<u8, LETIMER0_A>;
39#[doc = "Low Energy Timer 0 Prescaler\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum LETIMER0_A {
43 #[doc = "0: LFACLKLETIMER0 = LFACLK"]
44 DIV1 = 0,
45 #[doc = "1: LFACLKLETIMER0 = LFACLK/2"]
46 DIV2 = 1,
47 #[doc = "2: LFACLKLETIMER0 = LFACLK/4"]
48 DIV4 = 2,
49 #[doc = "3: LFACLKLETIMER0 = LFACLK/8"]
50 DIV8 = 3,
51 #[doc = "4: LFACLKLETIMER0 = LFACLK/16"]
52 DIV16 = 4,
53 #[doc = "5: LFACLKLETIMER0 = LFACLK/32"]
54 DIV32 = 5,
55 #[doc = "6: LFACLKLETIMER0 = LFACLK/64"]
56 DIV64 = 6,
57 #[doc = "7: LFACLKLETIMER0 = LFACLK/128"]
58 DIV128 = 7,
59 #[doc = "8: LFACLKLETIMER0 = LFACLK/256"]
60 DIV256 = 8,
61 #[doc = "9: LFACLKLETIMER0 = LFACLK/512"]
62 DIV512 = 9,
63 #[doc = "10: LFACLKLETIMER0 = LFACLK/1024"]
64 DIV1024 = 10,
65 #[doc = "11: LFACLKLETIMER0 = LFACLK/2048"]
66 DIV2048 = 11,
67 #[doc = "12: LFACLKLETIMER0 = LFACLK/4096"]
68 DIV4096 = 12,
69 #[doc = "13: LFACLKLETIMER0 = LFACLK/8192"]
70 DIV8192 = 13,
71 #[doc = "14: LFACLKLETIMER0 = LFACLK/16384"]
72 DIV16384 = 14,
73 #[doc = "15: LFACLKLETIMER0 = LFACLK/32768"]
74 DIV32768 = 15,
75}
76impl From<LETIMER0_A> for u8 {
77 #[inline(always)]
78 fn from(variant: LETIMER0_A) -> Self {
79 variant as _
80 }
81}
82impl LETIMER0_R {
83 #[doc = "Get enumerated values variant"]
84 #[inline(always)]
85 pub fn variant(&self) -> LETIMER0_A {
86 match self.bits {
87 0 => LETIMER0_A::DIV1,
88 1 => LETIMER0_A::DIV2,
89 2 => LETIMER0_A::DIV4,
90 3 => LETIMER0_A::DIV8,
91 4 => LETIMER0_A::DIV16,
92 5 => LETIMER0_A::DIV32,
93 6 => LETIMER0_A::DIV64,
94 7 => LETIMER0_A::DIV128,
95 8 => LETIMER0_A::DIV256,
96 9 => LETIMER0_A::DIV512,
97 10 => LETIMER0_A::DIV1024,
98 11 => LETIMER0_A::DIV2048,
99 12 => LETIMER0_A::DIV4096,
100 13 => LETIMER0_A::DIV8192,
101 14 => LETIMER0_A::DIV16384,
102 15 => LETIMER0_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 == LETIMER0_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 == LETIMER0_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 == LETIMER0_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 == LETIMER0_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 == LETIMER0_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 == LETIMER0_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 == LETIMER0_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 == LETIMER0_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 == LETIMER0_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 == LETIMER0_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 == LETIMER0_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 == LETIMER0_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 == LETIMER0_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 == LETIMER0_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 == LETIMER0_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 == LETIMER0_A::DIV32768
185 }
186}
187#[doc = "Field `LETIMER0` writer - Low Energy Timer 0 Prescaler"]
188pub type LETIMER0_W<'a, const O: u8> =
189 crate::FieldWriterSafe<'a, u32, LFAPRESC0_SPEC, u8, LETIMER0_A, 4, O>;
190impl<'a, const O: u8> LETIMER0_W<'a, O> {
191 #[doc = "LFACLKLETIMER0 = LFACLK"]
192 #[inline(always)]
193 pub fn div1(self) -> &'a mut W {
194 self.variant(LETIMER0_A::DIV1)
195 }
196 #[doc = "LFACLKLETIMER0 = LFACLK/2"]
197 #[inline(always)]
198 pub fn div2(self) -> &'a mut W {
199 self.variant(LETIMER0_A::DIV2)
200 }
201 #[doc = "LFACLKLETIMER0 = LFACLK/4"]
202 #[inline(always)]
203 pub fn div4(self) -> &'a mut W {
204 self.variant(LETIMER0_A::DIV4)
205 }
206 #[doc = "LFACLKLETIMER0 = LFACLK/8"]
207 #[inline(always)]
208 pub fn div8(self) -> &'a mut W {
209 self.variant(LETIMER0_A::DIV8)
210 }
211 #[doc = "LFACLKLETIMER0 = LFACLK/16"]
212 #[inline(always)]
213 pub fn div16(self) -> &'a mut W {
214 self.variant(LETIMER0_A::DIV16)
215 }
216 #[doc = "LFACLKLETIMER0 = LFACLK/32"]
217 #[inline(always)]
218 pub fn div32(self) -> &'a mut W {
219 self.variant(LETIMER0_A::DIV32)
220 }
221 #[doc = "LFACLKLETIMER0 = LFACLK/64"]
222 #[inline(always)]
223 pub fn div64(self) -> &'a mut W {
224 self.variant(LETIMER0_A::DIV64)
225 }
226 #[doc = "LFACLKLETIMER0 = LFACLK/128"]
227 #[inline(always)]
228 pub fn div128(self) -> &'a mut W {
229 self.variant(LETIMER0_A::DIV128)
230 }
231 #[doc = "LFACLKLETIMER0 = LFACLK/256"]
232 #[inline(always)]
233 pub fn div256(self) -> &'a mut W {
234 self.variant(LETIMER0_A::DIV256)
235 }
236 #[doc = "LFACLKLETIMER0 = LFACLK/512"]
237 #[inline(always)]
238 pub fn div512(self) -> &'a mut W {
239 self.variant(LETIMER0_A::DIV512)
240 }
241 #[doc = "LFACLKLETIMER0 = LFACLK/1024"]
242 #[inline(always)]
243 pub fn div1024(self) -> &'a mut W {
244 self.variant(LETIMER0_A::DIV1024)
245 }
246 #[doc = "LFACLKLETIMER0 = LFACLK/2048"]
247 #[inline(always)]
248 pub fn div2048(self) -> &'a mut W {
249 self.variant(LETIMER0_A::DIV2048)
250 }
251 #[doc = "LFACLKLETIMER0 = LFACLK/4096"]
252 #[inline(always)]
253 pub fn div4096(self) -> &'a mut W {
254 self.variant(LETIMER0_A::DIV4096)
255 }
256 #[doc = "LFACLKLETIMER0 = LFACLK/8192"]
257 #[inline(always)]
258 pub fn div8192(self) -> &'a mut W {
259 self.variant(LETIMER0_A::DIV8192)
260 }
261 #[doc = "LFACLKLETIMER0 = LFACLK/16384"]
262 #[inline(always)]
263 pub fn div16384(self) -> &'a mut W {
264 self.variant(LETIMER0_A::DIV16384)
265 }
266 #[doc = "LFACLKLETIMER0 = LFACLK/32768"]
267 #[inline(always)]
268 pub fn div32768(self) -> &'a mut W {
269 self.variant(LETIMER0_A::DIV32768)
270 }
271}
272#[doc = "Field `LESENSE` reader - Low Energy Sensor Interface Prescaler"]
273pub type LESENSE_R = crate::FieldReader<u8, LESENSE_A>;
274#[doc = "Low Energy Sensor Interface Prescaler\n\nValue on reset: 0"]
275#[derive(Clone, Copy, Debug, PartialEq, Eq)]
276#[repr(u8)]
277pub enum LESENSE_A {
278 #[doc = "0: LFACLKLESENSE = LFACLK"]
279 DIV1 = 0,
280 #[doc = "1: LFACLKLESENSE = LFACLK/2"]
281 DIV2 = 1,
282 #[doc = "2: LFACLKLESENSE = LFACLK/4"]
283 DIV4 = 2,
284 #[doc = "3: LFACLKLESENSE = LFACLK/8"]
285 DIV8 = 3,
286}
287impl From<LESENSE_A> for u8 {
288 #[inline(always)]
289 fn from(variant: LESENSE_A) -> Self {
290 variant as _
291 }
292}
293impl LESENSE_R {
294 #[doc = "Get enumerated values variant"]
295 #[inline(always)]
296 pub fn variant(&self) -> LESENSE_A {
297 match self.bits {
298 0 => LESENSE_A::DIV1,
299 1 => LESENSE_A::DIV2,
300 2 => LESENSE_A::DIV4,
301 3 => LESENSE_A::DIV8,
302 _ => unreachable!(),
303 }
304 }
305 #[doc = "Checks if the value of the field is `DIV1`"]
306 #[inline(always)]
307 pub fn is_div1(&self) -> bool {
308 *self == LESENSE_A::DIV1
309 }
310 #[doc = "Checks if the value of the field is `DIV2`"]
311 #[inline(always)]
312 pub fn is_div2(&self) -> bool {
313 *self == LESENSE_A::DIV2
314 }
315 #[doc = "Checks if the value of the field is `DIV4`"]
316 #[inline(always)]
317 pub fn is_div4(&self) -> bool {
318 *self == LESENSE_A::DIV4
319 }
320 #[doc = "Checks if the value of the field is `DIV8`"]
321 #[inline(always)]
322 pub fn is_div8(&self) -> bool {
323 *self == LESENSE_A::DIV8
324 }
325}
326#[doc = "Field `LESENSE` writer - Low Energy Sensor Interface Prescaler"]
327pub type LESENSE_W<'a, const O: u8> =
328 crate::FieldWriterSafe<'a, u32, LFAPRESC0_SPEC, u8, LESENSE_A, 2, O>;
329impl<'a, const O: u8> LESENSE_W<'a, O> {
330 #[doc = "LFACLKLESENSE = LFACLK"]
331 #[inline(always)]
332 pub fn div1(self) -> &'a mut W {
333 self.variant(LESENSE_A::DIV1)
334 }
335 #[doc = "LFACLKLESENSE = LFACLK/2"]
336 #[inline(always)]
337 pub fn div2(self) -> &'a mut W {
338 self.variant(LESENSE_A::DIV2)
339 }
340 #[doc = "LFACLKLESENSE = LFACLK/4"]
341 #[inline(always)]
342 pub fn div4(self) -> &'a mut W {
343 self.variant(LESENSE_A::DIV4)
344 }
345 #[doc = "LFACLKLESENSE = LFACLK/8"]
346 #[inline(always)]
347 pub fn div8(self) -> &'a mut W {
348 self.variant(LESENSE_A::DIV8)
349 }
350}
351impl R {
352 #[doc = "Bits 0:3 - Low Energy Timer 0 Prescaler"]
353 #[inline(always)]
354 pub fn letimer0(&self) -> LETIMER0_R {
355 LETIMER0_R::new((self.bits & 0x0f) as u8)
356 }
357 #[doc = "Bits 4:5 - Low Energy Sensor Interface Prescaler"]
358 #[inline(always)]
359 pub fn lesense(&self) -> LESENSE_R {
360 LESENSE_R::new(((self.bits >> 4) & 3) as u8)
361 }
362}
363impl W {
364 #[doc = "Bits 0:3 - Low Energy Timer 0 Prescaler"]
365 #[inline(always)]
366 #[must_use]
367 pub fn letimer0(&mut self) -> LETIMER0_W<0> {
368 LETIMER0_W::new(self)
369 }
370 #[doc = "Bits 4:5 - Low Energy Sensor Interface Prescaler"]
371 #[inline(always)]
372 #[must_use]
373 pub fn lesense(&mut self) -> LESENSE_W<4> {
374 LESENSE_W::new(self)
375 }
376 #[doc = "Writes raw bits to the register."]
377 #[inline(always)]
378 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
379 self.0.bits(bits);
380 self
381 }
382}
383#[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"]
384pub struct LFAPRESC0_SPEC;
385impl crate::RegisterSpec for LFAPRESC0_SPEC {
386 type Ux = u32;
387}
388#[doc = "`read()` method returns [lfapresc0::R](R) reader structure"]
389impl crate::Readable for LFAPRESC0_SPEC {
390 type Reader = R;
391}
392#[doc = "`write(|w| ..)` method takes [lfapresc0::W](W) writer structure"]
393impl crate::Writable for LFAPRESC0_SPEC {
394 type Writer = W;
395 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
396 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
397}
398#[doc = "`reset()` method sets LFAPRESC0 to value 0"]
399impl crate::Resettable for LFAPRESC0_SPEC {
400 const RESET_VALUE: Self::Ux = 0;
401}