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