stm32l4x2_pac/adc/
smpr2.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::SMPR2 {
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 SMP18R {
47    bits: u8,
48}
49impl SMP18R {
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 SMP17R {
58    bits: u8,
59}
60impl SMP17R {
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 SMP16R {
69    bits: u8,
70}
71impl SMP16R {
72    #[doc = r" Value of the field as raw bits"]
73    #[inline]
74    pub fn bits(&self) -> u8 {
75        self.bits
76    }
77}
78#[doc = r" Value of the field"]
79pub struct SMP15R {
80    bits: u8,
81}
82impl SMP15R {
83    #[doc = r" Value of the field as raw bits"]
84    #[inline]
85    pub fn bits(&self) -> u8 {
86        self.bits
87    }
88}
89#[doc = r" Value of the field"]
90pub struct SMP14R {
91    bits: u8,
92}
93impl SMP14R {
94    #[doc = r" Value of the field as raw bits"]
95    #[inline]
96    pub fn bits(&self) -> u8 {
97        self.bits
98    }
99}
100#[doc = r" Value of the field"]
101pub struct SMP13R {
102    bits: u8,
103}
104impl SMP13R {
105    #[doc = r" Value of the field as raw bits"]
106    #[inline]
107    pub fn bits(&self) -> u8 {
108        self.bits
109    }
110}
111#[doc = r" Value of the field"]
112pub struct SMP12R {
113    bits: u8,
114}
115impl SMP12R {
116    #[doc = r" Value of the field as raw bits"]
117    #[inline]
118    pub fn bits(&self) -> u8 {
119        self.bits
120    }
121}
122#[doc = r" Value of the field"]
123pub struct SMP11R {
124    bits: u8,
125}
126impl SMP11R {
127    #[doc = r" Value of the field as raw bits"]
128    #[inline]
129    pub fn bits(&self) -> u8 {
130        self.bits
131    }
132}
133#[doc = r" Value of the field"]
134pub struct SMP10R {
135    bits: u8,
136}
137impl SMP10R {
138    #[doc = r" Value of the field as raw bits"]
139    #[inline]
140    pub fn bits(&self) -> u8 {
141        self.bits
142    }
143}
144#[doc = r" Proxy"]
145pub struct _SMP18W<'a> {
146    w: &'a mut W,
147}
148impl<'a> _SMP18W<'a> {
149    #[doc = r" Writes raw bits to the field"]
150    #[inline]
151    pub unsafe fn bits(self, value: u8) -> &'a mut W {
152        const MASK: u8 = 7;
153        const OFFSET: u8 = 24;
154        self.w.bits &= !((MASK as u32) << OFFSET);
155        self.w.bits |= ((value & MASK) as u32) << OFFSET;
156        self.w
157    }
158}
159#[doc = r" Proxy"]
160pub struct _SMP17W<'a> {
161    w: &'a mut W,
162}
163impl<'a> _SMP17W<'a> {
164    #[doc = r" Writes raw bits to the field"]
165    #[inline]
166    pub unsafe fn bits(self, value: u8) -> &'a mut W {
167        const MASK: u8 = 7;
168        const OFFSET: u8 = 21;
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 _SMP16W<'a> {
176    w: &'a mut W,
177}
178impl<'a> _SMP16W<'a> {
179    #[doc = r" Writes raw bits to the field"]
180    #[inline]
181    pub unsafe fn bits(self, value: u8) -> &'a mut W {
182        const MASK: u8 = 7;
183        const OFFSET: u8 = 18;
184        self.w.bits &= !((MASK as u32) << OFFSET);
185        self.w.bits |= ((value & MASK) as u32) << OFFSET;
186        self.w
187    }
188}
189#[doc = r" Proxy"]
190pub struct _SMP15W<'a> {
191    w: &'a mut W,
192}
193impl<'a> _SMP15W<'a> {
194    #[doc = r" Writes raw bits to the field"]
195    #[inline]
196    pub unsafe fn bits(self, value: u8) -> &'a mut W {
197        const MASK: u8 = 7;
198        const OFFSET: u8 = 15;
199        self.w.bits &= !((MASK as u32) << OFFSET);
200        self.w.bits |= ((value & MASK) as u32) << OFFSET;
201        self.w
202    }
203}
204#[doc = r" Proxy"]
205pub struct _SMP14W<'a> {
206    w: &'a mut W,
207}
208impl<'a> _SMP14W<'a> {
209    #[doc = r" Writes raw bits to the field"]
210    #[inline]
211    pub unsafe fn bits(self, value: u8) -> &'a mut W {
212        const MASK: u8 = 7;
213        const OFFSET: u8 = 12;
214        self.w.bits &= !((MASK as u32) << OFFSET);
215        self.w.bits |= ((value & MASK) as u32) << OFFSET;
216        self.w
217    }
218}
219#[doc = r" Proxy"]
220pub struct _SMP13W<'a> {
221    w: &'a mut W,
222}
223impl<'a> _SMP13W<'a> {
224    #[doc = r" Writes raw bits to the field"]
225    #[inline]
226    pub unsafe fn bits(self, value: u8) -> &'a mut W {
227        const MASK: u8 = 7;
228        const OFFSET: u8 = 9;
229        self.w.bits &= !((MASK as u32) << OFFSET);
230        self.w.bits |= ((value & MASK) as u32) << OFFSET;
231        self.w
232    }
233}
234#[doc = r" Proxy"]
235pub struct _SMP12W<'a> {
236    w: &'a mut W,
237}
238impl<'a> _SMP12W<'a> {
239    #[doc = r" Writes raw bits to the field"]
240    #[inline]
241    pub unsafe fn bits(self, value: u8) -> &'a mut W {
242        const MASK: u8 = 7;
243        const OFFSET: u8 = 6;
244        self.w.bits &= !((MASK as u32) << OFFSET);
245        self.w.bits |= ((value & MASK) as u32) << OFFSET;
246        self.w
247    }
248}
249#[doc = r" Proxy"]
250pub struct _SMP11W<'a> {
251    w: &'a mut W,
252}
253impl<'a> _SMP11W<'a> {
254    #[doc = r" Writes raw bits to the field"]
255    #[inline]
256    pub unsafe fn bits(self, value: u8) -> &'a mut W {
257        const MASK: u8 = 7;
258        const OFFSET: u8 = 3;
259        self.w.bits &= !((MASK as u32) << OFFSET);
260        self.w.bits |= ((value & MASK) as u32) << OFFSET;
261        self.w
262    }
263}
264#[doc = r" Proxy"]
265pub struct _SMP10W<'a> {
266    w: &'a mut W,
267}
268impl<'a> _SMP10W<'a> {
269    #[doc = r" Writes raw bits to the field"]
270    #[inline]
271    pub unsafe fn bits(self, value: u8) -> &'a mut W {
272        const MASK: u8 = 7;
273        const OFFSET: u8 = 0;
274        self.w.bits &= !((MASK as u32) << OFFSET);
275        self.w.bits |= ((value & MASK) as u32) << OFFSET;
276        self.w
277    }
278}
279impl R {
280    #[doc = r" Value of the register as raw bits"]
281    #[inline]
282    pub fn bits(&self) -> u32 {
283        self.bits
284    }
285    #[doc = "Bits 24:26 - SMP18"]
286    #[inline]
287    pub fn smp18(&self) -> SMP18R {
288        let bits = {
289            const MASK: u8 = 7;
290            const OFFSET: u8 = 24;
291            ((self.bits >> OFFSET) & MASK as u32) as u8
292        };
293        SMP18R { bits }
294    }
295    #[doc = "Bits 21:23 - SMP17"]
296    #[inline]
297    pub fn smp17(&self) -> SMP17R {
298        let bits = {
299            const MASK: u8 = 7;
300            const OFFSET: u8 = 21;
301            ((self.bits >> OFFSET) & MASK as u32) as u8
302        };
303        SMP17R { bits }
304    }
305    #[doc = "Bits 18:20 - SMP16"]
306    #[inline]
307    pub fn smp16(&self) -> SMP16R {
308        let bits = {
309            const MASK: u8 = 7;
310            const OFFSET: u8 = 18;
311            ((self.bits >> OFFSET) & MASK as u32) as u8
312        };
313        SMP16R { bits }
314    }
315    #[doc = "Bits 15:17 - SMP15"]
316    #[inline]
317    pub fn smp15(&self) -> SMP15R {
318        let bits = {
319            const MASK: u8 = 7;
320            const OFFSET: u8 = 15;
321            ((self.bits >> OFFSET) & MASK as u32) as u8
322        };
323        SMP15R { bits }
324    }
325    #[doc = "Bits 12:14 - SMP14"]
326    #[inline]
327    pub fn smp14(&self) -> SMP14R {
328        let bits = {
329            const MASK: u8 = 7;
330            const OFFSET: u8 = 12;
331            ((self.bits >> OFFSET) & MASK as u32) as u8
332        };
333        SMP14R { bits }
334    }
335    #[doc = "Bits 9:11 - SMP13"]
336    #[inline]
337    pub fn smp13(&self) -> SMP13R {
338        let bits = {
339            const MASK: u8 = 7;
340            const OFFSET: u8 = 9;
341            ((self.bits >> OFFSET) & MASK as u32) as u8
342        };
343        SMP13R { bits }
344    }
345    #[doc = "Bits 6:8 - SMP12"]
346    #[inline]
347    pub fn smp12(&self) -> SMP12R {
348        let bits = {
349            const MASK: u8 = 7;
350            const OFFSET: u8 = 6;
351            ((self.bits >> OFFSET) & MASK as u32) as u8
352        };
353        SMP12R { bits }
354    }
355    #[doc = "Bits 3:5 - SMP11"]
356    #[inline]
357    pub fn smp11(&self) -> SMP11R {
358        let bits = {
359            const MASK: u8 = 7;
360            const OFFSET: u8 = 3;
361            ((self.bits >> OFFSET) & MASK as u32) as u8
362        };
363        SMP11R { bits }
364    }
365    #[doc = "Bits 0:2 - SMP10"]
366    #[inline]
367    pub fn smp10(&self) -> SMP10R {
368        let bits = {
369            const MASK: u8 = 7;
370            const OFFSET: u8 = 0;
371            ((self.bits >> OFFSET) & MASK as u32) as u8
372        };
373        SMP10R { bits }
374    }
375}
376impl W {
377    #[doc = r" Reset value of the register"]
378    #[inline]
379    pub fn reset_value() -> W {
380        W { bits: 0 }
381    }
382    #[doc = r" Writes raw bits to the register"]
383    #[inline]
384    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
385        self.bits = bits;
386        self
387    }
388    #[doc = "Bits 24:26 - SMP18"]
389    #[inline]
390    pub fn smp18(&mut self) -> _SMP18W {
391        _SMP18W { w: self }
392    }
393    #[doc = "Bits 21:23 - SMP17"]
394    #[inline]
395    pub fn smp17(&mut self) -> _SMP17W {
396        _SMP17W { w: self }
397    }
398    #[doc = "Bits 18:20 - SMP16"]
399    #[inline]
400    pub fn smp16(&mut self) -> _SMP16W {
401        _SMP16W { w: self }
402    }
403    #[doc = "Bits 15:17 - SMP15"]
404    #[inline]
405    pub fn smp15(&mut self) -> _SMP15W {
406        _SMP15W { w: self }
407    }
408    #[doc = "Bits 12:14 - SMP14"]
409    #[inline]
410    pub fn smp14(&mut self) -> _SMP14W {
411        _SMP14W { w: self }
412    }
413    #[doc = "Bits 9:11 - SMP13"]
414    #[inline]
415    pub fn smp13(&mut self) -> _SMP13W {
416        _SMP13W { w: self }
417    }
418    #[doc = "Bits 6:8 - SMP12"]
419    #[inline]
420    pub fn smp12(&mut self) -> _SMP12W {
421        _SMP12W { w: self }
422    }
423    #[doc = "Bits 3:5 - SMP11"]
424    #[inline]
425    pub fn smp11(&mut self) -> _SMP11W {
426        _SMP11W { w: self }
427    }
428    #[doc = "Bits 0:2 - SMP10"]
429    #[inline]
430    pub fn smp10(&mut self) -> _SMP10W {
431        _SMP10W { w: self }
432    }
433}