stm32f103xx/adc2/smpr1/
mod.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::SMPR1 {
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 SMP10R {
47    bits: u8,
48}
49impl SMP10R {
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 SMP11R {
58    bits: u8,
59}
60impl SMP11R {
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 SMP12R {
69    bits: u8,
70}
71impl SMP12R {
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 SMP13R {
80    bits: u8,
81}
82impl SMP13R {
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 SMP15R {
102    bits: u8,
103}
104impl SMP15R {
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 SMP16R {
113    bits: u8,
114}
115impl SMP16R {
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 SMP17R {
124    bits: u8,
125}
126impl SMP17R {
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" Proxy"]
134pub struct _SMP10W<'a> {
135    w: &'a mut W,
136}
137impl<'a> _SMP10W<'a> {
138    #[doc = r" Writes raw bits to the field"]
139    #[inline]
140    pub unsafe fn bits(self, value: u8) -> &'a mut W {
141        const MASK: u8 = 7;
142        const OFFSET: u8 = 0;
143        self.w.bits &= !((MASK as u32) << OFFSET);
144        self.w.bits |= ((value & MASK) as u32) << OFFSET;
145        self.w
146    }
147}
148#[doc = r" Proxy"]
149pub struct _SMP11W<'a> {
150    w: &'a mut W,
151}
152impl<'a> _SMP11W<'a> {
153    #[doc = r" Writes raw bits to the field"]
154    #[inline]
155    pub unsafe fn bits(self, value: u8) -> &'a mut W {
156        const MASK: u8 = 7;
157        const OFFSET: u8 = 3;
158        self.w.bits &= !((MASK as u32) << OFFSET);
159        self.w.bits |= ((value & MASK) as u32) << OFFSET;
160        self.w
161    }
162}
163#[doc = r" Proxy"]
164pub struct _SMP12W<'a> {
165    w: &'a mut W,
166}
167impl<'a> _SMP12W<'a> {
168    #[doc = r" Writes raw bits to the field"]
169    #[inline]
170    pub unsafe fn bits(self, value: u8) -> &'a mut W {
171        const MASK: u8 = 7;
172        const OFFSET: u8 = 6;
173        self.w.bits &= !((MASK as u32) << OFFSET);
174        self.w.bits |= ((value & MASK) as u32) << OFFSET;
175        self.w
176    }
177}
178#[doc = r" Proxy"]
179pub struct _SMP13W<'a> {
180    w: &'a mut W,
181}
182impl<'a> _SMP13W<'a> {
183    #[doc = r" Writes raw bits to the field"]
184    #[inline]
185    pub unsafe fn bits(self, value: u8) -> &'a mut W {
186        const MASK: u8 = 7;
187        const OFFSET: u8 = 9;
188        self.w.bits &= !((MASK as u32) << OFFSET);
189        self.w.bits |= ((value & MASK) as u32) << OFFSET;
190        self.w
191    }
192}
193#[doc = r" Proxy"]
194pub struct _SMP14W<'a> {
195    w: &'a mut W,
196}
197impl<'a> _SMP14W<'a> {
198    #[doc = r" Writes raw bits to the field"]
199    #[inline]
200    pub unsafe fn bits(self, value: u8) -> &'a mut W {
201        const MASK: u8 = 7;
202        const OFFSET: u8 = 12;
203        self.w.bits &= !((MASK as u32) << OFFSET);
204        self.w.bits |= ((value & MASK) as u32) << OFFSET;
205        self.w
206    }
207}
208#[doc = r" Proxy"]
209pub struct _SMP15W<'a> {
210    w: &'a mut W,
211}
212impl<'a> _SMP15W<'a> {
213    #[doc = r" Writes raw bits to the field"]
214    #[inline]
215    pub unsafe fn bits(self, value: u8) -> &'a mut W {
216        const MASK: u8 = 7;
217        const OFFSET: u8 = 15;
218        self.w.bits &= !((MASK as u32) << OFFSET);
219        self.w.bits |= ((value & MASK) as u32) << OFFSET;
220        self.w
221    }
222}
223#[doc = r" Proxy"]
224pub struct _SMP16W<'a> {
225    w: &'a mut W,
226}
227impl<'a> _SMP16W<'a> {
228    #[doc = r" Writes raw bits to the field"]
229    #[inline]
230    pub unsafe fn bits(self, value: u8) -> &'a mut W {
231        const MASK: u8 = 7;
232        const OFFSET: u8 = 18;
233        self.w.bits &= !((MASK as u32) << OFFSET);
234        self.w.bits |= ((value & MASK) as u32) << OFFSET;
235        self.w
236    }
237}
238#[doc = r" Proxy"]
239pub struct _SMP17W<'a> {
240    w: &'a mut W,
241}
242impl<'a> _SMP17W<'a> {
243    #[doc = r" Writes raw bits to the field"]
244    #[inline]
245    pub unsafe fn bits(self, value: u8) -> &'a mut W {
246        const MASK: u8 = 7;
247        const OFFSET: u8 = 21;
248        self.w.bits &= !((MASK as u32) << OFFSET);
249        self.w.bits |= ((value & MASK) as u32) << OFFSET;
250        self.w
251    }
252}
253impl R {
254    #[doc = r" Value of the register as raw bits"]
255    #[inline]
256    pub fn bits(&self) -> u32 {
257        self.bits
258    }
259    #[doc = "Bits 0:2 - Channel 10 sample time selection"]
260    #[inline]
261    pub fn smp10(&self) -> SMP10R {
262        let bits = {
263            const MASK: u8 = 7;
264            const OFFSET: u8 = 0;
265            ((self.bits >> OFFSET) & MASK as u32) as u8
266        };
267        SMP10R { bits }
268    }
269    #[doc = "Bits 3:5 - Channel 11 sample time selection"]
270    #[inline]
271    pub fn smp11(&self) -> SMP11R {
272        let bits = {
273            const MASK: u8 = 7;
274            const OFFSET: u8 = 3;
275            ((self.bits >> OFFSET) & MASK as u32) as u8
276        };
277        SMP11R { bits }
278    }
279    #[doc = "Bits 6:8 - Channel 12 sample time selection"]
280    #[inline]
281    pub fn smp12(&self) -> SMP12R {
282        let bits = {
283            const MASK: u8 = 7;
284            const OFFSET: u8 = 6;
285            ((self.bits >> OFFSET) & MASK as u32) as u8
286        };
287        SMP12R { bits }
288    }
289    #[doc = "Bits 9:11 - Channel 13 sample time selection"]
290    #[inline]
291    pub fn smp13(&self) -> SMP13R {
292        let bits = {
293            const MASK: u8 = 7;
294            const OFFSET: u8 = 9;
295            ((self.bits >> OFFSET) & MASK as u32) as u8
296        };
297        SMP13R { bits }
298    }
299    #[doc = "Bits 12:14 - Channel 14 sample time selection"]
300    #[inline]
301    pub fn smp14(&self) -> SMP14R {
302        let bits = {
303            const MASK: u8 = 7;
304            const OFFSET: u8 = 12;
305            ((self.bits >> OFFSET) & MASK as u32) as u8
306        };
307        SMP14R { bits }
308    }
309    #[doc = "Bits 15:17 - Channel 15 sample time selection"]
310    #[inline]
311    pub fn smp15(&self) -> SMP15R {
312        let bits = {
313            const MASK: u8 = 7;
314            const OFFSET: u8 = 15;
315            ((self.bits >> OFFSET) & MASK as u32) as u8
316        };
317        SMP15R { bits }
318    }
319    #[doc = "Bits 18:20 - Channel 16 sample time selection"]
320    #[inline]
321    pub fn smp16(&self) -> SMP16R {
322        let bits = {
323            const MASK: u8 = 7;
324            const OFFSET: u8 = 18;
325            ((self.bits >> OFFSET) & MASK as u32) as u8
326        };
327        SMP16R { bits }
328    }
329    #[doc = "Bits 21:23 - Channel 17 sample time selection"]
330    #[inline]
331    pub fn smp17(&self) -> SMP17R {
332        let bits = {
333            const MASK: u8 = 7;
334            const OFFSET: u8 = 21;
335            ((self.bits >> OFFSET) & MASK as u32) as u8
336        };
337        SMP17R { 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 = "Bits 0:2 - Channel 10 sample time selection"]
353    #[inline]
354    pub fn smp10(&mut self) -> _SMP10W {
355        _SMP10W { w: self }
356    }
357    #[doc = "Bits 3:5 - Channel 11 sample time selection"]
358    #[inline]
359    pub fn smp11(&mut self) -> _SMP11W {
360        _SMP11W { w: self }
361    }
362    #[doc = "Bits 6:8 - Channel 12 sample time selection"]
363    #[inline]
364    pub fn smp12(&mut self) -> _SMP12W {
365        _SMP12W { w: self }
366    }
367    #[doc = "Bits 9:11 - Channel 13 sample time selection"]
368    #[inline]
369    pub fn smp13(&mut self) -> _SMP13W {
370        _SMP13W { w: self }
371    }
372    #[doc = "Bits 12:14 - Channel 14 sample time selection"]
373    #[inline]
374    pub fn smp14(&mut self) -> _SMP14W {
375        _SMP14W { w: self }
376    }
377    #[doc = "Bits 15:17 - Channel 15 sample time selection"]
378    #[inline]
379    pub fn smp15(&mut self) -> _SMP15W {
380        _SMP15W { w: self }
381    }
382    #[doc = "Bits 18:20 - Channel 16 sample time selection"]
383    #[inline]
384    pub fn smp16(&mut self) -> _SMP16W {
385        _SMP16W { w: self }
386    }
387    #[doc = "Bits 21:23 - Channel 17 sample time selection"]
388    #[inline]
389    pub fn smp17(&mut self) -> _SMP17W {
390        _SMP17W { w: self }
391    }
392}