efm32pg12_pac/emu/
dcdcmiscctrl.rs1#[doc = "Reader of register DCDCMISCCTRL"]
2pub type R = crate::R<u32, super::DCDCMISCCTRL>;
3#[doc = "Writer for register DCDCMISCCTRL"]
4pub type W = crate::W<u32, super::DCDCMISCCTRL>;
5#[doc = "Register DCDCMISCCTRL `reset()`'s with value 0x0310_7706"]
6impl crate::ResetValue for super::DCDCMISCCTRL {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0x0310_7706
11 }
12}
13#[doc = "Reader of field `LNFORCECCM`"]
14pub type LNFORCECCM_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `LNFORCECCM`"]
16pub struct LNFORCECCM_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> LNFORCECCM_W<'a> {
20 #[doc = r"Sets the field bit"]
21 #[inline(always)]
22 pub fn set_bit(self) -> &'a mut W {
23 self.bit(true)
24 }
25 #[doc = r"Clears the field bit"]
26 #[inline(always)]
27 pub fn clear_bit(self) -> &'a mut W {
28 self.bit(false)
29 }
30 #[doc = r"Writes raw bits to the field"]
31 #[inline(always)]
32 pub fn bit(self, value: bool) -> &'a mut W {
33 self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
34 self.w
35 }
36}
37#[doc = "Reader of field `LPCMPHYSDIS`"]
38pub type LPCMPHYSDIS_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `LPCMPHYSDIS`"]
40pub struct LPCMPHYSDIS_W<'a> {
41 w: &'a mut W,
42}
43impl<'a> LPCMPHYSDIS_W<'a> {
44 #[doc = r"Sets the field bit"]
45 #[inline(always)]
46 pub fn set_bit(self) -> &'a mut W {
47 self.bit(true)
48 }
49 #[doc = r"Clears the field bit"]
50 #[inline(always)]
51 pub fn clear_bit(self) -> &'a mut W {
52 self.bit(false)
53 }
54 #[doc = r"Writes raw bits to the field"]
55 #[inline(always)]
56 pub fn bit(self, value: bool) -> &'a mut W {
57 self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
58 self.w
59 }
60}
61#[doc = "Reader of field `LPCMPHYSHI`"]
62pub type LPCMPHYSHI_R = crate::R<bool, bool>;
63#[doc = "Write proxy for field `LPCMPHYSHI`"]
64pub struct LPCMPHYSHI_W<'a> {
65 w: &'a mut W,
66}
67impl<'a> LPCMPHYSHI_W<'a> {
68 #[doc = r"Sets the field bit"]
69 #[inline(always)]
70 pub fn set_bit(self) -> &'a mut W {
71 self.bit(true)
72 }
73 #[doc = r"Clears the field bit"]
74 #[inline(always)]
75 pub fn clear_bit(self) -> &'a mut W {
76 self.bit(false)
77 }
78 #[doc = r"Writes raw bits to the field"]
79 #[inline(always)]
80 pub fn bit(self, value: bool) -> &'a mut W {
81 self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
82 self.w
83 }
84}
85#[doc = "Reader of field `LNFORCECCMIMM`"]
86pub type LNFORCECCMIMM_R = crate::R<bool, bool>;
87#[doc = "Write proxy for field `LNFORCECCMIMM`"]
88pub struct LNFORCECCMIMM_W<'a> {
89 w: &'a mut W,
90}
91impl<'a> LNFORCECCMIMM_W<'a> {
92 #[doc = r"Sets the field bit"]
93 #[inline(always)]
94 pub fn set_bit(self) -> &'a mut W {
95 self.bit(true)
96 }
97 #[doc = r"Clears the field bit"]
98 #[inline(always)]
99 pub fn clear_bit(self) -> &'a mut W {
100 self.bit(false)
101 }
102 #[doc = r"Writes raw bits to the field"]
103 #[inline(always)]
104 pub fn bit(self, value: bool) -> &'a mut W {
105 self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5);
106 self.w
107 }
108}
109#[doc = "Reader of field `PFETCNT`"]
110pub type PFETCNT_R = crate::R<u8, u8>;
111#[doc = "Write proxy for field `PFETCNT`"]
112pub struct PFETCNT_W<'a> {
113 w: &'a mut W,
114}
115impl<'a> PFETCNT_W<'a> {
116 #[doc = r"Writes raw bits to the field"]
117 #[inline(always)]
118 pub unsafe fn bits(self, value: u8) -> &'a mut W {
119 self.w.bits = (self.w.bits & !(0x0f << 8)) | (((value as u32) & 0x0f) << 8);
120 self.w
121 }
122}
123#[doc = "Reader of field `NFETCNT`"]
124pub type NFETCNT_R = crate::R<u8, u8>;
125#[doc = "Write proxy for field `NFETCNT`"]
126pub struct NFETCNT_W<'a> {
127 w: &'a mut W,
128}
129impl<'a> NFETCNT_W<'a> {
130 #[doc = r"Writes raw bits to the field"]
131 #[inline(always)]
132 pub unsafe fn bits(self, value: u8) -> &'a mut W {
133 self.w.bits = (self.w.bits & !(0x0f << 12)) | (((value as u32) & 0x0f) << 12);
134 self.w
135 }
136}
137#[doc = "Reader of field `BYPLIMSEL`"]
138pub type BYPLIMSEL_R = crate::R<u8, u8>;
139#[doc = "Write proxy for field `BYPLIMSEL`"]
140pub struct BYPLIMSEL_W<'a> {
141 w: &'a mut W,
142}
143impl<'a> BYPLIMSEL_W<'a> {
144 #[doc = r"Writes raw bits to the field"]
145 #[inline(always)]
146 pub unsafe fn bits(self, value: u8) -> &'a mut W {
147 self.w.bits = (self.w.bits & !(0x0f << 16)) | (((value as u32) & 0x0f) << 16);
148 self.w
149 }
150}
151#[doc = "Reader of field `LPCLIMILIMSEL`"]
152pub type LPCLIMILIMSEL_R = crate::R<u8, u8>;
153#[doc = "Write proxy for field `LPCLIMILIMSEL`"]
154pub struct LPCLIMILIMSEL_W<'a> {
155 w: &'a mut W,
156}
157impl<'a> LPCLIMILIMSEL_W<'a> {
158 #[doc = r"Writes raw bits to the field"]
159 #[inline(always)]
160 pub unsafe fn bits(self, value: u8) -> &'a mut W {
161 self.w.bits = (self.w.bits & !(0x07 << 20)) | (((value as u32) & 0x07) << 20);
162 self.w
163 }
164}
165#[doc = "Reader of field `LNCLIMILIMSEL`"]
166pub type LNCLIMILIMSEL_R = crate::R<u8, u8>;
167#[doc = "Write proxy for field `LNCLIMILIMSEL`"]
168pub struct LNCLIMILIMSEL_W<'a> {
169 w: &'a mut W,
170}
171impl<'a> LNCLIMILIMSEL_W<'a> {
172 #[doc = r"Writes raw bits to the field"]
173 #[inline(always)]
174 pub unsafe fn bits(self, value: u8) -> &'a mut W {
175 self.w.bits = (self.w.bits & !(0x07 << 24)) | (((value as u32) & 0x07) << 24);
176 self.w
177 }
178}
179#[doc = "LP Mode Comparator Bias Selection for EM23 or EM4H\n\nValue on reset: 0"]
180#[derive(Clone, Copy, Debug, PartialEq)]
181#[repr(u8)]
182pub enum LPCMPBIASEM234H_A {
183 #[doc = "0: Maximum load current less than 75uA."]
184 BIAS0 = 0,
185 #[doc = "1: Maximum load current less than 500uA."]
186 BIAS1 = 1,
187 #[doc = "2: Maximum load current less than 2.5mA."]
188 BIAS2 = 2,
189 #[doc = "3: Maximum load current less than 10mA."]
190 BIAS3 = 3,
191}
192impl From<LPCMPBIASEM234H_A> for u8 {
193 #[inline(always)]
194 fn from(variant: LPCMPBIASEM234H_A) -> Self {
195 variant as _
196 }
197}
198#[doc = "Reader of field `LPCMPBIASEM234H`"]
199pub type LPCMPBIASEM234H_R = crate::R<u8, LPCMPBIASEM234H_A>;
200impl LPCMPBIASEM234H_R {
201 #[doc = r"Get enumerated values variant"]
202 #[inline(always)]
203 pub fn variant(&self) -> LPCMPBIASEM234H_A {
204 match self.bits {
205 0 => LPCMPBIASEM234H_A::BIAS0,
206 1 => LPCMPBIASEM234H_A::BIAS1,
207 2 => LPCMPBIASEM234H_A::BIAS2,
208 3 => LPCMPBIASEM234H_A::BIAS3,
209 _ => unreachable!(),
210 }
211 }
212 #[doc = "Checks if the value of the field is `BIAS0`"]
213 #[inline(always)]
214 pub fn is_bias0(&self) -> bool {
215 *self == LPCMPBIASEM234H_A::BIAS0
216 }
217 #[doc = "Checks if the value of the field is `BIAS1`"]
218 #[inline(always)]
219 pub fn is_bias1(&self) -> bool {
220 *self == LPCMPBIASEM234H_A::BIAS1
221 }
222 #[doc = "Checks if the value of the field is `BIAS2`"]
223 #[inline(always)]
224 pub fn is_bias2(&self) -> bool {
225 *self == LPCMPBIASEM234H_A::BIAS2
226 }
227 #[doc = "Checks if the value of the field is `BIAS3`"]
228 #[inline(always)]
229 pub fn is_bias3(&self) -> bool {
230 *self == LPCMPBIASEM234H_A::BIAS3
231 }
232}
233#[doc = "Write proxy for field `LPCMPBIASEM234H`"]
234pub struct LPCMPBIASEM234H_W<'a> {
235 w: &'a mut W,
236}
237impl<'a> LPCMPBIASEM234H_W<'a> {
238 #[doc = r"Writes `variant` to the field"]
239 #[inline(always)]
240 pub fn variant(self, variant: LPCMPBIASEM234H_A) -> &'a mut W {
241 {
242 self.bits(variant.into())
243 }
244 }
245 #[doc = "Maximum load current less than 75uA."]
246 #[inline(always)]
247 pub fn bias0(self) -> &'a mut W {
248 self.variant(LPCMPBIASEM234H_A::BIAS0)
249 }
250 #[doc = "Maximum load current less than 500uA."]
251 #[inline(always)]
252 pub fn bias1(self) -> &'a mut W {
253 self.variant(LPCMPBIASEM234H_A::BIAS1)
254 }
255 #[doc = "Maximum load current less than 2.5mA."]
256 #[inline(always)]
257 pub fn bias2(self) -> &'a mut W {
258 self.variant(LPCMPBIASEM234H_A::BIAS2)
259 }
260 #[doc = "Maximum load current less than 10mA."]
261 #[inline(always)]
262 pub fn bias3(self) -> &'a mut W {
263 self.variant(LPCMPBIASEM234H_A::BIAS3)
264 }
265 #[doc = r"Writes raw bits to the field"]
266 #[inline(always)]
267 pub fn bits(self, value: u8) -> &'a mut W {
268 self.w.bits = (self.w.bits & !(0x03 << 28)) | (((value as u32) & 0x03) << 28);
269 self.w
270 }
271}
272impl R {
273 #[doc = "Bit 0 - Force DCDC Into CCM Mode in Low Noise Operation"]
274 #[inline(always)]
275 pub fn lnforceccm(&self) -> LNFORCECCM_R {
276 LNFORCECCM_R::new((self.bits & 0x01) != 0)
277 }
278 #[doc = "Bit 1 - Disable LP Mode Hysteresis in the State Machine Control"]
279 #[inline(always)]
280 pub fn lpcmphysdis(&self) -> LPCMPHYSDIS_R {
281 LPCMPHYSDIS_R::new(((self.bits >> 1) & 0x01) != 0)
282 }
283 #[doc = "Bit 2 - Comparator Threshold on the High Side"]
284 #[inline(always)]
285 pub fn lpcmphyshi(&self) -> LPCMPHYSHI_R {
286 LPCMPHYSHI_R::new(((self.bits >> 2) & 0x01) != 0)
287 }
288 #[doc = "Bit 5 - Force DCDC Into CCM Mode Immediately, Based on LNFORCECCM"]
289 #[inline(always)]
290 pub fn lnforceccmimm(&self) -> LNFORCECCMIMM_R {
291 LNFORCECCMIMM_R::new(((self.bits >> 5) & 0x01) != 0)
292 }
293 #[doc = "Bits 8:11 - PFET Switch Number Selection"]
294 #[inline(always)]
295 pub fn pfetcnt(&self) -> PFETCNT_R {
296 PFETCNT_R::new(((self.bits >> 8) & 0x0f) as u8)
297 }
298 #[doc = "Bits 12:15 - NFET Switch Number Selection"]
299 #[inline(always)]
300 pub fn nfetcnt(&self) -> NFETCNT_R {
301 NFETCNT_R::new(((self.bits >> 12) & 0x0f) as u8)
302 }
303 #[doc = "Bits 16:19 - Current Limit in Bypass Mode"]
304 #[inline(always)]
305 pub fn byplimsel(&self) -> BYPLIMSEL_R {
306 BYPLIMSEL_R::new(((self.bits >> 16) & 0x0f) as u8)
307 }
308 #[doc = "Bits 20:22 - Current Limit Level Selection for Current Limiter in LP Mode"]
309 #[inline(always)]
310 pub fn lpclimilimsel(&self) -> LPCLIMILIMSEL_R {
311 LPCLIMILIMSEL_R::new(((self.bits >> 20) & 0x07) as u8)
312 }
313 #[doc = "Bits 24:26 - Current Limit Level Selection for Current Limiter in LN Mode"]
314 #[inline(always)]
315 pub fn lnclimilimsel(&self) -> LNCLIMILIMSEL_R {
316 LNCLIMILIMSEL_R::new(((self.bits >> 24) & 0x07) as u8)
317 }
318 #[doc = "Bits 28:29 - LP Mode Comparator Bias Selection for EM23 or EM4H"]
319 #[inline(always)]
320 pub fn lpcmpbiasem234h(&self) -> LPCMPBIASEM234H_R {
321 LPCMPBIASEM234H_R::new(((self.bits >> 28) & 0x03) as u8)
322 }
323}
324impl W {
325 #[doc = "Bit 0 - Force DCDC Into CCM Mode in Low Noise Operation"]
326 #[inline(always)]
327 pub fn lnforceccm(&mut self) -> LNFORCECCM_W {
328 LNFORCECCM_W { w: self }
329 }
330 #[doc = "Bit 1 - Disable LP Mode Hysteresis in the State Machine Control"]
331 #[inline(always)]
332 pub fn lpcmphysdis(&mut self) -> LPCMPHYSDIS_W {
333 LPCMPHYSDIS_W { w: self }
334 }
335 #[doc = "Bit 2 - Comparator Threshold on the High Side"]
336 #[inline(always)]
337 pub fn lpcmphyshi(&mut self) -> LPCMPHYSHI_W {
338 LPCMPHYSHI_W { w: self }
339 }
340 #[doc = "Bit 5 - Force DCDC Into CCM Mode Immediately, Based on LNFORCECCM"]
341 #[inline(always)]
342 pub fn lnforceccmimm(&mut self) -> LNFORCECCMIMM_W {
343 LNFORCECCMIMM_W { w: self }
344 }
345 #[doc = "Bits 8:11 - PFET Switch Number Selection"]
346 #[inline(always)]
347 pub fn pfetcnt(&mut self) -> PFETCNT_W {
348 PFETCNT_W { w: self }
349 }
350 #[doc = "Bits 12:15 - NFET Switch Number Selection"]
351 #[inline(always)]
352 pub fn nfetcnt(&mut self) -> NFETCNT_W {
353 NFETCNT_W { w: self }
354 }
355 #[doc = "Bits 16:19 - Current Limit in Bypass Mode"]
356 #[inline(always)]
357 pub fn byplimsel(&mut self) -> BYPLIMSEL_W {
358 BYPLIMSEL_W { w: self }
359 }
360 #[doc = "Bits 20:22 - Current Limit Level Selection for Current Limiter in LP Mode"]
361 #[inline(always)]
362 pub fn lpclimilimsel(&mut self) -> LPCLIMILIMSEL_W {
363 LPCLIMILIMSEL_W { w: self }
364 }
365 #[doc = "Bits 24:26 - Current Limit Level Selection for Current Limiter in LN Mode"]
366 #[inline(always)]
367 pub fn lnclimilimsel(&mut self) -> LNCLIMILIMSEL_W {
368 LNCLIMILIMSEL_W { w: self }
369 }
370 #[doc = "Bits 28:29 - LP Mode Comparator Bias Selection for EM23 or EM4H"]
371 #[inline(always)]
372 pub fn lpcmpbiasem234h(&mut self) -> LPCMPBIASEM234H_W {
373 LPCMPBIASEM234H_W { w: self }
374 }
375}