stm32l4x2_pac/sai1/ch/
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::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 COMPR {
47    bits: u8,
48}
49impl COMPR {
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 CPLR {
58    bits: bool,
59}
60impl CPLR {
61    #[doc = r" Value of the field as raw bits"]
62    #[inline]
63    pub fn bit(&self) -> bool {
64        self.bits
65    }
66    #[doc = r" Returns `true` if the bit is clear (0)"]
67    #[inline]
68    pub fn bit_is_clear(&self) -> bool {
69        !self.bit()
70    }
71    #[doc = r" Returns `true` if the bit is set (1)"]
72    #[inline]
73    pub fn bit_is_set(&self) -> bool {
74        self.bit()
75    }
76}
77#[doc = r" Value of the field"]
78pub struct MUTECNR {
79    bits: u8,
80}
81impl MUTECNR {
82    #[doc = r" Value of the field as raw bits"]
83    #[inline]
84    pub fn bits(&self) -> u8 {
85        self.bits
86    }
87}
88#[doc = r" Value of the field"]
89pub struct MUTEVALR {
90    bits: bool,
91}
92impl MUTEVALR {
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 MUTER {
111    bits: bool,
112}
113impl MUTER {
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 TRISR {
132    bits: bool,
133}
134impl TRISR {
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 FFLUSR {
153    bits: bool,
154}
155impl FFLUSR {
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 FTHR {
174    bits: u8,
175}
176impl FTHR {
177    #[doc = r" Value of the field as raw bits"]
178    #[inline]
179    pub fn bits(&self) -> u8 {
180        self.bits
181    }
182}
183#[doc = r" Proxy"]
184pub struct _COMPW<'a> {
185    w: &'a mut W,
186}
187impl<'a> _COMPW<'a> {
188    #[doc = r" Writes raw bits to the field"]
189    #[inline]
190    pub unsafe fn bits(self, value: u8) -> &'a mut W {
191        const MASK: u8 = 3;
192        const OFFSET: u8 = 14;
193        self.w.bits &= !((MASK as u32) << OFFSET);
194        self.w.bits |= ((value & MASK) as u32) << OFFSET;
195        self.w
196    }
197}
198#[doc = r" Proxy"]
199pub struct _CPLW<'a> {
200    w: &'a mut W,
201}
202impl<'a> _CPLW<'a> {
203    #[doc = r" Sets the field bit"]
204    pub fn set_bit(self) -> &'a mut W {
205        self.bit(true)
206    }
207    #[doc = r" Clears the field bit"]
208    pub fn clear_bit(self) -> &'a mut W {
209        self.bit(false)
210    }
211    #[doc = r" Writes raw bits to the field"]
212    #[inline]
213    pub fn bit(self, value: bool) -> &'a mut W {
214        const MASK: bool = true;
215        const OFFSET: u8 = 13;
216        self.w.bits &= !((MASK as u32) << OFFSET);
217        self.w.bits |= ((value & MASK) as u32) << OFFSET;
218        self.w
219    }
220}
221#[doc = r" Proxy"]
222pub struct _MUTECNW<'a> {
223    w: &'a mut W,
224}
225impl<'a> _MUTECNW<'a> {
226    #[doc = r" Writes raw bits to the field"]
227    #[inline]
228    pub unsafe fn bits(self, value: u8) -> &'a mut W {
229        const MASK: u8 = 63;
230        const OFFSET: u8 = 7;
231        self.w.bits &= !((MASK as u32) << OFFSET);
232        self.w.bits |= ((value & MASK) as u32) << OFFSET;
233        self.w
234    }
235}
236#[doc = r" Proxy"]
237pub struct _MUTEVALW<'a> {
238    w: &'a mut W,
239}
240impl<'a> _MUTEVALW<'a> {
241    #[doc = r" Sets the field bit"]
242    pub fn set_bit(self) -> &'a mut W {
243        self.bit(true)
244    }
245    #[doc = r" Clears the field bit"]
246    pub fn clear_bit(self) -> &'a mut W {
247        self.bit(false)
248    }
249    #[doc = r" Writes raw bits to the field"]
250    #[inline]
251    pub fn bit(self, value: bool) -> &'a mut W {
252        const MASK: bool = true;
253        const OFFSET: u8 = 6;
254        self.w.bits &= !((MASK as u32) << OFFSET);
255        self.w.bits |= ((value & MASK) as u32) << OFFSET;
256        self.w
257    }
258}
259#[doc = r" Proxy"]
260pub struct _MUTEW<'a> {
261    w: &'a mut W,
262}
263impl<'a> _MUTEW<'a> {
264    #[doc = r" Sets the field bit"]
265    pub fn set_bit(self) -> &'a mut W {
266        self.bit(true)
267    }
268    #[doc = r" Clears the field bit"]
269    pub fn clear_bit(self) -> &'a mut W {
270        self.bit(false)
271    }
272    #[doc = r" Writes raw bits to the field"]
273    #[inline]
274    pub fn bit(self, value: bool) -> &'a mut W {
275        const MASK: bool = true;
276        const OFFSET: u8 = 5;
277        self.w.bits &= !((MASK as u32) << OFFSET);
278        self.w.bits |= ((value & MASK) as u32) << OFFSET;
279        self.w
280    }
281}
282#[doc = r" Proxy"]
283pub struct _TRISW<'a> {
284    w: &'a mut W,
285}
286impl<'a> _TRISW<'a> {
287    #[doc = r" Sets the field bit"]
288    pub fn set_bit(self) -> &'a mut W {
289        self.bit(true)
290    }
291    #[doc = r" Clears the field bit"]
292    pub fn clear_bit(self) -> &'a mut W {
293        self.bit(false)
294    }
295    #[doc = r" Writes raw bits to the field"]
296    #[inline]
297    pub fn bit(self, value: bool) -> &'a mut W {
298        const MASK: bool = true;
299        const OFFSET: u8 = 4;
300        self.w.bits &= !((MASK as u32) << OFFSET);
301        self.w.bits |= ((value & MASK) as u32) << OFFSET;
302        self.w
303    }
304}
305#[doc = r" Proxy"]
306pub struct _FFLUSW<'a> {
307    w: &'a mut W,
308}
309impl<'a> _FFLUSW<'a> {
310    #[doc = r" Sets the field bit"]
311    pub fn set_bit(self) -> &'a mut W {
312        self.bit(true)
313    }
314    #[doc = r" Clears the field bit"]
315    pub fn clear_bit(self) -> &'a mut W {
316        self.bit(false)
317    }
318    #[doc = r" Writes raw bits to the field"]
319    #[inline]
320    pub fn bit(self, value: bool) -> &'a mut W {
321        const MASK: bool = true;
322        const OFFSET: u8 = 3;
323        self.w.bits &= !((MASK as u32) << OFFSET);
324        self.w.bits |= ((value & MASK) as u32) << OFFSET;
325        self.w
326    }
327}
328#[doc = r" Proxy"]
329pub struct _FTHW<'a> {
330    w: &'a mut W,
331}
332impl<'a> _FTHW<'a> {
333    #[doc = r" Writes raw bits to the field"]
334    #[inline]
335    pub unsafe fn bits(self, value: u8) -> &'a mut W {
336        const MASK: u8 = 7;
337        const OFFSET: u8 = 0;
338        self.w.bits &= !((MASK as u32) << OFFSET);
339        self.w.bits |= ((value & MASK) as u32) << OFFSET;
340        self.w
341    }
342}
343impl R {
344    #[doc = r" Value of the register as raw bits"]
345    #[inline]
346    pub fn bits(&self) -> u32 {
347        self.bits
348    }
349    #[doc = "Bits 14:15 - Companding mode"]
350    #[inline]
351    pub fn comp(&self) -> COMPR {
352        let bits = {
353            const MASK: u8 = 3;
354            const OFFSET: u8 = 14;
355            ((self.bits >> OFFSET) & MASK as u32) as u8
356        };
357        COMPR { bits }
358    }
359    #[doc = "Bit 13 - Complement bit"]
360    #[inline]
361    pub fn cpl(&self) -> CPLR {
362        let bits = {
363            const MASK: bool = true;
364            const OFFSET: u8 = 13;
365            ((self.bits >> OFFSET) & MASK as u32) != 0
366        };
367        CPLR { bits }
368    }
369    #[doc = "Bits 7:12 - Mute counter"]
370    #[inline]
371    pub fn mutecn(&self) -> MUTECNR {
372        let bits = {
373            const MASK: u8 = 63;
374            const OFFSET: u8 = 7;
375            ((self.bits >> OFFSET) & MASK as u32) as u8
376        };
377        MUTECNR { bits }
378    }
379    #[doc = "Bit 6 - Mute value"]
380    #[inline]
381    pub fn muteval(&self) -> MUTEVALR {
382        let bits = {
383            const MASK: bool = true;
384            const OFFSET: u8 = 6;
385            ((self.bits >> OFFSET) & MASK as u32) != 0
386        };
387        MUTEVALR { bits }
388    }
389    #[doc = "Bit 5 - Mute"]
390    #[inline]
391    pub fn mute(&self) -> MUTER {
392        let bits = {
393            const MASK: bool = true;
394            const OFFSET: u8 = 5;
395            ((self.bits >> OFFSET) & MASK as u32) != 0
396        };
397        MUTER { bits }
398    }
399    #[doc = "Bit 4 - Tristate management on data line"]
400    #[inline]
401    pub fn tris(&self) -> TRISR {
402        let bits = {
403            const MASK: bool = true;
404            const OFFSET: u8 = 4;
405            ((self.bits >> OFFSET) & MASK as u32) != 0
406        };
407        TRISR { bits }
408    }
409    #[doc = "Bit 3 - FIFO flush"]
410    #[inline]
411    pub fn fflus(&self) -> FFLUSR {
412        let bits = {
413            const MASK: bool = true;
414            const OFFSET: u8 = 3;
415            ((self.bits >> OFFSET) & MASK as u32) != 0
416        };
417        FFLUSR { bits }
418    }
419    #[doc = "Bits 0:2 - FIFO threshold"]
420    #[inline]
421    pub fn fth(&self) -> FTHR {
422        let bits = {
423            const MASK: u8 = 7;
424            const OFFSET: u8 = 0;
425            ((self.bits >> OFFSET) & MASK as u32) as u8
426        };
427        FTHR { bits }
428    }
429}
430impl W {
431    #[doc = r" Reset value of the register"]
432    #[inline]
433    pub fn reset_value() -> W {
434        W { bits: 0 }
435    }
436    #[doc = r" Writes raw bits to the register"]
437    #[inline]
438    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
439        self.bits = bits;
440        self
441    }
442    #[doc = "Bits 14:15 - Companding mode"]
443    #[inline]
444    pub fn comp(&mut self) -> _COMPW {
445        _COMPW { w: self }
446    }
447    #[doc = "Bit 13 - Complement bit"]
448    #[inline]
449    pub fn cpl(&mut self) -> _CPLW {
450        _CPLW { w: self }
451    }
452    #[doc = "Bits 7:12 - Mute counter"]
453    #[inline]
454    pub fn mutecn(&mut self) -> _MUTECNW {
455        _MUTECNW { w: self }
456    }
457    #[doc = "Bit 6 - Mute value"]
458    #[inline]
459    pub fn muteval(&mut self) -> _MUTEVALW {
460        _MUTEVALW { w: self }
461    }
462    #[doc = "Bit 5 - Mute"]
463    #[inline]
464    pub fn mute(&mut self) -> _MUTEW {
465        _MUTEW { w: self }
466    }
467    #[doc = "Bit 4 - Tristate management on data line"]
468    #[inline]
469    pub fn tris(&mut self) -> _TRISW {
470        _TRISW { w: self }
471    }
472    #[doc = "Bit 3 - FIFO flush"]
473    #[inline]
474    pub fn fflus(&mut self) -> _FFLUSW {
475        _FFLUSW { w: self }
476    }
477    #[doc = "Bits 0:2 - FIFO threshold"]
478    #[inline]
479    pub fn fth(&mut self) -> _FTHW {
480        _FTHW { w: self }
481    }
482}