stm32l4x2_pac/sai1/ch/
sr.rs1#[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::SR {
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 FLVLR {
47 bits: u8,
48}
49impl FLVLR {
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 LFSDETR {
58 bits: bool,
59}
60impl LFSDETR {
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 AFSDETR {
79 bits: bool,
80}
81impl AFSDETR {
82 #[doc = r" Value of the field as raw bits"]
83 #[inline]
84 pub fn bit(&self) -> bool {
85 self.bits
86 }
87 #[doc = r" Returns `true` if the bit is clear (0)"]
88 #[inline]
89 pub fn bit_is_clear(&self) -> bool {
90 !self.bit()
91 }
92 #[doc = r" Returns `true` if the bit is set (1)"]
93 #[inline]
94 pub fn bit_is_set(&self) -> bool {
95 self.bit()
96 }
97}
98#[doc = r" Value of the field"]
99pub struct CNRDYR {
100 bits: bool,
101}
102impl CNRDYR {
103 #[doc = r" Value of the field as raw bits"]
104 #[inline]
105 pub fn bit(&self) -> bool {
106 self.bits
107 }
108 #[doc = r" Returns `true` if the bit is clear (0)"]
109 #[inline]
110 pub fn bit_is_clear(&self) -> bool {
111 !self.bit()
112 }
113 #[doc = r" Returns `true` if the bit is set (1)"]
114 #[inline]
115 pub fn bit_is_set(&self) -> bool {
116 self.bit()
117 }
118}
119#[doc = r" Value of the field"]
120pub struct FREQR {
121 bits: bool,
122}
123impl FREQR {
124 #[doc = r" Value of the field as raw bits"]
125 #[inline]
126 pub fn bit(&self) -> bool {
127 self.bits
128 }
129 #[doc = r" Returns `true` if the bit is clear (0)"]
130 #[inline]
131 pub fn bit_is_clear(&self) -> bool {
132 !self.bit()
133 }
134 #[doc = r" Returns `true` if the bit is set (1)"]
135 #[inline]
136 pub fn bit_is_set(&self) -> bool {
137 self.bit()
138 }
139}
140#[doc = r" Value of the field"]
141pub struct WCKCFGR {
142 bits: bool,
143}
144impl WCKCFGR {
145 #[doc = r" Value of the field as raw bits"]
146 #[inline]
147 pub fn bit(&self) -> bool {
148 self.bits
149 }
150 #[doc = r" Returns `true` if the bit is clear (0)"]
151 #[inline]
152 pub fn bit_is_clear(&self) -> bool {
153 !self.bit()
154 }
155 #[doc = r" Returns `true` if the bit is set (1)"]
156 #[inline]
157 pub fn bit_is_set(&self) -> bool {
158 self.bit()
159 }
160}
161#[doc = r" Value of the field"]
162pub struct MUTEDETR {
163 bits: bool,
164}
165impl MUTEDETR {
166 #[doc = r" Value of the field as raw bits"]
167 #[inline]
168 pub fn bit(&self) -> bool {
169 self.bits
170 }
171 #[doc = r" Returns `true` if the bit is clear (0)"]
172 #[inline]
173 pub fn bit_is_clear(&self) -> bool {
174 !self.bit()
175 }
176 #[doc = r" Returns `true` if the bit is set (1)"]
177 #[inline]
178 pub fn bit_is_set(&self) -> bool {
179 self.bit()
180 }
181}
182#[doc = r" Value of the field"]
183pub struct OVRUDRR {
184 bits: bool,
185}
186impl OVRUDRR {
187 #[doc = r" Value of the field as raw bits"]
188 #[inline]
189 pub fn bit(&self) -> bool {
190 self.bits
191 }
192 #[doc = r" Returns `true` if the bit is clear (0)"]
193 #[inline]
194 pub fn bit_is_clear(&self) -> bool {
195 !self.bit()
196 }
197 #[doc = r" Returns `true` if the bit is set (1)"]
198 #[inline]
199 pub fn bit_is_set(&self) -> bool {
200 self.bit()
201 }
202}
203#[doc = r" Proxy"]
204pub struct _FLVLW<'a> {
205 w: &'a mut W,
206}
207impl<'a> _FLVLW<'a> {
208 #[doc = r" Writes raw bits to the field"]
209 #[inline]
210 pub unsafe fn bits(self, value: u8) -> &'a mut W {
211 const MASK: u8 = 7;
212 const OFFSET: u8 = 16;
213 self.w.bits &= !((MASK as u32) << OFFSET);
214 self.w.bits |= ((value & MASK) as u32) << OFFSET;
215 self.w
216 }
217}
218#[doc = r" Proxy"]
219pub struct _LFSDETW<'a> {
220 w: &'a mut W,
221}
222impl<'a> _LFSDETW<'a> {
223 #[doc = r" Sets the field bit"]
224 pub fn set_bit(self) -> &'a mut W {
225 self.bit(true)
226 }
227 #[doc = r" Clears the field bit"]
228 pub fn clear_bit(self) -> &'a mut W {
229 self.bit(false)
230 }
231 #[doc = r" Writes raw bits to the field"]
232 #[inline]
233 pub fn bit(self, value: bool) -> &'a mut W {
234 const MASK: bool = true;
235 const OFFSET: u8 = 6;
236 self.w.bits &= !((MASK as u32) << OFFSET);
237 self.w.bits |= ((value & MASK) as u32) << OFFSET;
238 self.w
239 }
240}
241#[doc = r" Proxy"]
242pub struct _AFSDETW<'a> {
243 w: &'a mut W,
244}
245impl<'a> _AFSDETW<'a> {
246 #[doc = r" Sets the field bit"]
247 pub fn set_bit(self) -> &'a mut W {
248 self.bit(true)
249 }
250 #[doc = r" Clears the field bit"]
251 pub fn clear_bit(self) -> &'a mut W {
252 self.bit(false)
253 }
254 #[doc = r" Writes raw bits to the field"]
255 #[inline]
256 pub fn bit(self, value: bool) -> &'a mut W {
257 const MASK: bool = true;
258 const OFFSET: u8 = 5;
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 _CNRDYW<'a> {
266 w: &'a mut W,
267}
268impl<'a> _CNRDYW<'a> {
269 #[doc = r" Sets the field bit"]
270 pub fn set_bit(self) -> &'a mut W {
271 self.bit(true)
272 }
273 #[doc = r" Clears the field bit"]
274 pub fn clear_bit(self) -> &'a mut W {
275 self.bit(false)
276 }
277 #[doc = r" Writes raw bits to the field"]
278 #[inline]
279 pub fn bit(self, value: bool) -> &'a mut W {
280 const MASK: bool = true;
281 const OFFSET: u8 = 4;
282 self.w.bits &= !((MASK as u32) << OFFSET);
283 self.w.bits |= ((value & MASK) as u32) << OFFSET;
284 self.w
285 }
286}
287#[doc = r" Proxy"]
288pub struct _FREQW<'a> {
289 w: &'a mut W,
290}
291impl<'a> _FREQW<'a> {
292 #[doc = r" Sets the field bit"]
293 pub fn set_bit(self) -> &'a mut W {
294 self.bit(true)
295 }
296 #[doc = r" Clears the field bit"]
297 pub fn clear_bit(self) -> &'a mut W {
298 self.bit(false)
299 }
300 #[doc = r" Writes raw bits to the field"]
301 #[inline]
302 pub fn bit(self, value: bool) -> &'a mut W {
303 const MASK: bool = true;
304 const OFFSET: u8 = 3;
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 _WCKCFGW<'a> {
312 w: &'a mut W,
313}
314impl<'a> _WCKCFGW<'a> {
315 #[doc = r" Sets the field bit"]
316 pub fn set_bit(self) -> &'a mut W {
317 self.bit(true)
318 }
319 #[doc = r" Clears the field bit"]
320 pub fn clear_bit(self) -> &'a mut W {
321 self.bit(false)
322 }
323 #[doc = r" Writes raw bits to the field"]
324 #[inline]
325 pub fn bit(self, value: bool) -> &'a mut W {
326 const MASK: bool = true;
327 const OFFSET: u8 = 2;
328 self.w.bits &= !((MASK as u32) << OFFSET);
329 self.w.bits |= ((value & MASK) as u32) << OFFSET;
330 self.w
331 }
332}
333#[doc = r" Proxy"]
334pub struct _MUTEDETW<'a> {
335 w: &'a mut W,
336}
337impl<'a> _MUTEDETW<'a> {
338 #[doc = r" Sets the field bit"]
339 pub fn set_bit(self) -> &'a mut W {
340 self.bit(true)
341 }
342 #[doc = r" Clears the field bit"]
343 pub fn clear_bit(self) -> &'a mut W {
344 self.bit(false)
345 }
346 #[doc = r" Writes raw bits to the field"]
347 #[inline]
348 pub fn bit(self, value: bool) -> &'a mut W {
349 const MASK: bool = true;
350 const OFFSET: u8 = 1;
351 self.w.bits &= !((MASK as u32) << OFFSET);
352 self.w.bits |= ((value & MASK) as u32) << OFFSET;
353 self.w
354 }
355}
356#[doc = r" Proxy"]
357pub struct _OVRUDRW<'a> {
358 w: &'a mut W,
359}
360impl<'a> _OVRUDRW<'a> {
361 #[doc = r" Sets the field bit"]
362 pub fn set_bit(self) -> &'a mut W {
363 self.bit(true)
364 }
365 #[doc = r" Clears the field bit"]
366 pub fn clear_bit(self) -> &'a mut W {
367 self.bit(false)
368 }
369 #[doc = r" Writes raw bits to the field"]
370 #[inline]
371 pub fn bit(self, value: bool) -> &'a mut W {
372 const MASK: bool = true;
373 const OFFSET: u8 = 0;
374 self.w.bits &= !((MASK as u32) << OFFSET);
375 self.w.bits |= ((value & MASK) as u32) << OFFSET;
376 self.w
377 }
378}
379impl R {
380 #[doc = r" Value of the register as raw bits"]
381 #[inline]
382 pub fn bits(&self) -> u32 {
383 self.bits
384 }
385 #[doc = "Bits 16:18 - FIFO level threshold"]
386 #[inline]
387 pub fn flvl(&self) -> FLVLR {
388 let bits = {
389 const MASK: u8 = 7;
390 const OFFSET: u8 = 16;
391 ((self.bits >> OFFSET) & MASK as u32) as u8
392 };
393 FLVLR { bits }
394 }
395 #[doc = "Bit 6 - Late frame synchronization detection"]
396 #[inline]
397 pub fn lfsdet(&self) -> LFSDETR {
398 let bits = {
399 const MASK: bool = true;
400 const OFFSET: u8 = 6;
401 ((self.bits >> OFFSET) & MASK as u32) != 0
402 };
403 LFSDETR { bits }
404 }
405 #[doc = "Bit 5 - Anticipated frame synchronization detection"]
406 #[inline]
407 pub fn afsdet(&self) -> AFSDETR {
408 let bits = {
409 const MASK: bool = true;
410 const OFFSET: u8 = 5;
411 ((self.bits >> OFFSET) & MASK as u32) != 0
412 };
413 AFSDETR { bits }
414 }
415 #[doc = "Bit 4 - Codec not ready"]
416 #[inline]
417 pub fn cnrdy(&self) -> CNRDYR {
418 let bits = {
419 const MASK: bool = true;
420 const OFFSET: u8 = 4;
421 ((self.bits >> OFFSET) & MASK as u32) != 0
422 };
423 CNRDYR { bits }
424 }
425 #[doc = "Bit 3 - FIFO request"]
426 #[inline]
427 pub fn freq(&self) -> FREQR {
428 let bits = {
429 const MASK: bool = true;
430 const OFFSET: u8 = 3;
431 ((self.bits >> OFFSET) & MASK as u32) != 0
432 };
433 FREQR { bits }
434 }
435 #[doc = "Bit 2 - Wrong clock configuration flag. This bit is read only"]
436 #[inline]
437 pub fn wckcfg(&self) -> WCKCFGR {
438 let bits = {
439 const MASK: bool = true;
440 const OFFSET: u8 = 2;
441 ((self.bits >> OFFSET) & MASK as u32) != 0
442 };
443 WCKCFGR { bits }
444 }
445 #[doc = "Bit 1 - Mute detection"]
446 #[inline]
447 pub fn mutedet(&self) -> MUTEDETR {
448 let bits = {
449 const MASK: bool = true;
450 const OFFSET: u8 = 1;
451 ((self.bits >> OFFSET) & MASK as u32) != 0
452 };
453 MUTEDETR { bits }
454 }
455 #[doc = "Bit 0 - Overrun / underrun"]
456 #[inline]
457 pub fn ovrudr(&self) -> OVRUDRR {
458 let bits = {
459 const MASK: bool = true;
460 const OFFSET: u8 = 0;
461 ((self.bits >> OFFSET) & MASK as u32) != 0
462 };
463 OVRUDRR { bits }
464 }
465}
466impl W {
467 #[doc = r" Reset value of the register"]
468 #[inline]
469 pub fn reset_value() -> W {
470 W { bits: 0 }
471 }
472 #[doc = r" Writes raw bits to the register"]
473 #[inline]
474 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
475 self.bits = bits;
476 self
477 }
478 #[doc = "Bits 16:18 - FIFO level threshold"]
479 #[inline]
480 pub fn flvl(&mut self) -> _FLVLW {
481 _FLVLW { w: self }
482 }
483 #[doc = "Bit 6 - Late frame synchronization detection"]
484 #[inline]
485 pub fn lfsdet(&mut self) -> _LFSDETW {
486 _LFSDETW { w: self }
487 }
488 #[doc = "Bit 5 - Anticipated frame synchronization detection"]
489 #[inline]
490 pub fn afsdet(&mut self) -> _AFSDETW {
491 _AFSDETW { w: self }
492 }
493 #[doc = "Bit 4 - Codec not ready"]
494 #[inline]
495 pub fn cnrdy(&mut self) -> _CNRDYW {
496 _CNRDYW { w: self }
497 }
498 #[doc = "Bit 3 - FIFO request"]
499 #[inline]
500 pub fn freq(&mut self) -> _FREQW {
501 _FREQW { w: self }
502 }
503 #[doc = "Bit 2 - Wrong clock configuration flag. This bit is read only"]
504 #[inline]
505 pub fn wckcfg(&mut self) -> _WCKCFGW {
506 _WCKCFGW { w: self }
507 }
508 #[doc = "Bit 1 - Mute detection"]
509 #[inline]
510 pub fn mutedet(&mut self) -> _MUTEDETW {
511 _MUTEDETW { w: self }
512 }
513 #[doc = "Bit 0 - Overrun / underrun"]
514 #[inline]
515 pub fn ovrudr(&mut self) -> _OVRUDRW {
516 _OVRUDRW { w: self }
517 }
518}