stm32l4x2_pac/adc/
cr.rs

1#[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::CR {
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 ADCALR {
47    bits: bool,
48}
49impl ADCALR {
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 ADCALDIFR {
68    bits: bool,
69}
70impl ADCALDIFR {
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 DEEPPWDR {
89    bits: bool,
90}
91impl DEEPPWDR {
92    #[doc = r" Value of the field as raw bits"]
93    #[inline]
94    pub fn bit(&self) -> bool {
95        self.bits
96    }
97    #[doc = r" Returns `true` if the bit is clear (0)"]
98    #[inline]
99    pub fn bit_is_clear(&self) -> bool {
100        !self.bit()
101    }
102    #[doc = r" Returns `true` if the bit is set (1)"]
103    #[inline]
104    pub fn bit_is_set(&self) -> bool {
105        self.bit()
106    }
107}
108#[doc = r" Value of the field"]
109pub struct ADVREGENR {
110    bits: bool,
111}
112impl ADVREGENR {
113    #[doc = r" Value of the field as raw bits"]
114    #[inline]
115    pub fn bit(&self) -> bool {
116        self.bits
117    }
118    #[doc = r" Returns `true` if the bit is clear (0)"]
119    #[inline]
120    pub fn bit_is_clear(&self) -> bool {
121        !self.bit()
122    }
123    #[doc = r" Returns `true` if the bit is set (1)"]
124    #[inline]
125    pub fn bit_is_set(&self) -> bool {
126        self.bit()
127    }
128}
129#[doc = r" Value of the field"]
130pub struct JADSTPR {
131    bits: bool,
132}
133impl JADSTPR {
134    #[doc = r" Value of the field as raw bits"]
135    #[inline]
136    pub fn bit(&self) -> bool {
137        self.bits
138    }
139    #[doc = r" Returns `true` if the bit is clear (0)"]
140    #[inline]
141    pub fn bit_is_clear(&self) -> bool {
142        !self.bit()
143    }
144    #[doc = r" Returns `true` if the bit is set (1)"]
145    #[inline]
146    pub fn bit_is_set(&self) -> bool {
147        self.bit()
148    }
149}
150#[doc = r" Value of the field"]
151pub struct ADSTPR {
152    bits: bool,
153}
154impl ADSTPR {
155    #[doc = r" Value of the field as raw bits"]
156    #[inline]
157    pub fn bit(&self) -> bool {
158        self.bits
159    }
160    #[doc = r" Returns `true` if the bit is clear (0)"]
161    #[inline]
162    pub fn bit_is_clear(&self) -> bool {
163        !self.bit()
164    }
165    #[doc = r" Returns `true` if the bit is set (1)"]
166    #[inline]
167    pub fn bit_is_set(&self) -> bool {
168        self.bit()
169    }
170}
171#[doc = r" Value of the field"]
172pub struct JADSTARTR {
173    bits: bool,
174}
175impl JADSTARTR {
176    #[doc = r" Value of the field as raw bits"]
177    #[inline]
178    pub fn bit(&self) -> bool {
179        self.bits
180    }
181    #[doc = r" Returns `true` if the bit is clear (0)"]
182    #[inline]
183    pub fn bit_is_clear(&self) -> bool {
184        !self.bit()
185    }
186    #[doc = r" Returns `true` if the bit is set (1)"]
187    #[inline]
188    pub fn bit_is_set(&self) -> bool {
189        self.bit()
190    }
191}
192#[doc = r" Value of the field"]
193pub struct ADSTARTR {
194    bits: bool,
195}
196impl ADSTARTR {
197    #[doc = r" Value of the field as raw bits"]
198    #[inline]
199    pub fn bit(&self) -> bool {
200        self.bits
201    }
202    #[doc = r" Returns `true` if the bit is clear (0)"]
203    #[inline]
204    pub fn bit_is_clear(&self) -> bool {
205        !self.bit()
206    }
207    #[doc = r" Returns `true` if the bit is set (1)"]
208    #[inline]
209    pub fn bit_is_set(&self) -> bool {
210        self.bit()
211    }
212}
213#[doc = r" Value of the field"]
214pub struct ADDISR {
215    bits: bool,
216}
217impl ADDISR {
218    #[doc = r" Value of the field as raw bits"]
219    #[inline]
220    pub fn bit(&self) -> bool {
221        self.bits
222    }
223    #[doc = r" Returns `true` if the bit is clear (0)"]
224    #[inline]
225    pub fn bit_is_clear(&self) -> bool {
226        !self.bit()
227    }
228    #[doc = r" Returns `true` if the bit is set (1)"]
229    #[inline]
230    pub fn bit_is_set(&self) -> bool {
231        self.bit()
232    }
233}
234#[doc = r" Value of the field"]
235pub struct ADENR {
236    bits: bool,
237}
238impl ADENR {
239    #[doc = r" Value of the field as raw bits"]
240    #[inline]
241    pub fn bit(&self) -> bool {
242        self.bits
243    }
244    #[doc = r" Returns `true` if the bit is clear (0)"]
245    #[inline]
246    pub fn bit_is_clear(&self) -> bool {
247        !self.bit()
248    }
249    #[doc = r" Returns `true` if the bit is set (1)"]
250    #[inline]
251    pub fn bit_is_set(&self) -> bool {
252        self.bit()
253    }
254}
255#[doc = r" Proxy"]
256pub struct _ADCALW<'a> {
257    w: &'a mut W,
258}
259impl<'a> _ADCALW<'a> {
260    #[doc = r" Sets the field bit"]
261    pub fn set_bit(self) -> &'a mut W {
262        self.bit(true)
263    }
264    #[doc = r" Clears the field bit"]
265    pub fn clear_bit(self) -> &'a mut W {
266        self.bit(false)
267    }
268    #[doc = r" Writes raw bits to the field"]
269    #[inline]
270    pub fn bit(self, value: bool) -> &'a mut W {
271        const MASK: bool = true;
272        const OFFSET: u8 = 31;
273        self.w.bits &= !((MASK as u32) << OFFSET);
274        self.w.bits |= ((value & MASK) as u32) << OFFSET;
275        self.w
276    }
277}
278#[doc = r" Proxy"]
279pub struct _ADCALDIFW<'a> {
280    w: &'a mut W,
281}
282impl<'a> _ADCALDIFW<'a> {
283    #[doc = r" Sets the field bit"]
284    pub fn set_bit(self) -> &'a mut W {
285        self.bit(true)
286    }
287    #[doc = r" Clears the field bit"]
288    pub fn clear_bit(self) -> &'a mut W {
289        self.bit(false)
290    }
291    #[doc = r" Writes raw bits to the field"]
292    #[inline]
293    pub fn bit(self, value: bool) -> &'a mut W {
294        const MASK: bool = true;
295        const OFFSET: u8 = 30;
296        self.w.bits &= !((MASK as u32) << OFFSET);
297        self.w.bits |= ((value & MASK) as u32) << OFFSET;
298        self.w
299    }
300}
301#[doc = r" Proxy"]
302pub struct _DEEPPWDW<'a> {
303    w: &'a mut W,
304}
305impl<'a> _DEEPPWDW<'a> {
306    #[doc = r" Sets the field bit"]
307    pub fn set_bit(self) -> &'a mut W {
308        self.bit(true)
309    }
310    #[doc = r" Clears the field bit"]
311    pub fn clear_bit(self) -> &'a mut W {
312        self.bit(false)
313    }
314    #[doc = r" Writes raw bits to the field"]
315    #[inline]
316    pub fn bit(self, value: bool) -> &'a mut W {
317        const MASK: bool = true;
318        const OFFSET: u8 = 29;
319        self.w.bits &= !((MASK as u32) << OFFSET);
320        self.w.bits |= ((value & MASK) as u32) << OFFSET;
321        self.w
322    }
323}
324#[doc = r" Proxy"]
325pub struct _ADVREGENW<'a> {
326    w: &'a mut W,
327}
328impl<'a> _ADVREGENW<'a> {
329    #[doc = r" Sets the field bit"]
330    pub fn set_bit(self) -> &'a mut W {
331        self.bit(true)
332    }
333    #[doc = r" Clears the field bit"]
334    pub fn clear_bit(self) -> &'a mut W {
335        self.bit(false)
336    }
337    #[doc = r" Writes raw bits to the field"]
338    #[inline]
339    pub fn bit(self, value: bool) -> &'a mut W {
340        const MASK: bool = true;
341        const OFFSET: u8 = 28;
342        self.w.bits &= !((MASK as u32) << OFFSET);
343        self.w.bits |= ((value & MASK) as u32) << OFFSET;
344        self.w
345    }
346}
347#[doc = r" Proxy"]
348pub struct _JADSTPW<'a> {
349    w: &'a mut W,
350}
351impl<'a> _JADSTPW<'a> {
352    #[doc = r" Sets the field bit"]
353    pub fn set_bit(self) -> &'a mut W {
354        self.bit(true)
355    }
356    #[doc = r" Clears the field bit"]
357    pub fn clear_bit(self) -> &'a mut W {
358        self.bit(false)
359    }
360    #[doc = r" Writes raw bits to the field"]
361    #[inline]
362    pub fn bit(self, value: bool) -> &'a mut W {
363        const MASK: bool = true;
364        const OFFSET: u8 = 5;
365        self.w.bits &= !((MASK as u32) << OFFSET);
366        self.w.bits |= ((value & MASK) as u32) << OFFSET;
367        self.w
368    }
369}
370#[doc = r" Proxy"]
371pub struct _ADSTPW<'a> {
372    w: &'a mut W,
373}
374impl<'a> _ADSTPW<'a> {
375    #[doc = r" Sets the field bit"]
376    pub fn set_bit(self) -> &'a mut W {
377        self.bit(true)
378    }
379    #[doc = r" Clears the field bit"]
380    pub fn clear_bit(self) -> &'a mut W {
381        self.bit(false)
382    }
383    #[doc = r" Writes raw bits to the field"]
384    #[inline]
385    pub fn bit(self, value: bool) -> &'a mut W {
386        const MASK: bool = true;
387        const OFFSET: u8 = 4;
388        self.w.bits &= !((MASK as u32) << OFFSET);
389        self.w.bits |= ((value & MASK) as u32) << OFFSET;
390        self.w
391    }
392}
393#[doc = r" Proxy"]
394pub struct _JADSTARTW<'a> {
395    w: &'a mut W,
396}
397impl<'a> _JADSTARTW<'a> {
398    #[doc = r" Sets the field bit"]
399    pub fn set_bit(self) -> &'a mut W {
400        self.bit(true)
401    }
402    #[doc = r" Clears the field bit"]
403    pub fn clear_bit(self) -> &'a mut W {
404        self.bit(false)
405    }
406    #[doc = r" Writes raw bits to the field"]
407    #[inline]
408    pub fn bit(self, value: bool) -> &'a mut W {
409        const MASK: bool = true;
410        const OFFSET: u8 = 3;
411        self.w.bits &= !((MASK as u32) << OFFSET);
412        self.w.bits |= ((value & MASK) as u32) << OFFSET;
413        self.w
414    }
415}
416#[doc = r" Proxy"]
417pub struct _ADSTARTW<'a> {
418    w: &'a mut W,
419}
420impl<'a> _ADSTARTW<'a> {
421    #[doc = r" Sets the field bit"]
422    pub fn set_bit(self) -> &'a mut W {
423        self.bit(true)
424    }
425    #[doc = r" Clears the field bit"]
426    pub fn clear_bit(self) -> &'a mut W {
427        self.bit(false)
428    }
429    #[doc = r" Writes raw bits to the field"]
430    #[inline]
431    pub fn bit(self, value: bool) -> &'a mut W {
432        const MASK: bool = true;
433        const OFFSET: u8 = 2;
434        self.w.bits &= !((MASK as u32) << OFFSET);
435        self.w.bits |= ((value & MASK) as u32) << OFFSET;
436        self.w
437    }
438}
439#[doc = r" Proxy"]
440pub struct _ADDISW<'a> {
441    w: &'a mut W,
442}
443impl<'a> _ADDISW<'a> {
444    #[doc = r" Sets the field bit"]
445    pub fn set_bit(self) -> &'a mut W {
446        self.bit(true)
447    }
448    #[doc = r" Clears the field bit"]
449    pub fn clear_bit(self) -> &'a mut W {
450        self.bit(false)
451    }
452    #[doc = r" Writes raw bits to the field"]
453    #[inline]
454    pub fn bit(self, value: bool) -> &'a mut W {
455        const MASK: bool = true;
456        const OFFSET: u8 = 1;
457        self.w.bits &= !((MASK as u32) << OFFSET);
458        self.w.bits |= ((value & MASK) as u32) << OFFSET;
459        self.w
460    }
461}
462#[doc = r" Proxy"]
463pub struct _ADENW<'a> {
464    w: &'a mut W,
465}
466impl<'a> _ADENW<'a> {
467    #[doc = r" Sets the field bit"]
468    pub fn set_bit(self) -> &'a mut W {
469        self.bit(true)
470    }
471    #[doc = r" Clears the field bit"]
472    pub fn clear_bit(self) -> &'a mut W {
473        self.bit(false)
474    }
475    #[doc = r" Writes raw bits to the field"]
476    #[inline]
477    pub fn bit(self, value: bool) -> &'a mut W {
478        const MASK: bool = true;
479        const OFFSET: u8 = 0;
480        self.w.bits &= !((MASK as u32) << OFFSET);
481        self.w.bits |= ((value & MASK) as u32) << OFFSET;
482        self.w
483    }
484}
485impl R {
486    #[doc = r" Value of the register as raw bits"]
487    #[inline]
488    pub fn bits(&self) -> u32 {
489        self.bits
490    }
491    #[doc = "Bit 31 - ADCAL"]
492    #[inline]
493    pub fn adcal(&self) -> ADCALR {
494        let bits = {
495            const MASK: bool = true;
496            const OFFSET: u8 = 31;
497            ((self.bits >> OFFSET) & MASK as u32) != 0
498        };
499        ADCALR { bits }
500    }
501    #[doc = "Bit 30 - ADCALDIF"]
502    #[inline]
503    pub fn adcaldif(&self) -> ADCALDIFR {
504        let bits = {
505            const MASK: bool = true;
506            const OFFSET: u8 = 30;
507            ((self.bits >> OFFSET) & MASK as u32) != 0
508        };
509        ADCALDIFR { bits }
510    }
511    #[doc = "Bit 29 - DEEPPWD"]
512    #[inline]
513    pub fn deeppwd(&self) -> DEEPPWDR {
514        let bits = {
515            const MASK: bool = true;
516            const OFFSET: u8 = 29;
517            ((self.bits >> OFFSET) & MASK as u32) != 0
518        };
519        DEEPPWDR { bits }
520    }
521    #[doc = "Bit 28 - ADVREGEN"]
522    #[inline]
523    pub fn advregen(&self) -> ADVREGENR {
524        let bits = {
525            const MASK: bool = true;
526            const OFFSET: u8 = 28;
527            ((self.bits >> OFFSET) & MASK as u32) != 0
528        };
529        ADVREGENR { bits }
530    }
531    #[doc = "Bit 5 - JADSTP"]
532    #[inline]
533    pub fn jadstp(&self) -> JADSTPR {
534        let bits = {
535            const MASK: bool = true;
536            const OFFSET: u8 = 5;
537            ((self.bits >> OFFSET) & MASK as u32) != 0
538        };
539        JADSTPR { bits }
540    }
541    #[doc = "Bit 4 - ADSTP"]
542    #[inline]
543    pub fn adstp(&self) -> ADSTPR {
544        let bits = {
545            const MASK: bool = true;
546            const OFFSET: u8 = 4;
547            ((self.bits >> OFFSET) & MASK as u32) != 0
548        };
549        ADSTPR { bits }
550    }
551    #[doc = "Bit 3 - JADSTART"]
552    #[inline]
553    pub fn jadstart(&self) -> JADSTARTR {
554        let bits = {
555            const MASK: bool = true;
556            const OFFSET: u8 = 3;
557            ((self.bits >> OFFSET) & MASK as u32) != 0
558        };
559        JADSTARTR { bits }
560    }
561    #[doc = "Bit 2 - ADSTART"]
562    #[inline]
563    pub fn adstart(&self) -> ADSTARTR {
564        let bits = {
565            const MASK: bool = true;
566            const OFFSET: u8 = 2;
567            ((self.bits >> OFFSET) & MASK as u32) != 0
568        };
569        ADSTARTR { bits }
570    }
571    #[doc = "Bit 1 - ADDIS"]
572    #[inline]
573    pub fn addis(&self) -> ADDISR {
574        let bits = {
575            const MASK: bool = true;
576            const OFFSET: u8 = 1;
577            ((self.bits >> OFFSET) & MASK as u32) != 0
578        };
579        ADDISR { bits }
580    }
581    #[doc = "Bit 0 - ADEN"]
582    #[inline]
583    pub fn aden(&self) -> ADENR {
584        let bits = {
585            const MASK: bool = true;
586            const OFFSET: u8 = 0;
587            ((self.bits >> OFFSET) & MASK as u32) != 0
588        };
589        ADENR { 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 31 - ADCAL"]
605    #[inline]
606    pub fn adcal(&mut self) -> _ADCALW {
607        _ADCALW { w: self }
608    }
609    #[doc = "Bit 30 - ADCALDIF"]
610    #[inline]
611    pub fn adcaldif(&mut self) -> _ADCALDIFW {
612        _ADCALDIFW { w: self }
613    }
614    #[doc = "Bit 29 - DEEPPWD"]
615    #[inline]
616    pub fn deeppwd(&mut self) -> _DEEPPWDW {
617        _DEEPPWDW { w: self }
618    }
619    #[doc = "Bit 28 - ADVREGEN"]
620    #[inline]
621    pub fn advregen(&mut self) -> _ADVREGENW {
622        _ADVREGENW { w: self }
623    }
624    #[doc = "Bit 5 - JADSTP"]
625    #[inline]
626    pub fn jadstp(&mut self) -> _JADSTPW {
627        _JADSTPW { w: self }
628    }
629    #[doc = "Bit 4 - ADSTP"]
630    #[inline]
631    pub fn adstp(&mut self) -> _ADSTPW {
632        _ADSTPW { w: self }
633    }
634    #[doc = "Bit 3 - JADSTART"]
635    #[inline]
636    pub fn jadstart(&mut self) -> _JADSTARTW {
637        _JADSTARTW { w: self }
638    }
639    #[doc = "Bit 2 - ADSTART"]
640    #[inline]
641    pub fn adstart(&mut self) -> _ADSTARTW {
642        _ADSTARTW { w: self }
643    }
644    #[doc = "Bit 1 - ADDIS"]
645    #[inline]
646    pub fn addis(&mut self) -> _ADDISW {
647        _ADDISW { w: self }
648    }
649    #[doc = "Bit 0 - ADEN"]
650    #[inline]
651    pub fn aden(&mut self) -> _ADENW {
652        _ADENW { w: self }
653    }
654}