stm32l4x6/dfsdm/
chcfg6r1.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::CHCFG6R1 {
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 DATPACKR {
47    bits: u8,
48}
49impl DATPACKR {
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 DATMPXR {
58    bits: u8,
59}
60impl DATMPXR {
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 CHINSELR {
69    bits: bool,
70}
71impl CHINSELR {
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 CHENR {
90    bits: bool,
91}
92impl CHENR {
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 CKABENR {
111    bits: bool,
112}
113impl CKABENR {
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 SCDENR {
132    bits: bool,
133}
134impl SCDENR {
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 SPICKSELR {
153    bits: u8,
154}
155impl SPICKSELR {
156    #[doc = r" Value of the field as raw bits"]
157    #[inline]
158    pub fn bits(&self) -> u8 {
159        self.bits
160    }
161}
162#[doc = r" Value of the field"]
163pub struct SITPR {
164    bits: u8,
165}
166impl SITPR {
167    #[doc = r" Value of the field as raw bits"]
168    #[inline]
169    pub fn bits(&self) -> u8 {
170        self.bits
171    }
172}
173#[doc = r" Proxy"]
174pub struct _DATPACKW<'a> {
175    w: &'a mut W,
176}
177impl<'a> _DATPACKW<'a> {
178    #[doc = r" Writes raw bits to the field"]
179    #[inline]
180    pub unsafe fn bits(self, value: u8) -> &'a mut W {
181        const MASK: u8 = 3;
182        const OFFSET: u8 = 14;
183        self.w.bits &= !((MASK as u32) << OFFSET);
184        self.w.bits |= ((value & MASK) as u32) << OFFSET;
185        self.w
186    }
187}
188#[doc = r" Proxy"]
189pub struct _DATMPXW<'a> {
190    w: &'a mut W,
191}
192impl<'a> _DATMPXW<'a> {
193    #[doc = r" Writes raw bits to the field"]
194    #[inline]
195    pub unsafe fn bits(self, value: u8) -> &'a mut W {
196        const MASK: u8 = 3;
197        const OFFSET: u8 = 12;
198        self.w.bits &= !((MASK as u32) << OFFSET);
199        self.w.bits |= ((value & MASK) as u32) << OFFSET;
200        self.w
201    }
202}
203#[doc = r" Proxy"]
204pub struct _CHINSELW<'a> {
205    w: &'a mut W,
206}
207impl<'a> _CHINSELW<'a> {
208    #[doc = r" Sets the field bit"]
209    pub fn set_bit(self) -> &'a mut W {
210        self.bit(true)
211    }
212    #[doc = r" Clears the field bit"]
213    pub fn clear_bit(self) -> &'a mut W {
214        self.bit(false)
215    }
216    #[doc = r" Writes raw bits to the field"]
217    #[inline]
218    pub fn bit(self, value: bool) -> &'a mut W {
219        const MASK: bool = true;
220        const OFFSET: u8 = 8;
221        self.w.bits &= !((MASK as u32) << OFFSET);
222        self.w.bits |= ((value & MASK) as u32) << OFFSET;
223        self.w
224    }
225}
226#[doc = r" Proxy"]
227pub struct _CHENW<'a> {
228    w: &'a mut W,
229}
230impl<'a> _CHENW<'a> {
231    #[doc = r" Sets the field bit"]
232    pub fn set_bit(self) -> &'a mut W {
233        self.bit(true)
234    }
235    #[doc = r" Clears the field bit"]
236    pub fn clear_bit(self) -> &'a mut W {
237        self.bit(false)
238    }
239    #[doc = r" Writes raw bits to the field"]
240    #[inline]
241    pub fn bit(self, value: bool) -> &'a mut W {
242        const MASK: bool = true;
243        const OFFSET: u8 = 7;
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 _CKABENW<'a> {
251    w: &'a mut W,
252}
253impl<'a> _CKABENW<'a> {
254    #[doc = r" Sets the field bit"]
255    pub fn set_bit(self) -> &'a mut W {
256        self.bit(true)
257    }
258    #[doc = r" Clears the field bit"]
259    pub fn clear_bit(self) -> &'a mut W {
260        self.bit(false)
261    }
262    #[doc = r" Writes raw bits to the field"]
263    #[inline]
264    pub fn bit(self, value: bool) -> &'a mut W {
265        const MASK: bool = true;
266        const OFFSET: u8 = 6;
267        self.w.bits &= !((MASK as u32) << OFFSET);
268        self.w.bits |= ((value & MASK) as u32) << OFFSET;
269        self.w
270    }
271}
272#[doc = r" Proxy"]
273pub struct _SCDENW<'a> {
274    w: &'a mut W,
275}
276impl<'a> _SCDENW<'a> {
277    #[doc = r" Sets the field bit"]
278    pub fn set_bit(self) -> &'a mut W {
279        self.bit(true)
280    }
281    #[doc = r" Clears the field bit"]
282    pub fn clear_bit(self) -> &'a mut W {
283        self.bit(false)
284    }
285    #[doc = r" Writes raw bits to the field"]
286    #[inline]
287    pub fn bit(self, value: bool) -> &'a mut W {
288        const MASK: bool = true;
289        const OFFSET: u8 = 5;
290        self.w.bits &= !((MASK as u32) << OFFSET);
291        self.w.bits |= ((value & MASK) as u32) << OFFSET;
292        self.w
293    }
294}
295#[doc = r" Proxy"]
296pub struct _SPICKSELW<'a> {
297    w: &'a mut W,
298}
299impl<'a> _SPICKSELW<'a> {
300    #[doc = r" Writes raw bits to the field"]
301    #[inline]
302    pub unsafe fn bits(self, value: u8) -> &'a mut W {
303        const MASK: u8 = 3;
304        const OFFSET: u8 = 2;
305        self.w.bits &= !((MASK as u32) << OFFSET);
306        self.w.bits |= ((value & MASK) as u32) << OFFSET;
307        self.w
308    }
309}
310#[doc = r" Proxy"]
311pub struct _SITPW<'a> {
312    w: &'a mut W,
313}
314impl<'a> _SITPW<'a> {
315    #[doc = r" Writes raw bits to the field"]
316    #[inline]
317    pub unsafe fn bits(self, value: u8) -> &'a mut W {
318        const MASK: u8 = 3;
319        const OFFSET: u8 = 0;
320        self.w.bits &= !((MASK as u32) << OFFSET);
321        self.w.bits |= ((value & MASK) as u32) << OFFSET;
322        self.w
323    }
324}
325impl R {
326    #[doc = r" Value of the register as raw bits"]
327    #[inline]
328    pub fn bits(&self) -> u32 {
329        self.bits
330    }
331    #[doc = "Bits 14:15 - DATPACK"]
332    #[inline]
333    pub fn datpack(&self) -> DATPACKR {
334        let bits = {
335            const MASK: u8 = 3;
336            const OFFSET: u8 = 14;
337            ((self.bits >> OFFSET) & MASK as u32) as u8
338        };
339        DATPACKR { bits }
340    }
341    #[doc = "Bits 12:13 - DATMPX"]
342    #[inline]
343    pub fn datmpx(&self) -> DATMPXR {
344        let bits = {
345            const MASK: u8 = 3;
346            const OFFSET: u8 = 12;
347            ((self.bits >> OFFSET) & MASK as u32) as u8
348        };
349        DATMPXR { bits }
350    }
351    #[doc = "Bit 8 - CHINSEL"]
352    #[inline]
353    pub fn chinsel(&self) -> CHINSELR {
354        let bits = {
355            const MASK: bool = true;
356            const OFFSET: u8 = 8;
357            ((self.bits >> OFFSET) & MASK as u32) != 0
358        };
359        CHINSELR { bits }
360    }
361    #[doc = "Bit 7 - CHEN"]
362    #[inline]
363    pub fn chen(&self) -> CHENR {
364        let bits = {
365            const MASK: bool = true;
366            const OFFSET: u8 = 7;
367            ((self.bits >> OFFSET) & MASK as u32) != 0
368        };
369        CHENR { bits }
370    }
371    #[doc = "Bit 6 - CKABEN"]
372    #[inline]
373    pub fn ckaben(&self) -> CKABENR {
374        let bits = {
375            const MASK: bool = true;
376            const OFFSET: u8 = 6;
377            ((self.bits >> OFFSET) & MASK as u32) != 0
378        };
379        CKABENR { bits }
380    }
381    #[doc = "Bit 5 - SCDEN"]
382    #[inline]
383    pub fn scden(&self) -> SCDENR {
384        let bits = {
385            const MASK: bool = true;
386            const OFFSET: u8 = 5;
387            ((self.bits >> OFFSET) & MASK as u32) != 0
388        };
389        SCDENR { bits }
390    }
391    #[doc = "Bits 2:3 - SPICKSEL"]
392    #[inline]
393    pub fn spicksel(&self) -> SPICKSELR {
394        let bits = {
395            const MASK: u8 = 3;
396            const OFFSET: u8 = 2;
397            ((self.bits >> OFFSET) & MASK as u32) as u8
398        };
399        SPICKSELR { bits }
400    }
401    #[doc = "Bits 0:1 - SITP"]
402    #[inline]
403    pub fn sitp(&self) -> SITPR {
404        let bits = {
405            const MASK: u8 = 3;
406            const OFFSET: u8 = 0;
407            ((self.bits >> OFFSET) & MASK as u32) as u8
408        };
409        SITPR { bits }
410    }
411}
412impl W {
413    #[doc = r" Reset value of the register"]
414    #[inline]
415    pub fn reset_value() -> W {
416        W { bits: 0 }
417    }
418    #[doc = r" Writes raw bits to the register"]
419    #[inline]
420    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
421        self.bits = bits;
422        self
423    }
424    #[doc = "Bits 14:15 - DATPACK"]
425    #[inline]
426    pub fn datpack(&mut self) -> _DATPACKW {
427        _DATPACKW { w: self }
428    }
429    #[doc = "Bits 12:13 - DATMPX"]
430    #[inline]
431    pub fn datmpx(&mut self) -> _DATMPXW {
432        _DATMPXW { w: self }
433    }
434    #[doc = "Bit 8 - CHINSEL"]
435    #[inline]
436    pub fn chinsel(&mut self) -> _CHINSELW {
437        _CHINSELW { w: self }
438    }
439    #[doc = "Bit 7 - CHEN"]
440    #[inline]
441    pub fn chen(&mut self) -> _CHENW {
442        _CHENW { w: self }
443    }
444    #[doc = "Bit 6 - CKABEN"]
445    #[inline]
446    pub fn ckaben(&mut self) -> _CKABENW {
447        _CKABENW { w: self }
448    }
449    #[doc = "Bit 5 - SCDEN"]
450    #[inline]
451    pub fn scden(&mut self) -> _SCDENW {
452        _SCDENW { w: self }
453    }
454    #[doc = "Bits 2:3 - SPICKSEL"]
455    #[inline]
456    pub fn spicksel(&mut self) -> _SPICKSELW {
457        _SPICKSELW { w: self }
458    }
459    #[doc = "Bits 0:1 - SITP"]
460    #[inline]
461    pub fn sitp(&mut self) -> _SITPW {
462        _SITPW { w: self }
463    }
464}