stm32l4x2_pac/dfsdm/
dfsdm1_cr2.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::DFSDM1_CR2 {
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 AWDCHR {
47    bits: u8,
48}
49impl AWDCHR {
50    #[doc = r" Value of the field as raw bits"]
51    #[inline]
52    pub fn bits(&self) -> u8 {
53        self.bits
54    }
55}
56#[doc = r" Value of the field"]
57pub struct EXCHR {
58    bits: u8,
59}
60impl EXCHR {
61    #[doc = r" Value of the field as raw bits"]
62    #[inline]
63    pub fn bits(&self) -> u8 {
64        self.bits
65    }
66}
67#[doc = r" Value of the field"]
68pub struct CKABIER {
69    bits: bool,
70}
71impl CKABIER {
72    #[doc = r" Value of the field as raw bits"]
73    #[inline]
74    pub fn bit(&self) -> bool {
75        self.bits
76    }
77    #[doc = r" Returns `true` if the bit is clear (0)"]
78    #[inline]
79    pub fn bit_is_clear(&self) -> bool {
80        !self.bit()
81    }
82    #[doc = r" Returns `true` if the bit is set (1)"]
83    #[inline]
84    pub fn bit_is_set(&self) -> bool {
85        self.bit()
86    }
87}
88#[doc = r" Value of the field"]
89pub struct SCDIER {
90    bits: bool,
91}
92impl SCDIER {
93    #[doc = r" Value of the field as raw bits"]
94    #[inline]
95    pub fn bit(&self) -> bool {
96        self.bits
97    }
98    #[doc = r" Returns `true` if the bit is clear (0)"]
99    #[inline]
100    pub fn bit_is_clear(&self) -> bool {
101        !self.bit()
102    }
103    #[doc = r" Returns `true` if the bit is set (1)"]
104    #[inline]
105    pub fn bit_is_set(&self) -> bool {
106        self.bit()
107    }
108}
109#[doc = r" Value of the field"]
110pub struct AWDIER {
111    bits: bool,
112}
113impl AWDIER {
114    #[doc = r" Value of the field as raw bits"]
115    #[inline]
116    pub fn bit(&self) -> bool {
117        self.bits
118    }
119    #[doc = r" Returns `true` if the bit is clear (0)"]
120    #[inline]
121    pub fn bit_is_clear(&self) -> bool {
122        !self.bit()
123    }
124    #[doc = r" Returns `true` if the bit is set (1)"]
125    #[inline]
126    pub fn bit_is_set(&self) -> bool {
127        self.bit()
128    }
129}
130#[doc = r" Value of the field"]
131pub struct ROVRIER {
132    bits: bool,
133}
134impl ROVRIER {
135    #[doc = r" Value of the field as raw bits"]
136    #[inline]
137    pub fn bit(&self) -> bool {
138        self.bits
139    }
140    #[doc = r" Returns `true` if the bit is clear (0)"]
141    #[inline]
142    pub fn bit_is_clear(&self) -> bool {
143        !self.bit()
144    }
145    #[doc = r" Returns `true` if the bit is set (1)"]
146    #[inline]
147    pub fn bit_is_set(&self) -> bool {
148        self.bit()
149    }
150}
151#[doc = r" Value of the field"]
152pub struct JOVRIER {
153    bits: bool,
154}
155impl JOVRIER {
156    #[doc = r" Value of the field as raw bits"]
157    #[inline]
158    pub fn bit(&self) -> bool {
159        self.bits
160    }
161    #[doc = r" Returns `true` if the bit is clear (0)"]
162    #[inline]
163    pub fn bit_is_clear(&self) -> bool {
164        !self.bit()
165    }
166    #[doc = r" Returns `true` if the bit is set (1)"]
167    #[inline]
168    pub fn bit_is_set(&self) -> bool {
169        self.bit()
170    }
171}
172#[doc = r" Value of the field"]
173pub struct REOCIER {
174    bits: bool,
175}
176impl REOCIER {
177    #[doc = r" Value of the field as raw bits"]
178    #[inline]
179    pub fn bit(&self) -> bool {
180        self.bits
181    }
182    #[doc = r" Returns `true` if the bit is clear (0)"]
183    #[inline]
184    pub fn bit_is_clear(&self) -> bool {
185        !self.bit()
186    }
187    #[doc = r" Returns `true` if the bit is set (1)"]
188    #[inline]
189    pub fn bit_is_set(&self) -> bool {
190        self.bit()
191    }
192}
193#[doc = r" Value of the field"]
194pub struct JEOCIER {
195    bits: bool,
196}
197impl JEOCIER {
198    #[doc = r" Value of the field as raw bits"]
199    #[inline]
200    pub fn bit(&self) -> bool {
201        self.bits
202    }
203    #[doc = r" Returns `true` if the bit is clear (0)"]
204    #[inline]
205    pub fn bit_is_clear(&self) -> bool {
206        !self.bit()
207    }
208    #[doc = r" Returns `true` if the bit is set (1)"]
209    #[inline]
210    pub fn bit_is_set(&self) -> bool {
211        self.bit()
212    }
213}
214#[doc = r" Proxy"]
215pub struct _AWDCHW<'a> {
216    w: &'a mut W,
217}
218impl<'a> _AWDCHW<'a> {
219    #[doc = r" Writes raw bits to the field"]
220    #[inline]
221    pub unsafe fn bits(self, value: u8) -> &'a mut W {
222        const MASK: u8 = 255;
223        const OFFSET: u8 = 16;
224        self.w.bits &= !((MASK as u32) << OFFSET);
225        self.w.bits |= ((value & MASK) as u32) << OFFSET;
226        self.w
227    }
228}
229#[doc = r" Proxy"]
230pub struct _EXCHW<'a> {
231    w: &'a mut W,
232}
233impl<'a> _EXCHW<'a> {
234    #[doc = r" Writes raw bits to the field"]
235    #[inline]
236    pub unsafe fn bits(self, value: u8) -> &'a mut W {
237        const MASK: u8 = 255;
238        const OFFSET: u8 = 8;
239        self.w.bits &= !((MASK as u32) << OFFSET);
240        self.w.bits |= ((value & MASK) as u32) << OFFSET;
241        self.w
242    }
243}
244#[doc = r" Proxy"]
245pub struct _CKABIEW<'a> {
246    w: &'a mut W,
247}
248impl<'a> _CKABIEW<'a> {
249    #[doc = r" Sets the field bit"]
250    pub fn set_bit(self) -> &'a mut W {
251        self.bit(true)
252    }
253    #[doc = r" Clears the field bit"]
254    pub fn clear_bit(self) -> &'a mut W {
255        self.bit(false)
256    }
257    #[doc = r" Writes raw bits to the field"]
258    #[inline]
259    pub fn bit(self, value: bool) -> &'a mut W {
260        const MASK: bool = true;
261        const OFFSET: u8 = 6;
262        self.w.bits &= !((MASK as u32) << OFFSET);
263        self.w.bits |= ((value & MASK) as u32) << OFFSET;
264        self.w
265    }
266}
267#[doc = r" Proxy"]
268pub struct _SCDIEW<'a> {
269    w: &'a mut W,
270}
271impl<'a> _SCDIEW<'a> {
272    #[doc = r" Sets the field bit"]
273    pub fn set_bit(self) -> &'a mut W {
274        self.bit(true)
275    }
276    #[doc = r" Clears the field bit"]
277    pub fn clear_bit(self) -> &'a mut W {
278        self.bit(false)
279    }
280    #[doc = r" Writes raw bits to the field"]
281    #[inline]
282    pub fn bit(self, value: bool) -> &'a mut W {
283        const MASK: bool = true;
284        const OFFSET: u8 = 5;
285        self.w.bits &= !((MASK as u32) << OFFSET);
286        self.w.bits |= ((value & MASK) as u32) << OFFSET;
287        self.w
288    }
289}
290#[doc = r" Proxy"]
291pub struct _AWDIEW<'a> {
292    w: &'a mut W,
293}
294impl<'a> _AWDIEW<'a> {
295    #[doc = r" Sets the field bit"]
296    pub fn set_bit(self) -> &'a mut W {
297        self.bit(true)
298    }
299    #[doc = r" Clears the field bit"]
300    pub fn clear_bit(self) -> &'a mut W {
301        self.bit(false)
302    }
303    #[doc = r" Writes raw bits to the field"]
304    #[inline]
305    pub fn bit(self, value: bool) -> &'a mut W {
306        const MASK: bool = true;
307        const OFFSET: u8 = 4;
308        self.w.bits &= !((MASK as u32) << OFFSET);
309        self.w.bits |= ((value & MASK) as u32) << OFFSET;
310        self.w
311    }
312}
313#[doc = r" Proxy"]
314pub struct _ROVRIEW<'a> {
315    w: &'a mut W,
316}
317impl<'a> _ROVRIEW<'a> {
318    #[doc = r" Sets the field bit"]
319    pub fn set_bit(self) -> &'a mut W {
320        self.bit(true)
321    }
322    #[doc = r" Clears the field bit"]
323    pub fn clear_bit(self) -> &'a mut W {
324        self.bit(false)
325    }
326    #[doc = r" Writes raw bits to the field"]
327    #[inline]
328    pub fn bit(self, value: bool) -> &'a mut W {
329        const MASK: bool = true;
330        const OFFSET: u8 = 3;
331        self.w.bits &= !((MASK as u32) << OFFSET);
332        self.w.bits |= ((value & MASK) as u32) << OFFSET;
333        self.w
334    }
335}
336#[doc = r" Proxy"]
337pub struct _JOVRIEW<'a> {
338    w: &'a mut W,
339}
340impl<'a> _JOVRIEW<'a> {
341    #[doc = r" Sets the field bit"]
342    pub fn set_bit(self) -> &'a mut W {
343        self.bit(true)
344    }
345    #[doc = r" Clears the field bit"]
346    pub fn clear_bit(self) -> &'a mut W {
347        self.bit(false)
348    }
349    #[doc = r" Writes raw bits to the field"]
350    #[inline]
351    pub fn bit(self, value: bool) -> &'a mut W {
352        const MASK: bool = true;
353        const OFFSET: u8 = 2;
354        self.w.bits &= !((MASK as u32) << OFFSET);
355        self.w.bits |= ((value & MASK) as u32) << OFFSET;
356        self.w
357    }
358}
359#[doc = r" Proxy"]
360pub struct _REOCIEW<'a> {
361    w: &'a mut W,
362}
363impl<'a> _REOCIEW<'a> {
364    #[doc = r" Sets the field bit"]
365    pub fn set_bit(self) -> &'a mut W {
366        self.bit(true)
367    }
368    #[doc = r" Clears the field bit"]
369    pub fn clear_bit(self) -> &'a mut W {
370        self.bit(false)
371    }
372    #[doc = r" Writes raw bits to the field"]
373    #[inline]
374    pub fn bit(self, value: bool) -> &'a mut W {
375        const MASK: bool = true;
376        const OFFSET: u8 = 1;
377        self.w.bits &= !((MASK as u32) << OFFSET);
378        self.w.bits |= ((value & MASK) as u32) << OFFSET;
379        self.w
380    }
381}
382#[doc = r" Proxy"]
383pub struct _JEOCIEW<'a> {
384    w: &'a mut W,
385}
386impl<'a> _JEOCIEW<'a> {
387    #[doc = r" Sets the field bit"]
388    pub fn set_bit(self) -> &'a mut W {
389        self.bit(true)
390    }
391    #[doc = r" Clears the field bit"]
392    pub fn clear_bit(self) -> &'a mut W {
393        self.bit(false)
394    }
395    #[doc = r" Writes raw bits to the field"]
396    #[inline]
397    pub fn bit(self, value: bool) -> &'a mut W {
398        const MASK: bool = true;
399        const OFFSET: u8 = 0;
400        self.w.bits &= !((MASK as u32) << OFFSET);
401        self.w.bits |= ((value & MASK) as u32) << OFFSET;
402        self.w
403    }
404}
405impl R {
406    #[doc = r" Value of the register as raw bits"]
407    #[inline]
408    pub fn bits(&self) -> u32 {
409        self.bits
410    }
411    #[doc = "Bits 16:23 - Analog watchdog channel selection"]
412    #[inline]
413    pub fn awdch(&self) -> AWDCHR {
414        let bits = {
415            const MASK: u8 = 255;
416            const OFFSET: u8 = 16;
417            ((self.bits >> OFFSET) & MASK as u32) as u8
418        };
419        AWDCHR { bits }
420    }
421    #[doc = "Bits 8:15 - Extremes detector channel selection"]
422    #[inline]
423    pub fn exch(&self) -> EXCHR {
424        let bits = {
425            const MASK: u8 = 255;
426            const OFFSET: u8 = 8;
427            ((self.bits >> OFFSET) & MASK as u32) as u8
428        };
429        EXCHR { bits }
430    }
431    #[doc = "Bit 6 - Clock absence interrupt enable"]
432    #[inline]
433    pub fn ckabie(&self) -> CKABIER {
434        let bits = {
435            const MASK: bool = true;
436            const OFFSET: u8 = 6;
437            ((self.bits >> OFFSET) & MASK as u32) != 0
438        };
439        CKABIER { bits }
440    }
441    #[doc = "Bit 5 - Short-circuit detector interrupt enable"]
442    #[inline]
443    pub fn scdie(&self) -> SCDIER {
444        let bits = {
445            const MASK: bool = true;
446            const OFFSET: u8 = 5;
447            ((self.bits >> OFFSET) & MASK as u32) != 0
448        };
449        SCDIER { bits }
450    }
451    #[doc = "Bit 4 - Analog watchdog interrupt enable"]
452    #[inline]
453    pub fn awdie(&self) -> AWDIER {
454        let bits = {
455            const MASK: bool = true;
456            const OFFSET: u8 = 4;
457            ((self.bits >> OFFSET) & MASK as u32) != 0
458        };
459        AWDIER { bits }
460    }
461    #[doc = "Bit 3 - Regular data overrun interrupt enable"]
462    #[inline]
463    pub fn rovrie(&self) -> ROVRIER {
464        let bits = {
465            const MASK: bool = true;
466            const OFFSET: u8 = 3;
467            ((self.bits >> OFFSET) & MASK as u32) != 0
468        };
469        ROVRIER { bits }
470    }
471    #[doc = "Bit 2 - Injected data overrun interrupt enable"]
472    #[inline]
473    pub fn jovrie(&self) -> JOVRIER {
474        let bits = {
475            const MASK: bool = true;
476            const OFFSET: u8 = 2;
477            ((self.bits >> OFFSET) & MASK as u32) != 0
478        };
479        JOVRIER { bits }
480    }
481    #[doc = "Bit 1 - Regular end of conversion interrupt enable"]
482    #[inline]
483    pub fn reocie(&self) -> REOCIER {
484        let bits = {
485            const MASK: bool = true;
486            const OFFSET: u8 = 1;
487            ((self.bits >> OFFSET) & MASK as u32) != 0
488        };
489        REOCIER { bits }
490    }
491    #[doc = "Bit 0 - Injected end of conversion interrupt enable"]
492    #[inline]
493    pub fn jeocie(&self) -> JEOCIER {
494        let bits = {
495            const MASK: bool = true;
496            const OFFSET: u8 = 0;
497            ((self.bits >> OFFSET) & MASK as u32) != 0
498        };
499        JEOCIER { bits }
500    }
501}
502impl W {
503    #[doc = r" Reset value of the register"]
504    #[inline]
505    pub fn reset_value() -> W {
506        W { bits: 0 }
507    }
508    #[doc = r" Writes raw bits to the register"]
509    #[inline]
510    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
511        self.bits = bits;
512        self
513    }
514    #[doc = "Bits 16:23 - Analog watchdog channel selection"]
515    #[inline]
516    pub fn awdch(&mut self) -> _AWDCHW {
517        _AWDCHW { w: self }
518    }
519    #[doc = "Bits 8:15 - Extremes detector channel selection"]
520    #[inline]
521    pub fn exch(&mut self) -> _EXCHW {
522        _EXCHW { w: self }
523    }
524    #[doc = "Bit 6 - Clock absence interrupt enable"]
525    #[inline]
526    pub fn ckabie(&mut self) -> _CKABIEW {
527        _CKABIEW { w: self }
528    }
529    #[doc = "Bit 5 - Short-circuit detector interrupt enable"]
530    #[inline]
531    pub fn scdie(&mut self) -> _SCDIEW {
532        _SCDIEW { w: self }
533    }
534    #[doc = "Bit 4 - Analog watchdog interrupt enable"]
535    #[inline]
536    pub fn awdie(&mut self) -> _AWDIEW {
537        _AWDIEW { w: self }
538    }
539    #[doc = "Bit 3 - Regular data overrun interrupt enable"]
540    #[inline]
541    pub fn rovrie(&mut self) -> _ROVRIEW {
542        _ROVRIEW { w: self }
543    }
544    #[doc = "Bit 2 - Injected data overrun interrupt enable"]
545    #[inline]
546    pub fn jovrie(&mut self) -> _JOVRIEW {
547        _JOVRIEW { w: self }
548    }
549    #[doc = "Bit 1 - Regular end of conversion interrupt enable"]
550    #[inline]
551    pub fn reocie(&mut self) -> _REOCIEW {
552        _REOCIEW { w: self }
553    }
554    #[doc = "Bit 0 - Injected end of conversion interrupt enable"]
555    #[inline]
556    pub fn jeocie(&mut self) -> _JEOCIEW {
557        _JEOCIEW { w: self }
558    }
559}