efm32tg11b_pac/efm32tg11b120/emu/
dcdcmiscctrl.rs

1#[doc = "Register `DCDCMISCCTRL` reader"]
2pub struct R(crate::R<DCDCMISCCTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<DCDCMISCCTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<DCDCMISCCTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<DCDCMISCCTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `DCDCMISCCTRL` writer"]
17pub struct W(crate::W<DCDCMISCCTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<DCDCMISCCTRL_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<DCDCMISCCTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<DCDCMISCCTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `LNFORCECCM` reader - Force DCDC Into CCM Mode in Low Noise Operation"]
38pub type LNFORCECCM_R = crate::BitReader<bool>;
39#[doc = "Field `LNFORCECCM` writer - Force DCDC Into CCM Mode in Low Noise Operation"]
40pub type LNFORCECCM_W<'a, const O: u8> = crate::BitWriter<'a, u32, DCDCMISCCTRL_SPEC, bool, O>;
41#[doc = "Field `LPCMPHYSDIS` reader - Disable LP Mode Hysteresis in the State Machine Control"]
42pub type LPCMPHYSDIS_R = crate::BitReader<bool>;
43#[doc = "Field `LPCMPHYSDIS` writer - Disable LP Mode Hysteresis in the State Machine Control"]
44pub type LPCMPHYSDIS_W<'a, const O: u8> = crate::BitWriter<'a, u32, DCDCMISCCTRL_SPEC, bool, O>;
45#[doc = "Field `LPCMPHYSHI` reader - Comparator Threshold on the High Side"]
46pub type LPCMPHYSHI_R = crate::BitReader<bool>;
47#[doc = "Field `LPCMPHYSHI` writer - Comparator Threshold on the High Side"]
48pub type LPCMPHYSHI_W<'a, const O: u8> = crate::BitWriter<'a, u32, DCDCMISCCTRL_SPEC, bool, O>;
49#[doc = "Field `LNFORCECCMIMM` reader - Force DCDC Into CCM Mode Immediately, Based on LNFORCECCM"]
50pub type LNFORCECCMIMM_R = crate::BitReader<bool>;
51#[doc = "Field `LNFORCECCMIMM` writer - Force DCDC Into CCM Mode Immediately, Based on LNFORCECCM"]
52pub type LNFORCECCMIMM_W<'a, const O: u8> = crate::BitWriter<'a, u32, DCDCMISCCTRL_SPEC, bool, O>;
53#[doc = "Field `PFETCNT` reader - PFET Switch Number Selection"]
54pub type PFETCNT_R = crate::FieldReader<u8, u8>;
55#[doc = "Field `PFETCNT` writer - PFET Switch Number Selection"]
56pub type PFETCNT_W<'a, const O: u8> = crate::FieldWriter<'a, u32, DCDCMISCCTRL_SPEC, u8, u8, 4, O>;
57#[doc = "Field `NFETCNT` reader - NFET Switch Number Selection"]
58pub type NFETCNT_R = crate::FieldReader<u8, u8>;
59#[doc = "Field `NFETCNT` writer - NFET Switch Number Selection"]
60pub type NFETCNT_W<'a, const O: u8> = crate::FieldWriter<'a, u32, DCDCMISCCTRL_SPEC, u8, u8, 4, O>;
61#[doc = "Field `BYPLIMSEL` reader - Current Limit in Bypass Mode"]
62pub type BYPLIMSEL_R = crate::FieldReader<u8, u8>;
63#[doc = "Field `BYPLIMSEL` writer - Current Limit in Bypass Mode"]
64pub type BYPLIMSEL_W<'a, const O: u8> =
65    crate::FieldWriter<'a, u32, DCDCMISCCTRL_SPEC, u8, u8, 4, O>;
66#[doc = "Field `LPCLIMILIMSEL` reader - Current Limit Level Selection for Current Limiter in LP Mode"]
67pub type LPCLIMILIMSEL_R = crate::FieldReader<u8, u8>;
68#[doc = "Field `LPCLIMILIMSEL` writer - Current Limit Level Selection for Current Limiter in LP Mode"]
69pub type LPCLIMILIMSEL_W<'a, const O: u8> =
70    crate::FieldWriter<'a, u32, DCDCMISCCTRL_SPEC, u8, u8, 3, O>;
71#[doc = "Field `LNCLIMILIMSEL` reader - Current Limit Level Selection for Current Limiter in LN Mode"]
72pub type LNCLIMILIMSEL_R = crate::FieldReader<u8, u8>;
73#[doc = "Field `LNCLIMILIMSEL` writer - Current Limit Level Selection for Current Limiter in LN Mode"]
74pub type LNCLIMILIMSEL_W<'a, const O: u8> =
75    crate::FieldWriter<'a, u32, DCDCMISCCTRL_SPEC, u8, u8, 3, O>;
76#[doc = "Field `LPCMPBIASEM234H` reader - LP Mode Comparator Bias Selection for EM23 or EM4H"]
77pub type LPCMPBIASEM234H_R = crate::FieldReader<u8, LPCMPBIASEM234H_A>;
78#[doc = "LP Mode Comparator Bias Selection for EM23 or EM4H\n\nValue on reset: 0"]
79#[derive(Clone, Copy, Debug, PartialEq, Eq)]
80#[repr(u8)]
81pub enum LPCMPBIASEM234H_A {
82    #[doc = "0: Maximum load current less than 75uA."]
83    BIAS0 = 0,
84    #[doc = "1: Maximum load current less than 500uA."]
85    BIAS1 = 1,
86    #[doc = "2: Maximum load current less than 2.5mA."]
87    BIAS2 = 2,
88    #[doc = "3: Maximum load current less than 10mA."]
89    BIAS3 = 3,
90}
91impl From<LPCMPBIASEM234H_A> for u8 {
92    #[inline(always)]
93    fn from(variant: LPCMPBIASEM234H_A) -> Self {
94        variant as _
95    }
96}
97impl LPCMPBIASEM234H_R {
98    #[doc = "Get enumerated values variant"]
99    #[inline(always)]
100    pub fn variant(&self) -> LPCMPBIASEM234H_A {
101        match self.bits {
102            0 => LPCMPBIASEM234H_A::BIAS0,
103            1 => LPCMPBIASEM234H_A::BIAS1,
104            2 => LPCMPBIASEM234H_A::BIAS2,
105            3 => LPCMPBIASEM234H_A::BIAS3,
106            _ => unreachable!(),
107        }
108    }
109    #[doc = "Checks if the value of the field is `BIAS0`"]
110    #[inline(always)]
111    pub fn is_bias0(&self) -> bool {
112        *self == LPCMPBIASEM234H_A::BIAS0
113    }
114    #[doc = "Checks if the value of the field is `BIAS1`"]
115    #[inline(always)]
116    pub fn is_bias1(&self) -> bool {
117        *self == LPCMPBIASEM234H_A::BIAS1
118    }
119    #[doc = "Checks if the value of the field is `BIAS2`"]
120    #[inline(always)]
121    pub fn is_bias2(&self) -> bool {
122        *self == LPCMPBIASEM234H_A::BIAS2
123    }
124    #[doc = "Checks if the value of the field is `BIAS3`"]
125    #[inline(always)]
126    pub fn is_bias3(&self) -> bool {
127        *self == LPCMPBIASEM234H_A::BIAS3
128    }
129}
130#[doc = "Field `LPCMPBIASEM234H` writer - LP Mode Comparator Bias Selection for EM23 or EM4H"]
131pub type LPCMPBIASEM234H_W<'a, const O: u8> =
132    crate::FieldWriterSafe<'a, u32, DCDCMISCCTRL_SPEC, u8, LPCMPBIASEM234H_A, 2, O>;
133impl<'a, const O: u8> LPCMPBIASEM234H_W<'a, O> {
134    #[doc = "Maximum load current less than 75uA."]
135    #[inline(always)]
136    pub fn bias0(self) -> &'a mut W {
137        self.variant(LPCMPBIASEM234H_A::BIAS0)
138    }
139    #[doc = "Maximum load current less than 500uA."]
140    #[inline(always)]
141    pub fn bias1(self) -> &'a mut W {
142        self.variant(LPCMPBIASEM234H_A::BIAS1)
143    }
144    #[doc = "Maximum load current less than 2.5mA."]
145    #[inline(always)]
146    pub fn bias2(self) -> &'a mut W {
147        self.variant(LPCMPBIASEM234H_A::BIAS2)
148    }
149    #[doc = "Maximum load current less than 10mA."]
150    #[inline(always)]
151    pub fn bias3(self) -> &'a mut W {
152        self.variant(LPCMPBIASEM234H_A::BIAS3)
153    }
154}
155impl R {
156    #[doc = "Bit 0 - Force DCDC Into CCM Mode in Low Noise Operation"]
157    #[inline(always)]
158    pub fn lnforceccm(&self) -> LNFORCECCM_R {
159        LNFORCECCM_R::new((self.bits & 1) != 0)
160    }
161    #[doc = "Bit 1 - Disable LP Mode Hysteresis in the State Machine Control"]
162    #[inline(always)]
163    pub fn lpcmphysdis(&self) -> LPCMPHYSDIS_R {
164        LPCMPHYSDIS_R::new(((self.bits >> 1) & 1) != 0)
165    }
166    #[doc = "Bit 2 - Comparator Threshold on the High Side"]
167    #[inline(always)]
168    pub fn lpcmphyshi(&self) -> LPCMPHYSHI_R {
169        LPCMPHYSHI_R::new(((self.bits >> 2) & 1) != 0)
170    }
171    #[doc = "Bit 5 - Force DCDC Into CCM Mode Immediately, Based on LNFORCECCM"]
172    #[inline(always)]
173    pub fn lnforceccmimm(&self) -> LNFORCECCMIMM_R {
174        LNFORCECCMIMM_R::new(((self.bits >> 5) & 1) != 0)
175    }
176    #[doc = "Bits 8:11 - PFET Switch Number Selection"]
177    #[inline(always)]
178    pub fn pfetcnt(&self) -> PFETCNT_R {
179        PFETCNT_R::new(((self.bits >> 8) & 0x0f) as u8)
180    }
181    #[doc = "Bits 12:15 - NFET Switch Number Selection"]
182    #[inline(always)]
183    pub fn nfetcnt(&self) -> NFETCNT_R {
184        NFETCNT_R::new(((self.bits >> 12) & 0x0f) as u8)
185    }
186    #[doc = "Bits 16:19 - Current Limit in Bypass Mode"]
187    #[inline(always)]
188    pub fn byplimsel(&self) -> BYPLIMSEL_R {
189        BYPLIMSEL_R::new(((self.bits >> 16) & 0x0f) as u8)
190    }
191    #[doc = "Bits 20:22 - Current Limit Level Selection for Current Limiter in LP Mode"]
192    #[inline(always)]
193    pub fn lpclimilimsel(&self) -> LPCLIMILIMSEL_R {
194        LPCLIMILIMSEL_R::new(((self.bits >> 20) & 7) as u8)
195    }
196    #[doc = "Bits 24:26 - Current Limit Level Selection for Current Limiter in LN Mode"]
197    #[inline(always)]
198    pub fn lnclimilimsel(&self) -> LNCLIMILIMSEL_R {
199        LNCLIMILIMSEL_R::new(((self.bits >> 24) & 7) as u8)
200    }
201    #[doc = "Bits 28:29 - LP Mode Comparator Bias Selection for EM23 or EM4H"]
202    #[inline(always)]
203    pub fn lpcmpbiasem234h(&self) -> LPCMPBIASEM234H_R {
204        LPCMPBIASEM234H_R::new(((self.bits >> 28) & 3) as u8)
205    }
206}
207impl W {
208    #[doc = "Bit 0 - Force DCDC Into CCM Mode in Low Noise Operation"]
209    #[inline(always)]
210    #[must_use]
211    pub fn lnforceccm(&mut self) -> LNFORCECCM_W<0> {
212        LNFORCECCM_W::new(self)
213    }
214    #[doc = "Bit 1 - Disable LP Mode Hysteresis in the State Machine Control"]
215    #[inline(always)]
216    #[must_use]
217    pub fn lpcmphysdis(&mut self) -> LPCMPHYSDIS_W<1> {
218        LPCMPHYSDIS_W::new(self)
219    }
220    #[doc = "Bit 2 - Comparator Threshold on the High Side"]
221    #[inline(always)]
222    #[must_use]
223    pub fn lpcmphyshi(&mut self) -> LPCMPHYSHI_W<2> {
224        LPCMPHYSHI_W::new(self)
225    }
226    #[doc = "Bit 5 - Force DCDC Into CCM Mode Immediately, Based on LNFORCECCM"]
227    #[inline(always)]
228    #[must_use]
229    pub fn lnforceccmimm(&mut self) -> LNFORCECCMIMM_W<5> {
230        LNFORCECCMIMM_W::new(self)
231    }
232    #[doc = "Bits 8:11 - PFET Switch Number Selection"]
233    #[inline(always)]
234    #[must_use]
235    pub fn pfetcnt(&mut self) -> PFETCNT_W<8> {
236        PFETCNT_W::new(self)
237    }
238    #[doc = "Bits 12:15 - NFET Switch Number Selection"]
239    #[inline(always)]
240    #[must_use]
241    pub fn nfetcnt(&mut self) -> NFETCNT_W<12> {
242        NFETCNT_W::new(self)
243    }
244    #[doc = "Bits 16:19 - Current Limit in Bypass Mode"]
245    #[inline(always)]
246    #[must_use]
247    pub fn byplimsel(&mut self) -> BYPLIMSEL_W<16> {
248        BYPLIMSEL_W::new(self)
249    }
250    #[doc = "Bits 20:22 - Current Limit Level Selection for Current Limiter in LP Mode"]
251    #[inline(always)]
252    #[must_use]
253    pub fn lpclimilimsel(&mut self) -> LPCLIMILIMSEL_W<20> {
254        LPCLIMILIMSEL_W::new(self)
255    }
256    #[doc = "Bits 24:26 - Current Limit Level Selection for Current Limiter in LN Mode"]
257    #[inline(always)]
258    #[must_use]
259    pub fn lnclimilimsel(&mut self) -> LNCLIMILIMSEL_W<24> {
260        LNCLIMILIMSEL_W::new(self)
261    }
262    #[doc = "Bits 28:29 - LP Mode Comparator Bias Selection for EM23 or EM4H"]
263    #[inline(always)]
264    #[must_use]
265    pub fn lpcmpbiasem234h(&mut self) -> LPCMPBIASEM234H_W<28> {
266        LPCMPBIASEM234H_W::new(self)
267    }
268    #[doc = "Writes raw bits to the register."]
269    #[inline(always)]
270    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
271        self.0.bits(bits);
272        self
273    }
274}
275#[doc = "DCDC Miscellaneous Control Register\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 [dcdcmiscctrl](index.html) module"]
276pub struct DCDCMISCCTRL_SPEC;
277impl crate::RegisterSpec for DCDCMISCCTRL_SPEC {
278    type Ux = u32;
279}
280#[doc = "`read()` method returns [dcdcmiscctrl::R](R) reader structure"]
281impl crate::Readable for DCDCMISCCTRL_SPEC {
282    type Reader = R;
283}
284#[doc = "`write(|w| ..)` method takes [dcdcmiscctrl::W](W) writer structure"]
285impl crate::Writable for DCDCMISCCTRL_SPEC {
286    type Writer = W;
287    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
288    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
289}
290#[doc = "`reset()` method sets DCDCMISCCTRL to value 0x0310_7706"]
291impl crate::Resettable for DCDCMISCCTRL_SPEC {
292    const RESET_VALUE: Self::Ux = 0x0310_7706;
293}