efm32jg12b_pac/efm32jg12b500/vdac0/
opa2_ctrl.rs1#[doc = "Register `OPA2_CTRL` reader"]
2pub struct R(crate::R<OPA2_CTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<OPA2_CTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<OPA2_CTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<OPA2_CTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `OPA2_CTRL` writer"]
17pub struct W(crate::W<OPA2_CTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<OPA2_CTRL_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<OPA2_CTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<OPA2_CTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `DRIVESTRENGTH` reader - OPAx Operation Mode"]
38pub type DRIVESTRENGTH_R = crate::FieldReader<u8, DRIVESTRENGTH_A>;
39#[doc = "OPAx Operation Mode\n\nValue on reset: 2"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum DRIVESTRENGTH_A {
43 #[doc = "0: Lower accuracy with Low drive strength."]
44 _0 = 0,
45 #[doc = "1: Low accuracy with Low drive strength."]
46 _1 = 1,
47 #[doc = "2: High accuracy with High drive strength."]
48 _2 = 2,
49 #[doc = "3: Higher accuracy with High drive strength."]
50 _3 = 3,
51}
52impl From<DRIVESTRENGTH_A> for u8 {
53 #[inline(always)]
54 fn from(variant: DRIVESTRENGTH_A) -> Self {
55 variant as _
56 }
57}
58impl DRIVESTRENGTH_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> DRIVESTRENGTH_A {
62 match self.bits {
63 0 => DRIVESTRENGTH_A::_0,
64 1 => DRIVESTRENGTH_A::_1,
65 2 => DRIVESTRENGTH_A::_2,
66 3 => DRIVESTRENGTH_A::_3,
67 _ => unreachable!(),
68 }
69 }
70 #[doc = "Checks if the value of the field is `_0`"]
71 #[inline(always)]
72 pub fn is_0(&self) -> bool {
73 *self == DRIVESTRENGTH_A::_0
74 }
75 #[doc = "Checks if the value of the field is `_1`"]
76 #[inline(always)]
77 pub fn is_1(&self) -> bool {
78 *self == DRIVESTRENGTH_A::_1
79 }
80 #[doc = "Checks if the value of the field is `_2`"]
81 #[inline(always)]
82 pub fn is_2(&self) -> bool {
83 *self == DRIVESTRENGTH_A::_2
84 }
85 #[doc = "Checks if the value of the field is `_3`"]
86 #[inline(always)]
87 pub fn is_3(&self) -> bool {
88 *self == DRIVESTRENGTH_A::_3
89 }
90}
91#[doc = "Field `DRIVESTRENGTH` writer - OPAx Operation Mode"]
92pub type DRIVESTRENGTH_W<'a, const O: u8> =
93 crate::FieldWriterSafe<'a, u32, OPA2_CTRL_SPEC, u8, DRIVESTRENGTH_A, 2, O>;
94impl<'a, const O: u8> DRIVESTRENGTH_W<'a, O> {
95 #[doc = "Lower accuracy with Low drive strength."]
96 #[inline(always)]
97 pub fn _0(self) -> &'a mut W {
98 self.variant(DRIVESTRENGTH_A::_0)
99 }
100 #[doc = "Low accuracy with Low drive strength."]
101 #[inline(always)]
102 pub fn _1(self) -> &'a mut W {
103 self.variant(DRIVESTRENGTH_A::_1)
104 }
105 #[doc = "High accuracy with High drive strength."]
106 #[inline(always)]
107 pub fn _2(self) -> &'a mut W {
108 self.variant(DRIVESTRENGTH_A::_2)
109 }
110 #[doc = "Higher accuracy with High drive strength."]
111 #[inline(always)]
112 pub fn _3(self) -> &'a mut W {
113 self.variant(DRIVESTRENGTH_A::_3)
114 }
115}
116#[doc = "Field `INCBW` reader - OPAx Unity Gain Bandwidth Scale"]
117pub type INCBW_R = crate::BitReader<bool>;
118#[doc = "Field `INCBW` writer - OPAx Unity Gain Bandwidth Scale"]
119pub type INCBW_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPA2_CTRL_SPEC, bool, O>;
120#[doc = "Field `HCMDIS` reader - High Common Mode Disable"]
121pub type HCMDIS_R = crate::BitReader<bool>;
122#[doc = "Field `HCMDIS` writer - High Common Mode Disable"]
123pub type HCMDIS_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPA2_CTRL_SPEC, bool, O>;
124#[doc = "Field `OUTSCALE` reader - Scale OPAx Output Driving Strength"]
125pub type OUTSCALE_R = crate::BitReader<bool>;
126#[doc = "Field `OUTSCALE` writer - Scale OPAx Output Driving Strength"]
127pub type OUTSCALE_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPA2_CTRL_SPEC, bool, O>;
128#[doc = "Field `PRSEN` reader - OPAx PRS Trigger Enable"]
129pub type PRSEN_R = crate::BitReader<bool>;
130#[doc = "Field `PRSEN` writer - OPAx PRS Trigger Enable"]
131pub type PRSEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPA2_CTRL_SPEC, bool, O>;
132#[doc = "Field `PRSMODE` reader - OPAx PRS Trigger Mode"]
133pub type PRSMODE_R = crate::BitReader<bool>;
134#[doc = "Field `PRSMODE` writer - OPAx PRS Trigger Mode"]
135pub type PRSMODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPA2_CTRL_SPEC, bool, O>;
136#[doc = "Field `PRSSEL` reader - OPAx PRS Trigger Select"]
137pub type PRSSEL_R = crate::FieldReader<u8, PRSSEL_A>;
138#[doc = "OPAx PRS Trigger Select\n\nValue on reset: 0"]
139#[derive(Clone, Copy, Debug, PartialEq, Eq)]
140#[repr(u8)]
141pub enum PRSSEL_A {
142 #[doc = "0: PRS ch 0 triggers OPA."]
143 PRSCH0 = 0,
144 #[doc = "1: PRS ch 1 triggers OPA."]
145 PRSCH1 = 1,
146 #[doc = "2: PRS ch 2 triggers OPA."]
147 PRSCH2 = 2,
148 #[doc = "3: PRS ch 3 triggers OPA."]
149 PRSCH3 = 3,
150 #[doc = "4: PRS ch 4 triggers OPA."]
151 PRSCH4 = 4,
152 #[doc = "5: PRS ch 5 triggers OPA."]
153 PRSCH5 = 5,
154 #[doc = "6: PRS ch 6 triggers OPA."]
155 PRSCH6 = 6,
156 #[doc = "7: PRS ch 7 triggers OPA."]
157 PRSCH7 = 7,
158 #[doc = "8: PRS ch 8 triggers OPA."]
159 PRSCH8 = 8,
160 #[doc = "9: PRS ch 9 triggers OPA."]
161 PRSCH9 = 9,
162 #[doc = "10: PRS ch 10 triggers OPA."]
163 PRSCH10 = 10,
164 #[doc = "11: PRS ch 11 triggers OPA."]
165 PRSCH11 = 11,
166}
167impl From<PRSSEL_A> for u8 {
168 #[inline(always)]
169 fn from(variant: PRSSEL_A) -> Self {
170 variant as _
171 }
172}
173impl PRSSEL_R {
174 #[doc = "Get enumerated values variant"]
175 #[inline(always)]
176 pub fn variant(&self) -> Option<PRSSEL_A> {
177 match self.bits {
178 0 => Some(PRSSEL_A::PRSCH0),
179 1 => Some(PRSSEL_A::PRSCH1),
180 2 => Some(PRSSEL_A::PRSCH2),
181 3 => Some(PRSSEL_A::PRSCH3),
182 4 => Some(PRSSEL_A::PRSCH4),
183 5 => Some(PRSSEL_A::PRSCH5),
184 6 => Some(PRSSEL_A::PRSCH6),
185 7 => Some(PRSSEL_A::PRSCH7),
186 8 => Some(PRSSEL_A::PRSCH8),
187 9 => Some(PRSSEL_A::PRSCH9),
188 10 => Some(PRSSEL_A::PRSCH10),
189 11 => Some(PRSSEL_A::PRSCH11),
190 _ => None,
191 }
192 }
193 #[doc = "Checks if the value of the field is `PRSCH0`"]
194 #[inline(always)]
195 pub fn is_prsch0(&self) -> bool {
196 *self == PRSSEL_A::PRSCH0
197 }
198 #[doc = "Checks if the value of the field is `PRSCH1`"]
199 #[inline(always)]
200 pub fn is_prsch1(&self) -> bool {
201 *self == PRSSEL_A::PRSCH1
202 }
203 #[doc = "Checks if the value of the field is `PRSCH2`"]
204 #[inline(always)]
205 pub fn is_prsch2(&self) -> bool {
206 *self == PRSSEL_A::PRSCH2
207 }
208 #[doc = "Checks if the value of the field is `PRSCH3`"]
209 #[inline(always)]
210 pub fn is_prsch3(&self) -> bool {
211 *self == PRSSEL_A::PRSCH3
212 }
213 #[doc = "Checks if the value of the field is `PRSCH4`"]
214 #[inline(always)]
215 pub fn is_prsch4(&self) -> bool {
216 *self == PRSSEL_A::PRSCH4
217 }
218 #[doc = "Checks if the value of the field is `PRSCH5`"]
219 #[inline(always)]
220 pub fn is_prsch5(&self) -> bool {
221 *self == PRSSEL_A::PRSCH5
222 }
223 #[doc = "Checks if the value of the field is `PRSCH6`"]
224 #[inline(always)]
225 pub fn is_prsch6(&self) -> bool {
226 *self == PRSSEL_A::PRSCH6
227 }
228 #[doc = "Checks if the value of the field is `PRSCH7`"]
229 #[inline(always)]
230 pub fn is_prsch7(&self) -> bool {
231 *self == PRSSEL_A::PRSCH7
232 }
233 #[doc = "Checks if the value of the field is `PRSCH8`"]
234 #[inline(always)]
235 pub fn is_prsch8(&self) -> bool {
236 *self == PRSSEL_A::PRSCH8
237 }
238 #[doc = "Checks if the value of the field is `PRSCH9`"]
239 #[inline(always)]
240 pub fn is_prsch9(&self) -> bool {
241 *self == PRSSEL_A::PRSCH9
242 }
243 #[doc = "Checks if the value of the field is `PRSCH10`"]
244 #[inline(always)]
245 pub fn is_prsch10(&self) -> bool {
246 *self == PRSSEL_A::PRSCH10
247 }
248 #[doc = "Checks if the value of the field is `PRSCH11`"]
249 #[inline(always)]
250 pub fn is_prsch11(&self) -> bool {
251 *self == PRSSEL_A::PRSCH11
252 }
253}
254#[doc = "Field `PRSSEL` writer - OPAx PRS Trigger Select"]
255pub type PRSSEL_W<'a, const O: u8> =
256 crate::FieldWriter<'a, u32, OPA2_CTRL_SPEC, u8, PRSSEL_A, 4, O>;
257impl<'a, const O: u8> PRSSEL_W<'a, O> {
258 #[doc = "PRS ch 0 triggers OPA."]
259 #[inline(always)]
260 pub fn prsch0(self) -> &'a mut W {
261 self.variant(PRSSEL_A::PRSCH0)
262 }
263 #[doc = "PRS ch 1 triggers OPA."]
264 #[inline(always)]
265 pub fn prsch1(self) -> &'a mut W {
266 self.variant(PRSSEL_A::PRSCH1)
267 }
268 #[doc = "PRS ch 2 triggers OPA."]
269 #[inline(always)]
270 pub fn prsch2(self) -> &'a mut W {
271 self.variant(PRSSEL_A::PRSCH2)
272 }
273 #[doc = "PRS ch 3 triggers OPA."]
274 #[inline(always)]
275 pub fn prsch3(self) -> &'a mut W {
276 self.variant(PRSSEL_A::PRSCH3)
277 }
278 #[doc = "PRS ch 4 triggers OPA."]
279 #[inline(always)]
280 pub fn prsch4(self) -> &'a mut W {
281 self.variant(PRSSEL_A::PRSCH4)
282 }
283 #[doc = "PRS ch 5 triggers OPA."]
284 #[inline(always)]
285 pub fn prsch5(self) -> &'a mut W {
286 self.variant(PRSSEL_A::PRSCH5)
287 }
288 #[doc = "PRS ch 6 triggers OPA."]
289 #[inline(always)]
290 pub fn prsch6(self) -> &'a mut W {
291 self.variant(PRSSEL_A::PRSCH6)
292 }
293 #[doc = "PRS ch 7 triggers OPA."]
294 #[inline(always)]
295 pub fn prsch7(self) -> &'a mut W {
296 self.variant(PRSSEL_A::PRSCH7)
297 }
298 #[doc = "PRS ch 8 triggers OPA."]
299 #[inline(always)]
300 pub fn prsch8(self) -> &'a mut W {
301 self.variant(PRSSEL_A::PRSCH8)
302 }
303 #[doc = "PRS ch 9 triggers OPA."]
304 #[inline(always)]
305 pub fn prsch9(self) -> &'a mut W {
306 self.variant(PRSSEL_A::PRSCH9)
307 }
308 #[doc = "PRS ch 10 triggers OPA."]
309 #[inline(always)]
310 pub fn prsch10(self) -> &'a mut W {
311 self.variant(PRSSEL_A::PRSCH10)
312 }
313 #[doc = "PRS ch 11 triggers OPA."]
314 #[inline(always)]
315 pub fn prsch11(self) -> &'a mut W {
316 self.variant(PRSSEL_A::PRSCH11)
317 }
318}
319#[doc = "Field `PRSOUTMODE` reader - OPAx PRS Output Select"]
320pub type PRSOUTMODE_R = crate::BitReader<bool>;
321#[doc = "Field `PRSOUTMODE` writer - OPAx PRS Output Select"]
322pub type PRSOUTMODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPA2_CTRL_SPEC, bool, O>;
323#[doc = "Field `APORTXMASTERDIS` reader - APORT Bus Master Disable"]
324pub type APORTXMASTERDIS_R = crate::BitReader<bool>;
325#[doc = "Field `APORTXMASTERDIS` writer - APORT Bus Master Disable"]
326pub type APORTXMASTERDIS_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPA2_CTRL_SPEC, bool, O>;
327#[doc = "Field `APORTYMASTERDIS` reader - APORT Bus Master Disable"]
328pub type APORTYMASTERDIS_R = crate::BitReader<bool>;
329#[doc = "Field `APORTYMASTERDIS` writer - APORT Bus Master Disable"]
330pub type APORTYMASTERDIS_W<'a, const O: u8> = crate::BitWriter<'a, u32, OPA2_CTRL_SPEC, bool, O>;
331impl R {
332 #[doc = "Bits 0:1 - OPAx Operation Mode"]
333 #[inline(always)]
334 pub fn drivestrength(&self) -> DRIVESTRENGTH_R {
335 DRIVESTRENGTH_R::new((self.bits & 3) as u8)
336 }
337 #[doc = "Bit 2 - OPAx Unity Gain Bandwidth Scale"]
338 #[inline(always)]
339 pub fn incbw(&self) -> INCBW_R {
340 INCBW_R::new(((self.bits >> 2) & 1) != 0)
341 }
342 #[doc = "Bit 3 - High Common Mode Disable"]
343 #[inline(always)]
344 pub fn hcmdis(&self) -> HCMDIS_R {
345 HCMDIS_R::new(((self.bits >> 3) & 1) != 0)
346 }
347 #[doc = "Bit 4 - Scale OPAx Output Driving Strength"]
348 #[inline(always)]
349 pub fn outscale(&self) -> OUTSCALE_R {
350 OUTSCALE_R::new(((self.bits >> 4) & 1) != 0)
351 }
352 #[doc = "Bit 8 - OPAx PRS Trigger Enable"]
353 #[inline(always)]
354 pub fn prsen(&self) -> PRSEN_R {
355 PRSEN_R::new(((self.bits >> 8) & 1) != 0)
356 }
357 #[doc = "Bit 9 - OPAx PRS Trigger Mode"]
358 #[inline(always)]
359 pub fn prsmode(&self) -> PRSMODE_R {
360 PRSMODE_R::new(((self.bits >> 9) & 1) != 0)
361 }
362 #[doc = "Bits 10:13 - OPAx PRS Trigger Select"]
363 #[inline(always)]
364 pub fn prssel(&self) -> PRSSEL_R {
365 PRSSEL_R::new(((self.bits >> 10) & 0x0f) as u8)
366 }
367 #[doc = "Bit 16 - OPAx PRS Output Select"]
368 #[inline(always)]
369 pub fn prsoutmode(&self) -> PRSOUTMODE_R {
370 PRSOUTMODE_R::new(((self.bits >> 16) & 1) != 0)
371 }
372 #[doc = "Bit 20 - APORT Bus Master Disable"]
373 #[inline(always)]
374 pub fn aportxmasterdis(&self) -> APORTXMASTERDIS_R {
375 APORTXMASTERDIS_R::new(((self.bits >> 20) & 1) != 0)
376 }
377 #[doc = "Bit 21 - APORT Bus Master Disable"]
378 #[inline(always)]
379 pub fn aportymasterdis(&self) -> APORTYMASTERDIS_R {
380 APORTYMASTERDIS_R::new(((self.bits >> 21) & 1) != 0)
381 }
382}
383impl W {
384 #[doc = "Bits 0:1 - OPAx Operation Mode"]
385 #[inline(always)]
386 #[must_use]
387 pub fn drivestrength(&mut self) -> DRIVESTRENGTH_W<0> {
388 DRIVESTRENGTH_W::new(self)
389 }
390 #[doc = "Bit 2 - OPAx Unity Gain Bandwidth Scale"]
391 #[inline(always)]
392 #[must_use]
393 pub fn incbw(&mut self) -> INCBW_W<2> {
394 INCBW_W::new(self)
395 }
396 #[doc = "Bit 3 - High Common Mode Disable"]
397 #[inline(always)]
398 #[must_use]
399 pub fn hcmdis(&mut self) -> HCMDIS_W<3> {
400 HCMDIS_W::new(self)
401 }
402 #[doc = "Bit 4 - Scale OPAx Output Driving Strength"]
403 #[inline(always)]
404 #[must_use]
405 pub fn outscale(&mut self) -> OUTSCALE_W<4> {
406 OUTSCALE_W::new(self)
407 }
408 #[doc = "Bit 8 - OPAx PRS Trigger Enable"]
409 #[inline(always)]
410 #[must_use]
411 pub fn prsen(&mut self) -> PRSEN_W<8> {
412 PRSEN_W::new(self)
413 }
414 #[doc = "Bit 9 - OPAx PRS Trigger Mode"]
415 #[inline(always)]
416 #[must_use]
417 pub fn prsmode(&mut self) -> PRSMODE_W<9> {
418 PRSMODE_W::new(self)
419 }
420 #[doc = "Bits 10:13 - OPAx PRS Trigger Select"]
421 #[inline(always)]
422 #[must_use]
423 pub fn prssel(&mut self) -> PRSSEL_W<10> {
424 PRSSEL_W::new(self)
425 }
426 #[doc = "Bit 16 - OPAx PRS Output Select"]
427 #[inline(always)]
428 #[must_use]
429 pub fn prsoutmode(&mut self) -> PRSOUTMODE_W<16> {
430 PRSOUTMODE_W::new(self)
431 }
432 #[doc = "Bit 20 - APORT Bus Master Disable"]
433 #[inline(always)]
434 #[must_use]
435 pub fn aportxmasterdis(&mut self) -> APORTXMASTERDIS_W<20> {
436 APORTXMASTERDIS_W::new(self)
437 }
438 #[doc = "Bit 21 - APORT Bus Master Disable"]
439 #[inline(always)]
440 #[must_use]
441 pub fn aportymasterdis(&mut self) -> APORTYMASTERDIS_W<21> {
442 APORTYMASTERDIS_W::new(self)
443 }
444 #[doc = "Writes raw bits to the register."]
445 #[inline(always)]
446 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
447 self.0.bits(bits);
448 self
449 }
450}
451#[doc = "Operational Amplifier 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 [opa2_ctrl](index.html) module"]
452pub struct OPA2_CTRL_SPEC;
453impl crate::RegisterSpec for OPA2_CTRL_SPEC {
454 type Ux = u32;
455}
456#[doc = "`read()` method returns [opa2_ctrl::R](R) reader structure"]
457impl crate::Readable for OPA2_CTRL_SPEC {
458 type Reader = R;
459}
460#[doc = "`write(|w| ..)` method takes [opa2_ctrl::W](W) writer structure"]
461impl crate::Writable for OPA2_CTRL_SPEC {
462 type Writer = W;
463 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
464 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
465}
466#[doc = "`reset()` method sets OPA2_CTRL to value 0x0e"]
467impl crate::Resettable for OPA2_CTRL_SPEC {
468 const RESET_VALUE: Self::Ux = 0x0e;
469}