efm32pg22_pac/efm32pg22c200/dcdc_ns/
em23ctrl0.rs1#[doc = "Register `EM23CTRL0` reader"]
2pub struct R(crate::R<EM23CTRL0_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<EM23CTRL0_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<EM23CTRL0_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<EM23CTRL0_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `EM23CTRL0` writer"]
17pub struct W(crate::W<EM23CTRL0_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<EM23CTRL0_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<EM23CTRL0_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<EM23CTRL0_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `IPKVAL` reader - EM23 Peak Current Setting"]
38pub type IPKVAL_R = crate::FieldReader<u8, IPKVAL_A>;
39#[doc = "EM23 Peak Current Setting\n\nValue on reset: 3"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum IPKVAL_A {
43 #[doc = "3: Ipeak = 90mA, Iload = 5 mA"]
44 LOAD5MA = 3,
45 #[doc = "9: Ipeak = 150mA, Iload = 10 mA"]
46 LOAD10MA = 9,
47}
48impl From<IPKVAL_A> for u8 {
49 #[inline(always)]
50 fn from(variant: IPKVAL_A) -> Self {
51 variant as _
52 }
53}
54impl IPKVAL_R {
55 #[doc = "Get enumerated values variant"]
56 #[inline(always)]
57 pub fn variant(&self) -> Option<IPKVAL_A> {
58 match self.bits {
59 3 => Some(IPKVAL_A::LOAD5MA),
60 9 => Some(IPKVAL_A::LOAD10MA),
61 _ => None,
62 }
63 }
64 #[doc = "Checks if the value of the field is `LOAD5MA`"]
65 #[inline(always)]
66 pub fn is_load5ma(&self) -> bool {
67 *self == IPKVAL_A::LOAD5MA
68 }
69 #[doc = "Checks if the value of the field is `LOAD10MA`"]
70 #[inline(always)]
71 pub fn is_load10ma(&self) -> bool {
72 *self == IPKVAL_A::LOAD10MA
73 }
74}
75#[doc = "Field `IPKVAL` writer - EM23 Peak Current Setting"]
76pub type IPKVAL_W<'a, const O: u8> =
77 crate::FieldWriter<'a, u32, EM23CTRL0_SPEC, u8, IPKVAL_A, 4, O>;
78impl<'a, const O: u8> IPKVAL_W<'a, O> {
79 #[doc = "Ipeak = 90mA, Iload = 5 mA"]
80 #[inline(always)]
81 pub fn load5ma(self) -> &'a mut W {
82 self.variant(IPKVAL_A::LOAD5MA)
83 }
84 #[doc = "Ipeak = 150mA, Iload = 10 mA"]
85 #[inline(always)]
86 pub fn load10ma(self) -> &'a mut W {
87 self.variant(IPKVAL_A::LOAD10MA)
88 }
89}
90#[doc = "Field `DRVSPEED` reader - EM23 Drive Speed Setting"]
91pub type DRVSPEED_R = crate::FieldReader<u8, DRVSPEED_A>;
92#[doc = "EM23 Drive Speed Setting\n\nValue on reset: 1"]
93#[derive(Clone, Copy, Debug, PartialEq, Eq)]
94#[repr(u8)]
95pub enum DRVSPEED_A {
96 #[doc = "0: Lowest Efficiency, Lowest EMI.. Small decrease in efficiency from default setting"]
97 BEST_EMI = 0,
98 #[doc = "1: Default Efficiency, Acceptable EMI level"]
99 DEFAULT_SETTING = 1,
100 #[doc = "2: Small increase in efficiency from the default setting"]
101 INTERMEDIATE = 2,
102 #[doc = "3: Highest Efficiency, Highest EMI.. Small increase in efficiency from INTERMEDIATE setting"]
103 BEST_EFFICIENCY = 3,
104}
105impl From<DRVSPEED_A> for u8 {
106 #[inline(always)]
107 fn from(variant: DRVSPEED_A) -> Self {
108 variant as _
109 }
110}
111impl DRVSPEED_R {
112 #[doc = "Get enumerated values variant"]
113 #[inline(always)]
114 pub fn variant(&self) -> DRVSPEED_A {
115 match self.bits {
116 0 => DRVSPEED_A::BEST_EMI,
117 1 => DRVSPEED_A::DEFAULT_SETTING,
118 2 => DRVSPEED_A::INTERMEDIATE,
119 3 => DRVSPEED_A::BEST_EFFICIENCY,
120 _ => unreachable!(),
121 }
122 }
123 #[doc = "Checks if the value of the field is `BEST_EMI`"]
124 #[inline(always)]
125 pub fn is_best_emi(&self) -> bool {
126 *self == DRVSPEED_A::BEST_EMI
127 }
128 #[doc = "Checks if the value of the field is `DEFAULT_SETTING`"]
129 #[inline(always)]
130 pub fn is_default_setting(&self) -> bool {
131 *self == DRVSPEED_A::DEFAULT_SETTING
132 }
133 #[doc = "Checks if the value of the field is `INTERMEDIATE`"]
134 #[inline(always)]
135 pub fn is_intermediate(&self) -> bool {
136 *self == DRVSPEED_A::INTERMEDIATE
137 }
138 #[doc = "Checks if the value of the field is `BEST_EFFICIENCY`"]
139 #[inline(always)]
140 pub fn is_best_efficiency(&self) -> bool {
141 *self == DRVSPEED_A::BEST_EFFICIENCY
142 }
143}
144#[doc = "Field `DRVSPEED` writer - EM23 Drive Speed Setting"]
145pub type DRVSPEED_W<'a, const O: u8> =
146 crate::FieldWriterSafe<'a, u32, EM23CTRL0_SPEC, u8, DRVSPEED_A, 2, O>;
147impl<'a, const O: u8> DRVSPEED_W<'a, O> {
148 #[doc = "Lowest Efficiency, Lowest EMI.. Small decrease in efficiency from default setting"]
149 #[inline(always)]
150 pub fn best_emi(self) -> &'a mut W {
151 self.variant(DRVSPEED_A::BEST_EMI)
152 }
153 #[doc = "Default Efficiency, Acceptable EMI level"]
154 #[inline(always)]
155 pub fn default_setting(self) -> &'a mut W {
156 self.variant(DRVSPEED_A::DEFAULT_SETTING)
157 }
158 #[doc = "Small increase in efficiency from the default setting"]
159 #[inline(always)]
160 pub fn intermediate(self) -> &'a mut W {
161 self.variant(DRVSPEED_A::INTERMEDIATE)
162 }
163 #[doc = "Highest Efficiency, Highest EMI.. Small increase in efficiency from INTERMEDIATE setting"]
164 #[inline(always)]
165 pub fn best_efficiency(self) -> &'a mut W {
166 self.variant(DRVSPEED_A::BEST_EFFICIENCY)
167 }
168}
169impl R {
170 #[doc = "Bits 0:3 - EM23 Peak Current Setting"]
171 #[inline(always)]
172 pub fn ipkval(&self) -> IPKVAL_R {
173 IPKVAL_R::new((self.bits & 0x0f) as u8)
174 }
175 #[doc = "Bits 8:9 - EM23 Drive Speed Setting"]
176 #[inline(always)]
177 pub fn drvspeed(&self) -> DRVSPEED_R {
178 DRVSPEED_R::new(((self.bits >> 8) & 3) as u8)
179 }
180}
181impl W {
182 #[doc = "Bits 0:3 - EM23 Peak Current Setting"]
183 #[inline(always)]
184 #[must_use]
185 pub fn ipkval(&mut self) -> IPKVAL_W<0> {
186 IPKVAL_W::new(self)
187 }
188 #[doc = "Bits 8:9 - EM23 Drive Speed Setting"]
189 #[inline(always)]
190 #[must_use]
191 pub fn drvspeed(&mut self) -> DRVSPEED_W<8> {
192 DRVSPEED_W::new(self)
193 }
194 #[doc = "Writes raw bits to the register."]
195 #[inline(always)]
196 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
197 self.0.bits(bits);
198 self
199 }
200}
201#[doc = "EM23 Configurations\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 [em23ctrl0](index.html) module"]
202pub struct EM23CTRL0_SPEC;
203impl crate::RegisterSpec for EM23CTRL0_SPEC {
204 type Ux = u32;
205}
206#[doc = "`read()` method returns [em23ctrl0::R](R) reader structure"]
207impl crate::Readable for EM23CTRL0_SPEC {
208 type Reader = R;
209}
210#[doc = "`write(|w| ..)` method takes [em23ctrl0::W](W) writer structure"]
211impl crate::Writable for EM23CTRL0_SPEC {
212 type Writer = W;
213 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
214 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
215}
216#[doc = "`reset()` method sets EM23CTRL0 to value 0x0103"]
217impl crate::Resettable for EM23CTRL0_SPEC {
218 const RESET_VALUE: Self::Ux = 0x0103;
219}