efm32jg12b500_pac/cmu/
lfbpresc0.rs1#[doc = "Register `LFBPRESC0` reader"]
2pub struct R(crate::R<LFBPRESC0_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<LFBPRESC0_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<LFBPRESC0_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<LFBPRESC0_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `LFBPRESC0` writer"]
17pub struct W(crate::W<LFBPRESC0_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<LFBPRESC0_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<LFBPRESC0_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<LFBPRESC0_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Prescaler\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum SYSTICK_A {
41 #[doc = "0: LFBCLKSYSTICK = LFBCLK"]
42 DIV1 = 0,
43}
44impl From<SYSTICK_A> for u8 {
45 #[inline(always)]
46 fn from(variant: SYSTICK_A) -> Self {
47 variant as _
48 }
49}
50#[doc = "Field `SYSTICK` reader - Prescaler"]
51pub type SYSTICK_R = crate::FieldReader<u8, SYSTICK_A>;
52impl SYSTICK_R {
53 #[doc = "Get enumerated values variant"]
54 #[inline(always)]
55 pub fn variant(&self) -> Option<SYSTICK_A> {
56 match self.bits {
57 0 => Some(SYSTICK_A::DIV1),
58 _ => None,
59 }
60 }
61 #[doc = "Checks if the value of the field is `DIV1`"]
62 #[inline(always)]
63 pub fn is_div1(&self) -> bool {
64 *self == SYSTICK_A::DIV1
65 }
66}
67#[doc = "Low Energy UART 0 Prescaler\n\nValue on reset: 0"]
68#[derive(Clone, Copy, Debug, PartialEq)]
69#[repr(u8)]
70pub enum LEUART0_A {
71 #[doc = "0: LFBCLKLEUART0 = LFBCLK"]
72 DIV1 = 0,
73 #[doc = "1: LFBCLKLEUART0 = LFBCLK/2"]
74 DIV2 = 1,
75 #[doc = "2: LFBCLKLEUART0 = LFBCLK/4"]
76 DIV4 = 2,
77 #[doc = "3: LFBCLKLEUART0 = LFBCLK/8"]
78 DIV8 = 3,
79}
80impl From<LEUART0_A> for u8 {
81 #[inline(always)]
82 fn from(variant: LEUART0_A) -> Self {
83 variant as _
84 }
85}
86#[doc = "Field `LEUART0` reader - Low Energy UART 0 Prescaler"]
87pub type LEUART0_R = crate::FieldReader<u8, LEUART0_A>;
88impl LEUART0_R {
89 #[doc = "Get enumerated values variant"]
90 #[inline(always)]
91 pub fn variant(&self) -> LEUART0_A {
92 match self.bits {
93 0 => LEUART0_A::DIV1,
94 1 => LEUART0_A::DIV2,
95 2 => LEUART0_A::DIV4,
96 3 => LEUART0_A::DIV8,
97 _ => unreachable!(),
98 }
99 }
100 #[doc = "Checks if the value of the field is `DIV1`"]
101 #[inline(always)]
102 pub fn is_div1(&self) -> bool {
103 *self == LEUART0_A::DIV1
104 }
105 #[doc = "Checks if the value of the field is `DIV2`"]
106 #[inline(always)]
107 pub fn is_div2(&self) -> bool {
108 *self == LEUART0_A::DIV2
109 }
110 #[doc = "Checks if the value of the field is `DIV4`"]
111 #[inline(always)]
112 pub fn is_div4(&self) -> bool {
113 *self == LEUART0_A::DIV4
114 }
115 #[doc = "Checks if the value of the field is `DIV8`"]
116 #[inline(always)]
117 pub fn is_div8(&self) -> bool {
118 *self == LEUART0_A::DIV8
119 }
120}
121#[doc = "Field `LEUART0` writer - Low Energy UART 0 Prescaler"]
122pub type LEUART0_W<'a> = crate::FieldWriterSafe<'a, u32, LFBPRESC0_SPEC, u8, LEUART0_A, 2, 4>;
123impl<'a> LEUART0_W<'a> {
124 #[doc = "LFBCLKLEUART0 = LFBCLK"]
125 #[inline(always)]
126 pub fn div1(self) -> &'a mut W {
127 self.variant(LEUART0_A::DIV1)
128 }
129 #[doc = "LFBCLKLEUART0 = LFBCLK/2"]
130 #[inline(always)]
131 pub fn div2(self) -> &'a mut W {
132 self.variant(LEUART0_A::DIV2)
133 }
134 #[doc = "LFBCLKLEUART0 = LFBCLK/4"]
135 #[inline(always)]
136 pub fn div4(self) -> &'a mut W {
137 self.variant(LEUART0_A::DIV4)
138 }
139 #[doc = "LFBCLKLEUART0 = LFBCLK/8"]
140 #[inline(always)]
141 pub fn div8(self) -> &'a mut W {
142 self.variant(LEUART0_A::DIV8)
143 }
144}
145#[doc = "Capacitive touch sense module Prescaler\n\nValue on reset: 0"]
146#[derive(Clone, Copy, Debug, PartialEq)]
147#[repr(u8)]
148pub enum CSEN_A {
149 #[doc = "0: LFBCLKCSEN = LFBCLK/16"]
150 DIV16 = 0,
151 #[doc = "1: LFBCLKCSEN = LFBCLK/32"]
152 DIV32 = 1,
153 #[doc = "2: LFBCLKCSEN = LFBCLK/64"]
154 DIV64 = 2,
155 #[doc = "3: LFBCLKCSEN = LFBCLK/128"]
156 DIV128 = 3,
157}
158impl From<CSEN_A> for u8 {
159 #[inline(always)]
160 fn from(variant: CSEN_A) -> Self {
161 variant as _
162 }
163}
164#[doc = "Field `CSEN` reader - Capacitive touch sense module Prescaler"]
165pub type CSEN_R = crate::FieldReader<u8, CSEN_A>;
166impl CSEN_R {
167 #[doc = "Get enumerated values variant"]
168 #[inline(always)]
169 pub fn variant(&self) -> CSEN_A {
170 match self.bits {
171 0 => CSEN_A::DIV16,
172 1 => CSEN_A::DIV32,
173 2 => CSEN_A::DIV64,
174 3 => CSEN_A::DIV128,
175 _ => unreachable!(),
176 }
177 }
178 #[doc = "Checks if the value of the field is `DIV16`"]
179 #[inline(always)]
180 pub fn is_div16(&self) -> bool {
181 *self == CSEN_A::DIV16
182 }
183 #[doc = "Checks if the value of the field is `DIV32`"]
184 #[inline(always)]
185 pub fn is_div32(&self) -> bool {
186 *self == CSEN_A::DIV32
187 }
188 #[doc = "Checks if the value of the field is `DIV64`"]
189 #[inline(always)]
190 pub fn is_div64(&self) -> bool {
191 *self == CSEN_A::DIV64
192 }
193 #[doc = "Checks if the value of the field is `DIV128`"]
194 #[inline(always)]
195 pub fn is_div128(&self) -> bool {
196 *self == CSEN_A::DIV128
197 }
198}
199#[doc = "Field `CSEN` writer - Capacitive touch sense module Prescaler"]
200pub type CSEN_W<'a> = crate::FieldWriterSafe<'a, u32, LFBPRESC0_SPEC, u8, CSEN_A, 2, 8>;
201impl<'a> CSEN_W<'a> {
202 #[doc = "LFBCLKCSEN = LFBCLK/16"]
203 #[inline(always)]
204 pub fn div16(self) -> &'a mut W {
205 self.variant(CSEN_A::DIV16)
206 }
207 #[doc = "LFBCLKCSEN = LFBCLK/32"]
208 #[inline(always)]
209 pub fn div32(self) -> &'a mut W {
210 self.variant(CSEN_A::DIV32)
211 }
212 #[doc = "LFBCLKCSEN = LFBCLK/64"]
213 #[inline(always)]
214 pub fn div64(self) -> &'a mut W {
215 self.variant(CSEN_A::DIV64)
216 }
217 #[doc = "LFBCLKCSEN = LFBCLK/128"]
218 #[inline(always)]
219 pub fn div128(self) -> &'a mut W {
220 self.variant(CSEN_A::DIV128)
221 }
222}
223impl R {
224 #[doc = "Bits 0:3 - Prescaler"]
225 #[inline(always)]
226 pub fn systick(&self) -> SYSTICK_R {
227 SYSTICK_R::new((self.bits & 0x0f) as u8)
228 }
229 #[doc = "Bits 4:5 - Low Energy UART 0 Prescaler"]
230 #[inline(always)]
231 pub fn leuart0(&self) -> LEUART0_R {
232 LEUART0_R::new(((self.bits >> 4) & 3) as u8)
233 }
234 #[doc = "Bits 8:9 - Capacitive touch sense module Prescaler"]
235 #[inline(always)]
236 pub fn csen(&self) -> CSEN_R {
237 CSEN_R::new(((self.bits >> 8) & 3) as u8)
238 }
239}
240impl W {
241 #[doc = "Bits 4:5 - Low Energy UART 0 Prescaler"]
242 #[inline(always)]
243 pub fn leuart0(&mut self) -> LEUART0_W {
244 LEUART0_W::new(self)
245 }
246 #[doc = "Bits 8:9 - Capacitive touch sense module Prescaler"]
247 #[inline(always)]
248 pub fn csen(&mut self) -> CSEN_W {
249 CSEN_W::new(self)
250 }
251 #[doc = "Writes raw bits to the register."]
252 #[inline(always)]
253 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
254 self.0.bits(bits);
255 self
256 }
257}
258#[doc = "Low Frequency B 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 [lfbpresc0](index.html) module"]
259pub struct LFBPRESC0_SPEC;
260impl crate::RegisterSpec for LFBPRESC0_SPEC {
261 type Ux = u32;
262}
263#[doc = "`read()` method returns [lfbpresc0::R](R) reader structure"]
264impl crate::Readable for LFBPRESC0_SPEC {
265 type Reader = R;
266}
267#[doc = "`write(|w| ..)` method takes [lfbpresc0::W](W) writer structure"]
268impl crate::Writable for LFBPRESC0_SPEC {
269 type Writer = W;
270}
271#[doc = "`reset()` method sets LFBPRESC0 to value 0"]
272impl crate::Resettable for LFBPRESC0_SPEC {
273 #[inline(always)]
274 fn reset_value() -> Self::Ux {
275 0
276 }
277}