stm32l4x2_pac/adc/
cfgr2.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::CFGR2 {
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 ROVSMR {
47    bits: bool,
48}
49impl ROVSMR {
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 TOVSR {
68    bits: bool,
69}
70impl TOVSR {
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 OVSSR {
89    bits: u8,
90}
91impl OVSSR {
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 OVSRR {
100    bits: u8,
101}
102impl OVSRR {
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 JOVSER {
111    bits: bool,
112}
113impl JOVSER {
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 ROVSER {
132    bits: bool,
133}
134impl ROVSER {
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" Proxy"]
152pub struct _ROVSMW<'a> {
153    w: &'a mut W,
154}
155impl<'a> _ROVSMW<'a> {
156    #[doc = r" Sets the field bit"]
157    pub fn set_bit(self) -> &'a mut W {
158        self.bit(true)
159    }
160    #[doc = r" Clears the field bit"]
161    pub fn clear_bit(self) -> &'a mut W {
162        self.bit(false)
163    }
164    #[doc = r" Writes raw bits to the field"]
165    #[inline]
166    pub fn bit(self, value: bool) -> &'a mut W {
167        const MASK: bool = true;
168        const OFFSET: u8 = 10;
169        self.w.bits &= !((MASK as u32) << OFFSET);
170        self.w.bits |= ((value & MASK) as u32) << OFFSET;
171        self.w
172    }
173}
174#[doc = r" Proxy"]
175pub struct _TOVSW<'a> {
176    w: &'a mut W,
177}
178impl<'a> _TOVSW<'a> {
179    #[doc = r" Sets the field bit"]
180    pub fn set_bit(self) -> &'a mut W {
181        self.bit(true)
182    }
183    #[doc = r" Clears the field bit"]
184    pub fn clear_bit(self) -> &'a mut W {
185        self.bit(false)
186    }
187    #[doc = r" Writes raw bits to the field"]
188    #[inline]
189    pub fn bit(self, value: bool) -> &'a mut W {
190        const MASK: bool = true;
191        const OFFSET: u8 = 9;
192        self.w.bits &= !((MASK as u32) << OFFSET);
193        self.w.bits |= ((value & MASK) as u32) << OFFSET;
194        self.w
195    }
196}
197#[doc = r" Proxy"]
198pub struct _OVSSW<'a> {
199    w: &'a mut W,
200}
201impl<'a> _OVSSW<'a> {
202    #[doc = r" Writes raw bits to the field"]
203    #[inline]
204    pub unsafe fn bits(self, value: u8) -> &'a mut W {
205        const MASK: u8 = 15;
206        const OFFSET: u8 = 5;
207        self.w.bits &= !((MASK as u32) << OFFSET);
208        self.w.bits |= ((value & MASK) as u32) << OFFSET;
209        self.w
210    }
211}
212#[doc = r" Proxy"]
213pub struct _OVSRW<'a> {
214    w: &'a mut W,
215}
216impl<'a> _OVSRW<'a> {
217    #[doc = r" Writes raw bits to the field"]
218    #[inline]
219    pub unsafe fn bits(self, value: u8) -> &'a mut W {
220        const MASK: u8 = 7;
221        const OFFSET: u8 = 2;
222        self.w.bits &= !((MASK as u32) << OFFSET);
223        self.w.bits |= ((value & MASK) as u32) << OFFSET;
224        self.w
225    }
226}
227#[doc = r" Proxy"]
228pub struct _JOVSEW<'a> {
229    w: &'a mut W,
230}
231impl<'a> _JOVSEW<'a> {
232    #[doc = r" Sets the field bit"]
233    pub fn set_bit(self) -> &'a mut W {
234        self.bit(true)
235    }
236    #[doc = r" Clears the field bit"]
237    pub fn clear_bit(self) -> &'a mut W {
238        self.bit(false)
239    }
240    #[doc = r" Writes raw bits to the field"]
241    #[inline]
242    pub fn bit(self, value: bool) -> &'a mut W {
243        const MASK: bool = true;
244        const OFFSET: u8 = 1;
245        self.w.bits &= !((MASK as u32) << OFFSET);
246        self.w.bits |= ((value & MASK) as u32) << OFFSET;
247        self.w
248    }
249}
250#[doc = r" Proxy"]
251pub struct _ROVSEW<'a> {
252    w: &'a mut W,
253}
254impl<'a> _ROVSEW<'a> {
255    #[doc = r" Sets the field bit"]
256    pub fn set_bit(self) -> &'a mut W {
257        self.bit(true)
258    }
259    #[doc = r" Clears the field bit"]
260    pub fn clear_bit(self) -> &'a mut W {
261        self.bit(false)
262    }
263    #[doc = r" Writes raw bits to the field"]
264    #[inline]
265    pub fn bit(self, value: bool) -> &'a mut W {
266        const MASK: bool = true;
267        const OFFSET: u8 = 0;
268        self.w.bits &= !((MASK as u32) << OFFSET);
269        self.w.bits |= ((value & MASK) as u32) << OFFSET;
270        self.w
271    }
272}
273impl R {
274    #[doc = r" Value of the register as raw bits"]
275    #[inline]
276    pub fn bits(&self) -> u32 {
277        self.bits
278    }
279    #[doc = "Bit 10 - EXTEN"]
280    #[inline]
281    pub fn rovsm(&self) -> ROVSMR {
282        let bits = {
283            const MASK: bool = true;
284            const OFFSET: u8 = 10;
285            ((self.bits >> OFFSET) & MASK as u32) != 0
286        };
287        ROVSMR { bits }
288    }
289    #[doc = "Bit 9 - EXTSEL"]
290    #[inline]
291    pub fn tovs(&self) -> TOVSR {
292        let bits = {
293            const MASK: bool = true;
294            const OFFSET: u8 = 9;
295            ((self.bits >> OFFSET) & MASK as u32) != 0
296        };
297        TOVSR { bits }
298    }
299    #[doc = "Bits 5:8 - ALIGN"]
300    #[inline]
301    pub fn ovss(&self) -> OVSSR {
302        let bits = {
303            const MASK: u8 = 15;
304            const OFFSET: u8 = 5;
305            ((self.bits >> OFFSET) & MASK as u32) as u8
306        };
307        OVSSR { bits }
308    }
309    #[doc = "Bits 2:4 - RES"]
310    #[inline]
311    pub fn ovsr(&self) -> OVSRR {
312        let bits = {
313            const MASK: u8 = 7;
314            const OFFSET: u8 = 2;
315            ((self.bits >> OFFSET) & MASK as u32) as u8
316        };
317        OVSRR { bits }
318    }
319    #[doc = "Bit 1 - DMACFG"]
320    #[inline]
321    pub fn jovse(&self) -> JOVSER {
322        let bits = {
323            const MASK: bool = true;
324            const OFFSET: u8 = 1;
325            ((self.bits >> OFFSET) & MASK as u32) != 0
326        };
327        JOVSER { bits }
328    }
329    #[doc = "Bit 0 - DMAEN"]
330    #[inline]
331    pub fn rovse(&self) -> ROVSER {
332        let bits = {
333            const MASK: bool = true;
334            const OFFSET: u8 = 0;
335            ((self.bits >> OFFSET) & MASK as u32) != 0
336        };
337        ROVSER { bits }
338    }
339}
340impl W {
341    #[doc = r" Reset value of the register"]
342    #[inline]
343    pub fn reset_value() -> W {
344        W { bits: 0 }
345    }
346    #[doc = r" Writes raw bits to the register"]
347    #[inline]
348    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
349        self.bits = bits;
350        self
351    }
352    #[doc = "Bit 10 - EXTEN"]
353    #[inline]
354    pub fn rovsm(&mut self) -> _ROVSMW {
355        _ROVSMW { w: self }
356    }
357    #[doc = "Bit 9 - EXTSEL"]
358    #[inline]
359    pub fn tovs(&mut self) -> _TOVSW {
360        _TOVSW { w: self }
361    }
362    #[doc = "Bits 5:8 - ALIGN"]
363    #[inline]
364    pub fn ovss(&mut self) -> _OVSSW {
365        _OVSSW { w: self }
366    }
367    #[doc = "Bits 2:4 - RES"]
368    #[inline]
369    pub fn ovsr(&mut self) -> _OVSRW {
370        _OVSRW { w: self }
371    }
372    #[doc = "Bit 1 - DMACFG"]
373    #[inline]
374    pub fn jovse(&mut self) -> _JOVSEW {
375        _JOVSEW { w: self }
376    }
377    #[doc = "Bit 0 - DMAEN"]
378    #[inline]
379    pub fn rovse(&mut self) -> _ROVSEW {
380        _ROVSEW { w: self }
381    }
382}