stm32l4x2_pac/opamp/
opamp1_csr.rs1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u32,
8}
9impl super::OPAMP1_CSR {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = r" Value of the field"]
46pub struct OPAENR {
47 bits: bool,
48}
49impl OPAENR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bit(&self) -> bool {
53 self.bits
54 }
55 #[doc = r" Returns `true` if the bit is clear (0)"]
56 #[inline]
57 pub fn bit_is_clear(&self) -> bool {
58 !self.bit()
59 }
60 #[doc = r" Returns `true` if the bit is set (1)"]
61 #[inline]
62 pub fn bit_is_set(&self) -> bool {
63 self.bit()
64 }
65}
66#[doc = r" Value of the field"]
67pub struct OPALPMR {
68 bits: bool,
69}
70impl OPALPMR {
71 #[doc = r" Value of the field as raw bits"]
72 #[inline]
73 pub fn bit(&self) -> bool {
74 self.bits
75 }
76 #[doc = r" Returns `true` if the bit is clear (0)"]
77 #[inline]
78 pub fn bit_is_clear(&self) -> bool {
79 !self.bit()
80 }
81 #[doc = r" Returns `true` if the bit is set (1)"]
82 #[inline]
83 pub fn bit_is_set(&self) -> bool {
84 self.bit()
85 }
86}
87#[doc = r" Value of the field"]
88pub struct OPAMODER {
89 bits: u8,
90}
91impl OPAMODER {
92 #[doc = r" Value of the field as raw bits"]
93 #[inline]
94 pub fn bits(&self) -> u8 {
95 self.bits
96 }
97}
98#[doc = r" Value of the field"]
99pub struct PGA_GAINR {
100 bits: u8,
101}
102impl PGA_GAINR {
103 #[doc = r" Value of the field as raw bits"]
104 #[inline]
105 pub fn bits(&self) -> u8 {
106 self.bits
107 }
108}
109#[doc = r" Value of the field"]
110pub struct VM_SELR {
111 bits: u8,
112}
113impl VM_SELR {
114 #[doc = r" Value of the field as raw bits"]
115 #[inline]
116 pub fn bits(&self) -> u8 {
117 self.bits
118 }
119}
120#[doc = r" Value of the field"]
121pub struct VP_SELR {
122 bits: bool,
123}
124impl VP_SELR {
125 #[doc = r" Value of the field as raw bits"]
126 #[inline]
127 pub fn bit(&self) -> bool {
128 self.bits
129 }
130 #[doc = r" Returns `true` if the bit is clear (0)"]
131 #[inline]
132 pub fn bit_is_clear(&self) -> bool {
133 !self.bit()
134 }
135 #[doc = r" Returns `true` if the bit is set (1)"]
136 #[inline]
137 pub fn bit_is_set(&self) -> bool {
138 self.bit()
139 }
140}
141#[doc = r" Value of the field"]
142pub struct CALONR {
143 bits: bool,
144}
145impl CALONR {
146 #[doc = r" Value of the field as raw bits"]
147 #[inline]
148 pub fn bit(&self) -> bool {
149 self.bits
150 }
151 #[doc = r" Returns `true` if the bit is clear (0)"]
152 #[inline]
153 pub fn bit_is_clear(&self) -> bool {
154 !self.bit()
155 }
156 #[doc = r" Returns `true` if the bit is set (1)"]
157 #[inline]
158 pub fn bit_is_set(&self) -> bool {
159 self.bit()
160 }
161}
162#[doc = r" Value of the field"]
163pub struct CALSELR {
164 bits: bool,
165}
166impl CALSELR {
167 #[doc = r" Value of the field as raw bits"]
168 #[inline]
169 pub fn bit(&self) -> bool {
170 self.bits
171 }
172 #[doc = r" Returns `true` if the bit is clear (0)"]
173 #[inline]
174 pub fn bit_is_clear(&self) -> bool {
175 !self.bit()
176 }
177 #[doc = r" Returns `true` if the bit is set (1)"]
178 #[inline]
179 pub fn bit_is_set(&self) -> bool {
180 self.bit()
181 }
182}
183#[doc = r" Value of the field"]
184pub struct USERTRIMR {
185 bits: bool,
186}
187impl USERTRIMR {
188 #[doc = r" Value of the field as raw bits"]
189 #[inline]
190 pub fn bit(&self) -> bool {
191 self.bits
192 }
193 #[doc = r" Returns `true` if the bit is clear (0)"]
194 #[inline]
195 pub fn bit_is_clear(&self) -> bool {
196 !self.bit()
197 }
198 #[doc = r" Returns `true` if the bit is set (1)"]
199 #[inline]
200 pub fn bit_is_set(&self) -> bool {
201 self.bit()
202 }
203}
204#[doc = r" Value of the field"]
205pub struct CALOUTR {
206 bits: bool,
207}
208impl CALOUTR {
209 #[doc = r" Value of the field as raw bits"]
210 #[inline]
211 pub fn bit(&self) -> bool {
212 self.bits
213 }
214 #[doc = r" Returns `true` if the bit is clear (0)"]
215 #[inline]
216 pub fn bit_is_clear(&self) -> bool {
217 !self.bit()
218 }
219 #[doc = r" Returns `true` if the bit is set (1)"]
220 #[inline]
221 pub fn bit_is_set(&self) -> bool {
222 self.bit()
223 }
224}
225#[doc = r" Value of the field"]
226pub struct OPA_RANGER {
227 bits: bool,
228}
229impl OPA_RANGER {
230 #[doc = r" Value of the field as raw bits"]
231 #[inline]
232 pub fn bit(&self) -> bool {
233 self.bits
234 }
235 #[doc = r" Returns `true` if the bit is clear (0)"]
236 #[inline]
237 pub fn bit_is_clear(&self) -> bool {
238 !self.bit()
239 }
240 #[doc = r" Returns `true` if the bit is set (1)"]
241 #[inline]
242 pub fn bit_is_set(&self) -> bool {
243 self.bit()
244 }
245}
246#[doc = r" Proxy"]
247pub struct _OPAENW<'a> {
248 w: &'a mut W,
249}
250impl<'a> _OPAENW<'a> {
251 #[doc = r" Sets the field bit"]
252 pub fn set_bit(self) -> &'a mut W {
253 self.bit(true)
254 }
255 #[doc = r" Clears the field bit"]
256 pub fn clear_bit(self) -> &'a mut W {
257 self.bit(false)
258 }
259 #[doc = r" Writes raw bits to the field"]
260 #[inline]
261 pub fn bit(self, value: bool) -> &'a mut W {
262 const MASK: bool = true;
263 const OFFSET: u8 = 0;
264 self.w.bits &= !((MASK as u32) << OFFSET);
265 self.w.bits |= ((value & MASK) as u32) << OFFSET;
266 self.w
267 }
268}
269#[doc = r" Proxy"]
270pub struct _OPALPMW<'a> {
271 w: &'a mut W,
272}
273impl<'a> _OPALPMW<'a> {
274 #[doc = r" Sets the field bit"]
275 pub fn set_bit(self) -> &'a mut W {
276 self.bit(true)
277 }
278 #[doc = r" Clears the field bit"]
279 pub fn clear_bit(self) -> &'a mut W {
280 self.bit(false)
281 }
282 #[doc = r" Writes raw bits to the field"]
283 #[inline]
284 pub fn bit(self, value: bool) -> &'a mut W {
285 const MASK: bool = true;
286 const OFFSET: u8 = 1;
287 self.w.bits &= !((MASK as u32) << OFFSET);
288 self.w.bits |= ((value & MASK) as u32) << OFFSET;
289 self.w
290 }
291}
292#[doc = r" Proxy"]
293pub struct _OPAMODEW<'a> {
294 w: &'a mut W,
295}
296impl<'a> _OPAMODEW<'a> {
297 #[doc = r" Writes raw bits to the field"]
298 #[inline]
299 pub unsafe fn bits(self, value: u8) -> &'a mut W {
300 const MASK: u8 = 3;
301 const OFFSET: u8 = 2;
302 self.w.bits &= !((MASK as u32) << OFFSET);
303 self.w.bits |= ((value & MASK) as u32) << OFFSET;
304 self.w
305 }
306}
307#[doc = r" Proxy"]
308pub struct _PGA_GAINW<'a> {
309 w: &'a mut W,
310}
311impl<'a> _PGA_GAINW<'a> {
312 #[doc = r" Writes raw bits to the field"]
313 #[inline]
314 pub unsafe fn bits(self, value: u8) -> &'a mut W {
315 const MASK: u8 = 3;
316 const OFFSET: u8 = 4;
317 self.w.bits &= !((MASK as u32) << OFFSET);
318 self.w.bits |= ((value & MASK) as u32) << OFFSET;
319 self.w
320 }
321}
322#[doc = r" Proxy"]
323pub struct _VM_SELW<'a> {
324 w: &'a mut W,
325}
326impl<'a> _VM_SELW<'a> {
327 #[doc = r" Writes raw bits to the field"]
328 #[inline]
329 pub unsafe fn bits(self, value: u8) -> &'a mut W {
330 const MASK: u8 = 3;
331 const OFFSET: u8 = 8;
332 self.w.bits &= !((MASK as u32) << OFFSET);
333 self.w.bits |= ((value & MASK) as u32) << OFFSET;
334 self.w
335 }
336}
337#[doc = r" Proxy"]
338pub struct _VP_SELW<'a> {
339 w: &'a mut W,
340}
341impl<'a> _VP_SELW<'a> {
342 #[doc = r" Sets the field bit"]
343 pub fn set_bit(self) -> &'a mut W {
344 self.bit(true)
345 }
346 #[doc = r" Clears the field bit"]
347 pub fn clear_bit(self) -> &'a mut W {
348 self.bit(false)
349 }
350 #[doc = r" Writes raw bits to the field"]
351 #[inline]
352 pub fn bit(self, value: bool) -> &'a mut W {
353 const MASK: bool = true;
354 const OFFSET: u8 = 10;
355 self.w.bits &= !((MASK as u32) << OFFSET);
356 self.w.bits |= ((value & MASK) as u32) << OFFSET;
357 self.w
358 }
359}
360#[doc = r" Proxy"]
361pub struct _CALONW<'a> {
362 w: &'a mut W,
363}
364impl<'a> _CALONW<'a> {
365 #[doc = r" Sets the field bit"]
366 pub fn set_bit(self) -> &'a mut W {
367 self.bit(true)
368 }
369 #[doc = r" Clears the field bit"]
370 pub fn clear_bit(self) -> &'a mut W {
371 self.bit(false)
372 }
373 #[doc = r" Writes raw bits to the field"]
374 #[inline]
375 pub fn bit(self, value: bool) -> &'a mut W {
376 const MASK: bool = true;
377 const OFFSET: u8 = 12;
378 self.w.bits &= !((MASK as u32) << OFFSET);
379 self.w.bits |= ((value & MASK) as u32) << OFFSET;
380 self.w
381 }
382}
383#[doc = r" Proxy"]
384pub struct _CALSELW<'a> {
385 w: &'a mut W,
386}
387impl<'a> _CALSELW<'a> {
388 #[doc = r" Sets the field bit"]
389 pub fn set_bit(self) -> &'a mut W {
390 self.bit(true)
391 }
392 #[doc = r" Clears the field bit"]
393 pub fn clear_bit(self) -> &'a mut W {
394 self.bit(false)
395 }
396 #[doc = r" Writes raw bits to the field"]
397 #[inline]
398 pub fn bit(self, value: bool) -> &'a mut W {
399 const MASK: bool = true;
400 const OFFSET: u8 = 13;
401 self.w.bits &= !((MASK as u32) << OFFSET);
402 self.w.bits |= ((value & MASK) as u32) << OFFSET;
403 self.w
404 }
405}
406#[doc = r" Proxy"]
407pub struct _USERTRIMW<'a> {
408 w: &'a mut W,
409}
410impl<'a> _USERTRIMW<'a> {
411 #[doc = r" Sets the field bit"]
412 pub fn set_bit(self) -> &'a mut W {
413 self.bit(true)
414 }
415 #[doc = r" Clears the field bit"]
416 pub fn clear_bit(self) -> &'a mut W {
417 self.bit(false)
418 }
419 #[doc = r" Writes raw bits to the field"]
420 #[inline]
421 pub fn bit(self, value: bool) -> &'a mut W {
422 const MASK: bool = true;
423 const OFFSET: u8 = 14;
424 self.w.bits &= !((MASK as u32) << OFFSET);
425 self.w.bits |= ((value & MASK) as u32) << OFFSET;
426 self.w
427 }
428}
429#[doc = r" Proxy"]
430pub struct _CALOUTW<'a> {
431 w: &'a mut W,
432}
433impl<'a> _CALOUTW<'a> {
434 #[doc = r" Sets the field bit"]
435 pub fn set_bit(self) -> &'a mut W {
436 self.bit(true)
437 }
438 #[doc = r" Clears the field bit"]
439 pub fn clear_bit(self) -> &'a mut W {
440 self.bit(false)
441 }
442 #[doc = r" Writes raw bits to the field"]
443 #[inline]
444 pub fn bit(self, value: bool) -> &'a mut W {
445 const MASK: bool = true;
446 const OFFSET: u8 = 15;
447 self.w.bits &= !((MASK as u32) << OFFSET);
448 self.w.bits |= ((value & MASK) as u32) << OFFSET;
449 self.w
450 }
451}
452#[doc = r" Proxy"]
453pub struct _OPA_RANGEW<'a> {
454 w: &'a mut W,
455}
456impl<'a> _OPA_RANGEW<'a> {
457 #[doc = r" Sets the field bit"]
458 pub fn set_bit(self) -> &'a mut W {
459 self.bit(true)
460 }
461 #[doc = r" Clears the field bit"]
462 pub fn clear_bit(self) -> &'a mut W {
463 self.bit(false)
464 }
465 #[doc = r" Writes raw bits to the field"]
466 #[inline]
467 pub fn bit(self, value: bool) -> &'a mut W {
468 const MASK: bool = true;
469 const OFFSET: u8 = 31;
470 self.w.bits &= !((MASK as u32) << OFFSET);
471 self.w.bits |= ((value & MASK) as u32) << OFFSET;
472 self.w
473 }
474}
475impl R {
476 #[doc = r" Value of the register as raw bits"]
477 #[inline]
478 pub fn bits(&self) -> u32 {
479 self.bits
480 }
481 #[doc = "Bit 0 - Operational amplifier Enable"]
482 #[inline]
483 pub fn opaen(&self) -> OPAENR {
484 let bits = {
485 const MASK: bool = true;
486 const OFFSET: u8 = 0;
487 ((self.bits >> OFFSET) & MASK as u32) != 0
488 };
489 OPAENR { bits }
490 }
491 #[doc = "Bit 1 - Operational amplifier Low Power Mode"]
492 #[inline]
493 pub fn opalpm(&self) -> OPALPMR {
494 let bits = {
495 const MASK: bool = true;
496 const OFFSET: u8 = 1;
497 ((self.bits >> OFFSET) & MASK as u32) != 0
498 };
499 OPALPMR { bits }
500 }
501 #[doc = "Bits 2:3 - Operational amplifier PGA mode"]
502 #[inline]
503 pub fn opamode(&self) -> OPAMODER {
504 let bits = {
505 const MASK: u8 = 3;
506 const OFFSET: u8 = 2;
507 ((self.bits >> OFFSET) & MASK as u32) as u8
508 };
509 OPAMODER { bits }
510 }
511 #[doc = "Bits 4:5 - Operational amplifier Programmable amplifier gain value"]
512 #[inline]
513 pub fn pga_gain(&self) -> PGA_GAINR {
514 let bits = {
515 const MASK: u8 = 3;
516 const OFFSET: u8 = 4;
517 ((self.bits >> OFFSET) & MASK as u32) as u8
518 };
519 PGA_GAINR { bits }
520 }
521 #[doc = "Bits 8:9 - Inverting input selection"]
522 #[inline]
523 pub fn vm_sel(&self) -> VM_SELR {
524 let bits = {
525 const MASK: u8 = 3;
526 const OFFSET: u8 = 8;
527 ((self.bits >> OFFSET) & MASK as u32) as u8
528 };
529 VM_SELR { bits }
530 }
531 #[doc = "Bit 10 - Non inverted input selection"]
532 #[inline]
533 pub fn vp_sel(&self) -> VP_SELR {
534 let bits = {
535 const MASK: bool = true;
536 const OFFSET: u8 = 10;
537 ((self.bits >> OFFSET) & MASK as u32) != 0
538 };
539 VP_SELR { bits }
540 }
541 #[doc = "Bit 12 - Calibration mode enabled"]
542 #[inline]
543 pub fn calon(&self) -> CALONR {
544 let bits = {
545 const MASK: bool = true;
546 const OFFSET: u8 = 12;
547 ((self.bits >> OFFSET) & MASK as u32) != 0
548 };
549 CALONR { bits }
550 }
551 #[doc = "Bit 13 - Calibration selection"]
552 #[inline]
553 pub fn calsel(&self) -> CALSELR {
554 let bits = {
555 const MASK: bool = true;
556 const OFFSET: u8 = 13;
557 ((self.bits >> OFFSET) & MASK as u32) != 0
558 };
559 CALSELR { bits }
560 }
561 #[doc = "Bit 14 - allows to switch from AOP offset trimmed values to AOP offset"]
562 #[inline]
563 pub fn usertrim(&self) -> USERTRIMR {
564 let bits = {
565 const MASK: bool = true;
566 const OFFSET: u8 = 14;
567 ((self.bits >> OFFSET) & MASK as u32) != 0
568 };
569 USERTRIMR { bits }
570 }
571 #[doc = "Bit 15 - Operational amplifier calibration output"]
572 #[inline]
573 pub fn calout(&self) -> CALOUTR {
574 let bits = {
575 const MASK: bool = true;
576 const OFFSET: u8 = 15;
577 ((self.bits >> OFFSET) & MASK as u32) != 0
578 };
579 CALOUTR { bits }
580 }
581 #[doc = "Bit 31 - Operational amplifier power supply range for stability"]
582 #[inline]
583 pub fn opa_range(&self) -> OPA_RANGER {
584 let bits = {
585 const MASK: bool = true;
586 const OFFSET: u8 = 31;
587 ((self.bits >> OFFSET) & MASK as u32) != 0
588 };
589 OPA_RANGER { bits }
590 }
591}
592impl W {
593 #[doc = r" Reset value of the register"]
594 #[inline]
595 pub fn reset_value() -> W {
596 W { bits: 0 }
597 }
598 #[doc = r" Writes raw bits to the register"]
599 #[inline]
600 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
601 self.bits = bits;
602 self
603 }
604 #[doc = "Bit 0 - Operational amplifier Enable"]
605 #[inline]
606 pub fn opaen(&mut self) -> _OPAENW {
607 _OPAENW { w: self }
608 }
609 #[doc = "Bit 1 - Operational amplifier Low Power Mode"]
610 #[inline]
611 pub fn opalpm(&mut self) -> _OPALPMW {
612 _OPALPMW { w: self }
613 }
614 #[doc = "Bits 2:3 - Operational amplifier PGA mode"]
615 #[inline]
616 pub fn opamode(&mut self) -> _OPAMODEW {
617 _OPAMODEW { w: self }
618 }
619 #[doc = "Bits 4:5 - Operational amplifier Programmable amplifier gain value"]
620 #[inline]
621 pub fn pga_gain(&mut self) -> _PGA_GAINW {
622 _PGA_GAINW { w: self }
623 }
624 #[doc = "Bits 8:9 - Inverting input selection"]
625 #[inline]
626 pub fn vm_sel(&mut self) -> _VM_SELW {
627 _VM_SELW { w: self }
628 }
629 #[doc = "Bit 10 - Non inverted input selection"]
630 #[inline]
631 pub fn vp_sel(&mut self) -> _VP_SELW {
632 _VP_SELW { w: self }
633 }
634 #[doc = "Bit 12 - Calibration mode enabled"]
635 #[inline]
636 pub fn calon(&mut self) -> _CALONW {
637 _CALONW { w: self }
638 }
639 #[doc = "Bit 13 - Calibration selection"]
640 #[inline]
641 pub fn calsel(&mut self) -> _CALSELW {
642 _CALSELW { w: self }
643 }
644 #[doc = "Bit 14 - allows to switch from AOP offset trimmed values to AOP offset"]
645 #[inline]
646 pub fn usertrim(&mut self) -> _USERTRIMW {
647 _USERTRIMW { w: self }
648 }
649 #[doc = "Bit 15 - Operational amplifier calibration output"]
650 #[inline]
651 pub fn calout(&mut self) -> _CALOUTW {
652 _CALOUTW { w: self }
653 }
654 #[doc = "Bit 31 - Operational amplifier power supply range for stability"]
655 #[inline]
656 pub fn opa_range(&mut self) -> _OPA_RANGEW {
657 _OPA_RANGEW { w: self }
658 }
659}