efm32tg11b_pac/efm32tg11b540/cmu/
lfapresc0.rs

1#[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 `LESENSE` reader - Low Energy Sensor Interface Prescaler"]
38pub type LESENSE_R = crate::FieldReader<u8, LESENSE_A>;
39#[doc = "Low Energy Sensor Interface Prescaler\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum LESENSE_A {
43    #[doc = "0: LFACLKLESENSE = LFACLK"]
44    DIV1 = 0,
45    #[doc = "1: LFACLKLESENSE = LFACLK/2"]
46    DIV2 = 1,
47    #[doc = "2: LFACLKLESENSE = LFACLK/4"]
48    DIV4 = 2,
49    #[doc = "3: LFACLKLESENSE = LFACLK/8"]
50    DIV8 = 3,
51}
52impl From<LESENSE_A> for u8 {
53    #[inline(always)]
54    fn from(variant: LESENSE_A) -> Self {
55        variant as _
56    }
57}
58impl LESENSE_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> LESENSE_A {
62        match self.bits {
63            0 => LESENSE_A::DIV1,
64            1 => LESENSE_A::DIV2,
65            2 => LESENSE_A::DIV4,
66            3 => LESENSE_A::DIV8,
67            _ => unreachable!(),
68        }
69    }
70    #[doc = "Checks if the value of the field is `DIV1`"]
71    #[inline(always)]
72    pub fn is_div1(&self) -> bool {
73        *self == LESENSE_A::DIV1
74    }
75    #[doc = "Checks if the value of the field is `DIV2`"]
76    #[inline(always)]
77    pub fn is_div2(&self) -> bool {
78        *self == LESENSE_A::DIV2
79    }
80    #[doc = "Checks if the value of the field is `DIV4`"]
81    #[inline(always)]
82    pub fn is_div4(&self) -> bool {
83        *self == LESENSE_A::DIV4
84    }
85    #[doc = "Checks if the value of the field is `DIV8`"]
86    #[inline(always)]
87    pub fn is_div8(&self) -> bool {
88        *self == LESENSE_A::DIV8
89    }
90}
91#[doc = "Field `LESENSE` writer - Low Energy Sensor Interface Prescaler"]
92pub type LESENSE_W<'a, const O: u8> =
93    crate::FieldWriterSafe<'a, u32, LFAPRESC0_SPEC, u8, LESENSE_A, 2, O>;
94impl<'a, const O: u8> LESENSE_W<'a, O> {
95    #[doc = "LFACLKLESENSE = LFACLK"]
96    #[inline(always)]
97    pub fn div1(self) -> &'a mut W {
98        self.variant(LESENSE_A::DIV1)
99    }
100    #[doc = "LFACLKLESENSE = LFACLK/2"]
101    #[inline(always)]
102    pub fn div2(self) -> &'a mut W {
103        self.variant(LESENSE_A::DIV2)
104    }
105    #[doc = "LFACLKLESENSE = LFACLK/4"]
106    #[inline(always)]
107    pub fn div4(self) -> &'a mut W {
108        self.variant(LESENSE_A::DIV4)
109    }
110    #[doc = "LFACLKLESENSE = LFACLK/8"]
111    #[inline(always)]
112    pub fn div8(self) -> &'a mut W {
113        self.variant(LESENSE_A::DIV8)
114    }
115}
116#[doc = "Field `LETIMER0` reader - Low Energy Timer 0 Prescaler"]
117pub type LETIMER0_R = crate::FieldReader<u8, LETIMER0_A>;
118#[doc = "Low Energy Timer 0 Prescaler\n\nValue on reset: 0"]
119#[derive(Clone, Copy, Debug, PartialEq, Eq)]
120#[repr(u8)]
121pub enum LETIMER0_A {
122    #[doc = "0: LFACLKLETIMER0 = LFACLK"]
123    DIV1 = 0,
124    #[doc = "1: LFACLKLETIMER0 = LFACLK/2"]
125    DIV2 = 1,
126    #[doc = "2: LFACLKLETIMER0 = LFACLK/4"]
127    DIV4 = 2,
128    #[doc = "3: LFACLKLETIMER0 = LFACLK/8"]
129    DIV8 = 3,
130    #[doc = "4: LFACLKLETIMER0 = LFACLK/16"]
131    DIV16 = 4,
132    #[doc = "5: LFACLKLETIMER0 = LFACLK/32"]
133    DIV32 = 5,
134    #[doc = "6: LFACLKLETIMER0 = LFACLK/64"]
135    DIV64 = 6,
136    #[doc = "7: LFACLKLETIMER0 = LFACLK/128"]
137    DIV128 = 7,
138    #[doc = "8: LFACLKLETIMER0 = LFACLK/256"]
139    DIV256 = 8,
140    #[doc = "9: LFACLKLETIMER0 = LFACLK/512"]
141    DIV512 = 9,
142    #[doc = "10: LFACLKLETIMER0 = LFACLK/1024"]
143    DIV1024 = 10,
144    #[doc = "11: LFACLKLETIMER0 = LFACLK/2048"]
145    DIV2048 = 11,
146    #[doc = "12: LFACLKLETIMER0 = LFACLK/4096"]
147    DIV4096 = 12,
148    #[doc = "13: LFACLKLETIMER0 = LFACLK/8192"]
149    DIV8192 = 13,
150    #[doc = "14: LFACLKLETIMER0 = LFACLK/16384"]
151    DIV16384 = 14,
152    #[doc = "15: LFACLKLETIMER0 = LFACLK/32768"]
153    DIV32768 = 15,
154}
155impl From<LETIMER0_A> for u8 {
156    #[inline(always)]
157    fn from(variant: LETIMER0_A) -> Self {
158        variant as _
159    }
160}
161impl LETIMER0_R {
162    #[doc = "Get enumerated values variant"]
163    #[inline(always)]
164    pub fn variant(&self) -> LETIMER0_A {
165        match self.bits {
166            0 => LETIMER0_A::DIV1,
167            1 => LETIMER0_A::DIV2,
168            2 => LETIMER0_A::DIV4,
169            3 => LETIMER0_A::DIV8,
170            4 => LETIMER0_A::DIV16,
171            5 => LETIMER0_A::DIV32,
172            6 => LETIMER0_A::DIV64,
173            7 => LETIMER0_A::DIV128,
174            8 => LETIMER0_A::DIV256,
175            9 => LETIMER0_A::DIV512,
176            10 => LETIMER0_A::DIV1024,
177            11 => LETIMER0_A::DIV2048,
178            12 => LETIMER0_A::DIV4096,
179            13 => LETIMER0_A::DIV8192,
180            14 => LETIMER0_A::DIV16384,
181            15 => LETIMER0_A::DIV32768,
182            _ => unreachable!(),
183        }
184    }
185    #[doc = "Checks if the value of the field is `DIV1`"]
186    #[inline(always)]
187    pub fn is_div1(&self) -> bool {
188        *self == LETIMER0_A::DIV1
189    }
190    #[doc = "Checks if the value of the field is `DIV2`"]
191    #[inline(always)]
192    pub fn is_div2(&self) -> bool {
193        *self == LETIMER0_A::DIV2
194    }
195    #[doc = "Checks if the value of the field is `DIV4`"]
196    #[inline(always)]
197    pub fn is_div4(&self) -> bool {
198        *self == LETIMER0_A::DIV4
199    }
200    #[doc = "Checks if the value of the field is `DIV8`"]
201    #[inline(always)]
202    pub fn is_div8(&self) -> bool {
203        *self == LETIMER0_A::DIV8
204    }
205    #[doc = "Checks if the value of the field is `DIV16`"]
206    #[inline(always)]
207    pub fn is_div16(&self) -> bool {
208        *self == LETIMER0_A::DIV16
209    }
210    #[doc = "Checks if the value of the field is `DIV32`"]
211    #[inline(always)]
212    pub fn is_div32(&self) -> bool {
213        *self == LETIMER0_A::DIV32
214    }
215    #[doc = "Checks if the value of the field is `DIV64`"]
216    #[inline(always)]
217    pub fn is_div64(&self) -> bool {
218        *self == LETIMER0_A::DIV64
219    }
220    #[doc = "Checks if the value of the field is `DIV128`"]
221    #[inline(always)]
222    pub fn is_div128(&self) -> bool {
223        *self == LETIMER0_A::DIV128
224    }
225    #[doc = "Checks if the value of the field is `DIV256`"]
226    #[inline(always)]
227    pub fn is_div256(&self) -> bool {
228        *self == LETIMER0_A::DIV256
229    }
230    #[doc = "Checks if the value of the field is `DIV512`"]
231    #[inline(always)]
232    pub fn is_div512(&self) -> bool {
233        *self == LETIMER0_A::DIV512
234    }
235    #[doc = "Checks if the value of the field is `DIV1024`"]
236    #[inline(always)]
237    pub fn is_div1024(&self) -> bool {
238        *self == LETIMER0_A::DIV1024
239    }
240    #[doc = "Checks if the value of the field is `DIV2048`"]
241    #[inline(always)]
242    pub fn is_div2048(&self) -> bool {
243        *self == LETIMER0_A::DIV2048
244    }
245    #[doc = "Checks if the value of the field is `DIV4096`"]
246    #[inline(always)]
247    pub fn is_div4096(&self) -> bool {
248        *self == LETIMER0_A::DIV4096
249    }
250    #[doc = "Checks if the value of the field is `DIV8192`"]
251    #[inline(always)]
252    pub fn is_div8192(&self) -> bool {
253        *self == LETIMER0_A::DIV8192
254    }
255    #[doc = "Checks if the value of the field is `DIV16384`"]
256    #[inline(always)]
257    pub fn is_div16384(&self) -> bool {
258        *self == LETIMER0_A::DIV16384
259    }
260    #[doc = "Checks if the value of the field is `DIV32768`"]
261    #[inline(always)]
262    pub fn is_div32768(&self) -> bool {
263        *self == LETIMER0_A::DIV32768
264    }
265}
266#[doc = "Field `LETIMER0` writer - Low Energy Timer 0 Prescaler"]
267pub type LETIMER0_W<'a, const O: u8> =
268    crate::FieldWriterSafe<'a, u32, LFAPRESC0_SPEC, u8, LETIMER0_A, 4, O>;
269impl<'a, const O: u8> LETIMER0_W<'a, O> {
270    #[doc = "LFACLKLETIMER0 = LFACLK"]
271    #[inline(always)]
272    pub fn div1(self) -> &'a mut W {
273        self.variant(LETIMER0_A::DIV1)
274    }
275    #[doc = "LFACLKLETIMER0 = LFACLK/2"]
276    #[inline(always)]
277    pub fn div2(self) -> &'a mut W {
278        self.variant(LETIMER0_A::DIV2)
279    }
280    #[doc = "LFACLKLETIMER0 = LFACLK/4"]
281    #[inline(always)]
282    pub fn div4(self) -> &'a mut W {
283        self.variant(LETIMER0_A::DIV4)
284    }
285    #[doc = "LFACLKLETIMER0 = LFACLK/8"]
286    #[inline(always)]
287    pub fn div8(self) -> &'a mut W {
288        self.variant(LETIMER0_A::DIV8)
289    }
290    #[doc = "LFACLKLETIMER0 = LFACLK/16"]
291    #[inline(always)]
292    pub fn div16(self) -> &'a mut W {
293        self.variant(LETIMER0_A::DIV16)
294    }
295    #[doc = "LFACLKLETIMER0 = LFACLK/32"]
296    #[inline(always)]
297    pub fn div32(self) -> &'a mut W {
298        self.variant(LETIMER0_A::DIV32)
299    }
300    #[doc = "LFACLKLETIMER0 = LFACLK/64"]
301    #[inline(always)]
302    pub fn div64(self) -> &'a mut W {
303        self.variant(LETIMER0_A::DIV64)
304    }
305    #[doc = "LFACLKLETIMER0 = LFACLK/128"]
306    #[inline(always)]
307    pub fn div128(self) -> &'a mut W {
308        self.variant(LETIMER0_A::DIV128)
309    }
310    #[doc = "LFACLKLETIMER0 = LFACLK/256"]
311    #[inline(always)]
312    pub fn div256(self) -> &'a mut W {
313        self.variant(LETIMER0_A::DIV256)
314    }
315    #[doc = "LFACLKLETIMER0 = LFACLK/512"]
316    #[inline(always)]
317    pub fn div512(self) -> &'a mut W {
318        self.variant(LETIMER0_A::DIV512)
319    }
320    #[doc = "LFACLKLETIMER0 = LFACLK/1024"]
321    #[inline(always)]
322    pub fn div1024(self) -> &'a mut W {
323        self.variant(LETIMER0_A::DIV1024)
324    }
325    #[doc = "LFACLKLETIMER0 = LFACLK/2048"]
326    #[inline(always)]
327    pub fn div2048(self) -> &'a mut W {
328        self.variant(LETIMER0_A::DIV2048)
329    }
330    #[doc = "LFACLKLETIMER0 = LFACLK/4096"]
331    #[inline(always)]
332    pub fn div4096(self) -> &'a mut W {
333        self.variant(LETIMER0_A::DIV4096)
334    }
335    #[doc = "LFACLKLETIMER0 = LFACLK/8192"]
336    #[inline(always)]
337    pub fn div8192(self) -> &'a mut W {
338        self.variant(LETIMER0_A::DIV8192)
339    }
340    #[doc = "LFACLKLETIMER0 = LFACLK/16384"]
341    #[inline(always)]
342    pub fn div16384(self) -> &'a mut W {
343        self.variant(LETIMER0_A::DIV16384)
344    }
345    #[doc = "LFACLKLETIMER0 = LFACLK/32768"]
346    #[inline(always)]
347    pub fn div32768(self) -> &'a mut W {
348        self.variant(LETIMER0_A::DIV32768)
349    }
350}
351#[doc = "Field `LCD` reader - Liquid Crystal Display Controller Prescaler"]
352pub type LCD_R = crate::FieldReader<u8, LCD_A>;
353#[doc = "Liquid Crystal Display Controller Prescaler\n\nValue on reset: 0"]
354#[derive(Clone, Copy, Debug, PartialEq, Eq)]
355#[repr(u8)]
356pub enum LCD_A {
357    #[doc = "0: LFACLKLCD = LFACLK"]
358    DIV1 = 0,
359    #[doc = "1: LFACLKLCD = LFACLK/2"]
360    DIV2 = 1,
361    #[doc = "2: LFACLKLCD = LFACLK/4"]
362    DIV4 = 2,
363    #[doc = "3: LFACLKLCD = LFACLK/8"]
364    DIV8 = 3,
365    #[doc = "4: LFACLKLCD = LFACLK/16"]
366    DIV16 = 4,
367    #[doc = "5: LFACLKLCD = LFACLK/32"]
368    DIV32 = 5,
369    #[doc = "6: LFACLKLCD = LFACLK/64"]
370    DIV64 = 6,
371    #[doc = "7: LFACLKLCD = LFACLK/128"]
372    DIV128 = 7,
373}
374impl From<LCD_A> for u8 {
375    #[inline(always)]
376    fn from(variant: LCD_A) -> Self {
377        variant as _
378    }
379}
380impl LCD_R {
381    #[doc = "Get enumerated values variant"]
382    #[inline(always)]
383    pub fn variant(&self) -> LCD_A {
384        match self.bits {
385            0 => LCD_A::DIV1,
386            1 => LCD_A::DIV2,
387            2 => LCD_A::DIV4,
388            3 => LCD_A::DIV8,
389            4 => LCD_A::DIV16,
390            5 => LCD_A::DIV32,
391            6 => LCD_A::DIV64,
392            7 => LCD_A::DIV128,
393            _ => unreachable!(),
394        }
395    }
396    #[doc = "Checks if the value of the field is `DIV1`"]
397    #[inline(always)]
398    pub fn is_div1(&self) -> bool {
399        *self == LCD_A::DIV1
400    }
401    #[doc = "Checks if the value of the field is `DIV2`"]
402    #[inline(always)]
403    pub fn is_div2(&self) -> bool {
404        *self == LCD_A::DIV2
405    }
406    #[doc = "Checks if the value of the field is `DIV4`"]
407    #[inline(always)]
408    pub fn is_div4(&self) -> bool {
409        *self == LCD_A::DIV4
410    }
411    #[doc = "Checks if the value of the field is `DIV8`"]
412    #[inline(always)]
413    pub fn is_div8(&self) -> bool {
414        *self == LCD_A::DIV8
415    }
416    #[doc = "Checks if the value of the field is `DIV16`"]
417    #[inline(always)]
418    pub fn is_div16(&self) -> bool {
419        *self == LCD_A::DIV16
420    }
421    #[doc = "Checks if the value of the field is `DIV32`"]
422    #[inline(always)]
423    pub fn is_div32(&self) -> bool {
424        *self == LCD_A::DIV32
425    }
426    #[doc = "Checks if the value of the field is `DIV64`"]
427    #[inline(always)]
428    pub fn is_div64(&self) -> bool {
429        *self == LCD_A::DIV64
430    }
431    #[doc = "Checks if the value of the field is `DIV128`"]
432    #[inline(always)]
433    pub fn is_div128(&self) -> bool {
434        *self == LCD_A::DIV128
435    }
436}
437#[doc = "Field `LCD` writer - Liquid Crystal Display Controller Prescaler"]
438pub type LCD_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, LFAPRESC0_SPEC, u8, LCD_A, 3, O>;
439impl<'a, const O: u8> LCD_W<'a, O> {
440    #[doc = "LFACLKLCD = LFACLK"]
441    #[inline(always)]
442    pub fn div1(self) -> &'a mut W {
443        self.variant(LCD_A::DIV1)
444    }
445    #[doc = "LFACLKLCD = LFACLK/2"]
446    #[inline(always)]
447    pub fn div2(self) -> &'a mut W {
448        self.variant(LCD_A::DIV2)
449    }
450    #[doc = "LFACLKLCD = LFACLK/4"]
451    #[inline(always)]
452    pub fn div4(self) -> &'a mut W {
453        self.variant(LCD_A::DIV4)
454    }
455    #[doc = "LFACLKLCD = LFACLK/8"]
456    #[inline(always)]
457    pub fn div8(self) -> &'a mut W {
458        self.variant(LCD_A::DIV8)
459    }
460    #[doc = "LFACLKLCD = LFACLK/16"]
461    #[inline(always)]
462    pub fn div16(self) -> &'a mut W {
463        self.variant(LCD_A::DIV16)
464    }
465    #[doc = "LFACLKLCD = LFACLK/32"]
466    #[inline(always)]
467    pub fn div32(self) -> &'a mut W {
468        self.variant(LCD_A::DIV32)
469    }
470    #[doc = "LFACLKLCD = LFACLK/64"]
471    #[inline(always)]
472    pub fn div64(self) -> &'a mut W {
473        self.variant(LCD_A::DIV64)
474    }
475    #[doc = "LFACLKLCD = LFACLK/128"]
476    #[inline(always)]
477    pub fn div128(self) -> &'a mut W {
478        self.variant(LCD_A::DIV128)
479    }
480}
481impl R {
482    #[doc = "Bits 0:1 - Low Energy Sensor Interface Prescaler"]
483    #[inline(always)]
484    pub fn lesense(&self) -> LESENSE_R {
485        LESENSE_R::new((self.bits & 3) as u8)
486    }
487    #[doc = "Bits 4:7 - Low Energy Timer 0 Prescaler"]
488    #[inline(always)]
489    pub fn letimer0(&self) -> LETIMER0_R {
490        LETIMER0_R::new(((self.bits >> 4) & 0x0f) as u8)
491    }
492    #[doc = "Bits 8:10 - Liquid Crystal Display Controller Prescaler"]
493    #[inline(always)]
494    pub fn lcd(&self) -> LCD_R {
495        LCD_R::new(((self.bits >> 8) & 7) as u8)
496    }
497}
498impl W {
499    #[doc = "Bits 0:1 - Low Energy Sensor Interface Prescaler"]
500    #[inline(always)]
501    #[must_use]
502    pub fn lesense(&mut self) -> LESENSE_W<0> {
503        LESENSE_W::new(self)
504    }
505    #[doc = "Bits 4:7 - Low Energy Timer 0 Prescaler"]
506    #[inline(always)]
507    #[must_use]
508    pub fn letimer0(&mut self) -> LETIMER0_W<4> {
509        LETIMER0_W::new(self)
510    }
511    #[doc = "Bits 8:10 - Liquid Crystal Display Controller Prescaler"]
512    #[inline(always)]
513    #[must_use]
514    pub fn lcd(&mut self) -> LCD_W<8> {
515        LCD_W::new(self)
516    }
517    #[doc = "Writes raw bits to the register."]
518    #[inline(always)]
519    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
520        self.0.bits(bits);
521        self
522    }
523}
524#[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"]
525pub struct LFAPRESC0_SPEC;
526impl crate::RegisterSpec for LFAPRESC0_SPEC {
527    type Ux = u32;
528}
529#[doc = "`read()` method returns [lfapresc0::R](R) reader structure"]
530impl crate::Readable for LFAPRESC0_SPEC {
531    type Reader = R;
532}
533#[doc = "`write(|w| ..)` method takes [lfapresc0::W](W) writer structure"]
534impl crate::Writable for LFAPRESC0_SPEC {
535    type Writer = W;
536    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
537    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
538}
539#[doc = "`reset()` method sets LFAPRESC0 to value 0"]
540impl crate::Resettable for LFAPRESC0_SPEC {
541    const RESET_VALUE: Self::Ux = 0;
542}