efm32pg22_pac/efm32pg22c200/hfxo0_ns/
xtalctrl.rs1#[doc = "Register `XTALCTRL` reader"]
2pub struct R(crate::R<XTALCTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<XTALCTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<XTALCTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<XTALCTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `XTALCTRL` writer"]
17pub struct W(crate::W<XTALCTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<XTALCTRL_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<XTALCTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<XTALCTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `COREBIASANA` reader - Core Bias Current"]
38pub type COREBIASANA_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `COREBIASANA` writer - Core Bias Current"]
40pub type COREBIASANA_W<'a, const O: u8> = crate::FieldWriter<'a, u32, XTALCTRL_SPEC, u8, u8, 8, O>;
41#[doc = "Field `CTUNEXIANA` reader - Tuning Capacitance on XI"]
42pub type CTUNEXIANA_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `CTUNEXIANA` writer - Tuning Capacitance on XI"]
44pub type CTUNEXIANA_W<'a, const O: u8> = crate::FieldWriter<'a, u32, XTALCTRL_SPEC, u8, u8, 8, O>;
45#[doc = "Field `CTUNEXOANA` reader - Tuning Capacitance on XO"]
46pub type CTUNEXOANA_R = crate::FieldReader<u8, u8>;
47#[doc = "Field `CTUNEXOANA` writer - Tuning Capacitance on XO"]
48pub type CTUNEXOANA_W<'a, const O: u8> = crate::FieldWriter<'a, u32, XTALCTRL_SPEC, u8, u8, 8, O>;
49#[doc = "Field `CTUNEFIXANA` reader - Fixed Tuning Capacitance"]
50pub type CTUNEFIXANA_R = crate::FieldReader<u8, CTUNEFIXANA_A>;
51#[doc = "Fixed Tuning Capacitance\n\nValue on reset: 3"]
52#[derive(Clone, Copy, Debug, PartialEq, Eq)]
53#[repr(u8)]
54pub enum CTUNEFIXANA_A {
55 #[doc = "0: Remove fixed capacitance on XI and XO nodes"]
56 NONE = 0,
57 #[doc = "1: Adds fixed capacitance on XI node"]
58 XI = 1,
59 #[doc = "2: Adds fixed capacitance on XO node"]
60 XO = 2,
61 #[doc = "3: Adds fixed capacitance on both XI and XO nodes"]
62 BOTH = 3,
63}
64impl From<CTUNEFIXANA_A> for u8 {
65 #[inline(always)]
66 fn from(variant: CTUNEFIXANA_A) -> Self {
67 variant as _
68 }
69}
70impl CTUNEFIXANA_R {
71 #[doc = "Get enumerated values variant"]
72 #[inline(always)]
73 pub fn variant(&self) -> CTUNEFIXANA_A {
74 match self.bits {
75 0 => CTUNEFIXANA_A::NONE,
76 1 => CTUNEFIXANA_A::XI,
77 2 => CTUNEFIXANA_A::XO,
78 3 => CTUNEFIXANA_A::BOTH,
79 _ => unreachable!(),
80 }
81 }
82 #[doc = "Checks if the value of the field is `NONE`"]
83 #[inline(always)]
84 pub fn is_none(&self) -> bool {
85 *self == CTUNEFIXANA_A::NONE
86 }
87 #[doc = "Checks if the value of the field is `XI`"]
88 #[inline(always)]
89 pub fn is_xi(&self) -> bool {
90 *self == CTUNEFIXANA_A::XI
91 }
92 #[doc = "Checks if the value of the field is `XO`"]
93 #[inline(always)]
94 pub fn is_xo(&self) -> bool {
95 *self == CTUNEFIXANA_A::XO
96 }
97 #[doc = "Checks if the value of the field is `BOTH`"]
98 #[inline(always)]
99 pub fn is_both(&self) -> bool {
100 *self == CTUNEFIXANA_A::BOTH
101 }
102}
103#[doc = "Field `CTUNEFIXANA` writer - Fixed Tuning Capacitance"]
104pub type CTUNEFIXANA_W<'a, const O: u8> =
105 crate::FieldWriterSafe<'a, u32, XTALCTRL_SPEC, u8, CTUNEFIXANA_A, 2, O>;
106impl<'a, const O: u8> CTUNEFIXANA_W<'a, O> {
107 #[doc = "Remove fixed capacitance on XI and XO nodes"]
108 #[inline(always)]
109 pub fn none(self) -> &'a mut W {
110 self.variant(CTUNEFIXANA_A::NONE)
111 }
112 #[doc = "Adds fixed capacitance on XI node"]
113 #[inline(always)]
114 pub fn xi(self) -> &'a mut W {
115 self.variant(CTUNEFIXANA_A::XI)
116 }
117 #[doc = "Adds fixed capacitance on XO node"]
118 #[inline(always)]
119 pub fn xo(self) -> &'a mut W {
120 self.variant(CTUNEFIXANA_A::XO)
121 }
122 #[doc = "Adds fixed capacitance on both XI and XO nodes"]
123 #[inline(always)]
124 pub fn both(self) -> &'a mut W {
125 self.variant(CTUNEFIXANA_A::BOTH)
126 }
127}
128#[doc = "Field `COREDGENANA` reader - Core Degeneration"]
129pub type COREDGENANA_R = crate::FieldReader<u8, COREDGENANA_A>;
130#[doc = "Core Degeneration\n\nValue on reset: 3"]
131#[derive(Clone, Copy, Debug, PartialEq, Eq)]
132#[repr(u8)]
133pub enum COREDGENANA_A {
134 #[doc = "0: Do not apply core degeneration resistence"]
135 NONE = 0,
136 #[doc = "1: Apply 33 ohm core degeneration resistence"]
137 DGEN33 = 1,
138 #[doc = "2: Apply 50 ohm core degeneration resistence"]
139 DGEN50 = 2,
140 #[doc = "3: Apply 100 ohm core degeneration resistence"]
141 DGEN100 = 3,
142}
143impl From<COREDGENANA_A> for u8 {
144 #[inline(always)]
145 fn from(variant: COREDGENANA_A) -> Self {
146 variant as _
147 }
148}
149impl COREDGENANA_R {
150 #[doc = "Get enumerated values variant"]
151 #[inline(always)]
152 pub fn variant(&self) -> COREDGENANA_A {
153 match self.bits {
154 0 => COREDGENANA_A::NONE,
155 1 => COREDGENANA_A::DGEN33,
156 2 => COREDGENANA_A::DGEN50,
157 3 => COREDGENANA_A::DGEN100,
158 _ => unreachable!(),
159 }
160 }
161 #[doc = "Checks if the value of the field is `NONE`"]
162 #[inline(always)]
163 pub fn is_none(&self) -> bool {
164 *self == COREDGENANA_A::NONE
165 }
166 #[doc = "Checks if the value of the field is `DGEN33`"]
167 #[inline(always)]
168 pub fn is_dgen33(&self) -> bool {
169 *self == COREDGENANA_A::DGEN33
170 }
171 #[doc = "Checks if the value of the field is `DGEN50`"]
172 #[inline(always)]
173 pub fn is_dgen50(&self) -> bool {
174 *self == COREDGENANA_A::DGEN50
175 }
176 #[doc = "Checks if the value of the field is `DGEN100`"]
177 #[inline(always)]
178 pub fn is_dgen100(&self) -> bool {
179 *self == COREDGENANA_A::DGEN100
180 }
181}
182#[doc = "Field `COREDGENANA` writer - Core Degeneration"]
183pub type COREDGENANA_W<'a, const O: u8> =
184 crate::FieldWriterSafe<'a, u32, XTALCTRL_SPEC, u8, COREDGENANA_A, 2, O>;
185impl<'a, const O: u8> COREDGENANA_W<'a, O> {
186 #[doc = "Do not apply core degeneration resistence"]
187 #[inline(always)]
188 pub fn none(self) -> &'a mut W {
189 self.variant(COREDGENANA_A::NONE)
190 }
191 #[doc = "Apply 33 ohm core degeneration resistence"]
192 #[inline(always)]
193 pub fn dgen33(self) -> &'a mut W {
194 self.variant(COREDGENANA_A::DGEN33)
195 }
196 #[doc = "Apply 50 ohm core degeneration resistence"]
197 #[inline(always)]
198 pub fn dgen50(self) -> &'a mut W {
199 self.variant(COREDGENANA_A::DGEN50)
200 }
201 #[doc = "Apply 100 ohm core degeneration resistence"]
202 #[inline(always)]
203 pub fn dgen100(self) -> &'a mut W {
204 self.variant(COREDGENANA_A::DGEN100)
205 }
206}
207#[doc = "Field `SKIPCOREBIASOPT` reader - Skip Core Bias Optimization"]
208pub type SKIPCOREBIASOPT_R = crate::BitReader<bool>;
209#[doc = "Field `SKIPCOREBIASOPT` writer - Skip Core Bias Optimization"]
210pub type SKIPCOREBIASOPT_W<'a, const O: u8> = crate::BitWriter<'a, u32, XTALCTRL_SPEC, bool, O>;
211impl R {
212 #[doc = "Bits 0:7 - Core Bias Current"]
213 #[inline(always)]
214 pub fn corebiasana(&self) -> COREBIASANA_R {
215 COREBIASANA_R::new((self.bits & 0xff) as u8)
216 }
217 #[doc = "Bits 8:15 - Tuning Capacitance on XI"]
218 #[inline(always)]
219 pub fn ctunexiana(&self) -> CTUNEXIANA_R {
220 CTUNEXIANA_R::new(((self.bits >> 8) & 0xff) as u8)
221 }
222 #[doc = "Bits 16:23 - Tuning Capacitance on XO"]
223 #[inline(always)]
224 pub fn ctunexoana(&self) -> CTUNEXOANA_R {
225 CTUNEXOANA_R::new(((self.bits >> 16) & 0xff) as u8)
226 }
227 #[doc = "Bits 24:25 - Fixed Tuning Capacitance"]
228 #[inline(always)]
229 pub fn ctunefixana(&self) -> CTUNEFIXANA_R {
230 CTUNEFIXANA_R::new(((self.bits >> 24) & 3) as u8)
231 }
232 #[doc = "Bits 26:27 - Core Degeneration"]
233 #[inline(always)]
234 pub fn coredgenana(&self) -> COREDGENANA_R {
235 COREDGENANA_R::new(((self.bits >> 26) & 3) as u8)
236 }
237 #[doc = "Bit 31 - Skip Core Bias Optimization"]
238 #[inline(always)]
239 pub fn skipcorebiasopt(&self) -> SKIPCOREBIASOPT_R {
240 SKIPCOREBIASOPT_R::new(((self.bits >> 31) & 1) != 0)
241 }
242}
243impl W {
244 #[doc = "Bits 0:7 - Core Bias Current"]
245 #[inline(always)]
246 #[must_use]
247 pub fn corebiasana(&mut self) -> COREBIASANA_W<0> {
248 COREBIASANA_W::new(self)
249 }
250 #[doc = "Bits 8:15 - Tuning Capacitance on XI"]
251 #[inline(always)]
252 #[must_use]
253 pub fn ctunexiana(&mut self) -> CTUNEXIANA_W<8> {
254 CTUNEXIANA_W::new(self)
255 }
256 #[doc = "Bits 16:23 - Tuning Capacitance on XO"]
257 #[inline(always)]
258 #[must_use]
259 pub fn ctunexoana(&mut self) -> CTUNEXOANA_W<16> {
260 CTUNEXOANA_W::new(self)
261 }
262 #[doc = "Bits 24:25 - Fixed Tuning Capacitance"]
263 #[inline(always)]
264 #[must_use]
265 pub fn ctunefixana(&mut self) -> CTUNEFIXANA_W<24> {
266 CTUNEFIXANA_W::new(self)
267 }
268 #[doc = "Bits 26:27 - Core Degeneration"]
269 #[inline(always)]
270 #[must_use]
271 pub fn coredgenana(&mut self) -> COREDGENANA_W<26> {
272 COREDGENANA_W::new(self)
273 }
274 #[doc = "Bit 31 - Skip Core Bias Optimization"]
275 #[inline(always)]
276 #[must_use]
277 pub fn skipcorebiasopt(&mut self) -> SKIPCOREBIASOPT_W<31> {
278 SKIPCOREBIASOPT_W::new(self)
279 }
280 #[doc = "Writes raw bits to the register."]
281 #[inline(always)]
282 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
283 self.0.bits(bits);
284 self
285 }
286}
287#[doc = "No Description\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 [xtalctrl](index.html) module"]
288pub struct XTALCTRL_SPEC;
289impl crate::RegisterSpec for XTALCTRL_SPEC {
290 type Ux = u32;
291}
292#[doc = "`read()` method returns [xtalctrl::R](R) reader structure"]
293impl crate::Readable for XTALCTRL_SPEC {
294 type Reader = R;
295}
296#[doc = "`write(|w| ..)` method takes [xtalctrl::W](W) writer structure"]
297impl crate::Writable for XTALCTRL_SPEC {
298 type Writer = W;
299 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
300 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
301}
302#[doc = "`reset()` method sets XTALCTRL to value 0x0f8c_8c10"]
303impl crate::Resettable for XTALCTRL_SPEC {
304 const RESET_VALUE: Self::Ux = 0x0f8c_8c10;
305}