stm32l4x2_pac/sai1/ch/
cr1.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::CR1 {
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 MCJDIVR {
47 bits: u8,
48}
49impl MCJDIVR {
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 NODIVR {
58 bits: bool,
59}
60impl NODIVR {
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 DMAENR {
79 bits: bool,
80}
81impl DMAENR {
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 SAIAENR {
100 bits: bool,
101}
102impl SAIAENR {
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 OUTDRIR {
121 bits: bool,
122}
123impl OUTDRIR {
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 MONOR {
142 bits: bool,
143}
144impl MONOR {
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 SYNCENR {
163 bits: u8,
164}
165impl SYNCENR {
166 #[doc = r" Value of the field as raw bits"]
167 #[inline]
168 pub fn bits(&self) -> u8 {
169 self.bits
170 }
171}
172#[doc = r" Value of the field"]
173pub struct CKSTRR {
174 bits: bool,
175}
176impl CKSTRR {
177 #[doc = r" Value of the field as raw bits"]
178 #[inline]
179 pub fn bit(&self) -> bool {
180 self.bits
181 }
182 #[doc = r" Returns `true` if the bit is clear (0)"]
183 #[inline]
184 pub fn bit_is_clear(&self) -> bool {
185 !self.bit()
186 }
187 #[doc = r" Returns `true` if the bit is set (1)"]
188 #[inline]
189 pub fn bit_is_set(&self) -> bool {
190 self.bit()
191 }
192}
193#[doc = r" Value of the field"]
194pub struct LSBFIRSTR {
195 bits: bool,
196}
197impl LSBFIRSTR {
198 #[doc = r" Value of the field as raw bits"]
199 #[inline]
200 pub fn bit(&self) -> bool {
201 self.bits
202 }
203 #[doc = r" Returns `true` if the bit is clear (0)"]
204 #[inline]
205 pub fn bit_is_clear(&self) -> bool {
206 !self.bit()
207 }
208 #[doc = r" Returns `true` if the bit is set (1)"]
209 #[inline]
210 pub fn bit_is_set(&self) -> bool {
211 self.bit()
212 }
213}
214#[doc = r" Value of the field"]
215pub struct DSR {
216 bits: u8,
217}
218impl DSR {
219 #[doc = r" Value of the field as raw bits"]
220 #[inline]
221 pub fn bits(&self) -> u8 {
222 self.bits
223 }
224}
225#[doc = r" Value of the field"]
226pub struct PRTCFGR {
227 bits: u8,
228}
229impl PRTCFGR {
230 #[doc = r" Value of the field as raw bits"]
231 #[inline]
232 pub fn bits(&self) -> u8 {
233 self.bits
234 }
235}
236#[doc = r" Value of the field"]
237pub struct MODER {
238 bits: u8,
239}
240impl MODER {
241 #[doc = r" Value of the field as raw bits"]
242 #[inline]
243 pub fn bits(&self) -> u8 {
244 self.bits
245 }
246}
247#[doc = r" Proxy"]
248pub struct _MCJDIVW<'a> {
249 w: &'a mut W,
250}
251impl<'a> _MCJDIVW<'a> {
252 #[doc = r" Writes raw bits to the field"]
253 #[inline]
254 pub unsafe fn bits(self, value: u8) -> &'a mut W {
255 const MASK: u8 = 15;
256 const OFFSET: u8 = 20;
257 self.w.bits &= !((MASK as u32) << OFFSET);
258 self.w.bits |= ((value & MASK) as u32) << OFFSET;
259 self.w
260 }
261}
262#[doc = r" Proxy"]
263pub struct _NODIVW<'a> {
264 w: &'a mut W,
265}
266impl<'a> _NODIVW<'a> {
267 #[doc = r" Sets the field bit"]
268 pub fn set_bit(self) -> &'a mut W {
269 self.bit(true)
270 }
271 #[doc = r" Clears the field bit"]
272 pub fn clear_bit(self) -> &'a mut W {
273 self.bit(false)
274 }
275 #[doc = r" Writes raw bits to the field"]
276 #[inline]
277 pub fn bit(self, value: bool) -> &'a mut W {
278 const MASK: bool = true;
279 const OFFSET: u8 = 19;
280 self.w.bits &= !((MASK as u32) << OFFSET);
281 self.w.bits |= ((value & MASK) as u32) << OFFSET;
282 self.w
283 }
284}
285#[doc = r" Proxy"]
286pub struct _DMAENW<'a> {
287 w: &'a mut W,
288}
289impl<'a> _DMAENW<'a> {
290 #[doc = r" Sets the field bit"]
291 pub fn set_bit(self) -> &'a mut W {
292 self.bit(true)
293 }
294 #[doc = r" Clears the field bit"]
295 pub fn clear_bit(self) -> &'a mut W {
296 self.bit(false)
297 }
298 #[doc = r" Writes raw bits to the field"]
299 #[inline]
300 pub fn bit(self, value: bool) -> &'a mut W {
301 const MASK: bool = true;
302 const OFFSET: u8 = 17;
303 self.w.bits &= !((MASK as u32) << OFFSET);
304 self.w.bits |= ((value & MASK) as u32) << OFFSET;
305 self.w
306 }
307}
308#[doc = r" Proxy"]
309pub struct _SAIAENW<'a> {
310 w: &'a mut W,
311}
312impl<'a> _SAIAENW<'a> {
313 #[doc = r" Sets the field bit"]
314 pub fn set_bit(self) -> &'a mut W {
315 self.bit(true)
316 }
317 #[doc = r" Clears the field bit"]
318 pub fn clear_bit(self) -> &'a mut W {
319 self.bit(false)
320 }
321 #[doc = r" Writes raw bits to the field"]
322 #[inline]
323 pub fn bit(self, value: bool) -> &'a mut W {
324 const MASK: bool = true;
325 const OFFSET: u8 = 16;
326 self.w.bits &= !((MASK as u32) << OFFSET);
327 self.w.bits |= ((value & MASK) as u32) << OFFSET;
328 self.w
329 }
330}
331#[doc = r" Proxy"]
332pub struct _OUTDRIW<'a> {
333 w: &'a mut W,
334}
335impl<'a> _OUTDRIW<'a> {
336 #[doc = r" Sets the field bit"]
337 pub fn set_bit(self) -> &'a mut W {
338 self.bit(true)
339 }
340 #[doc = r" Clears the field bit"]
341 pub fn clear_bit(self) -> &'a mut W {
342 self.bit(false)
343 }
344 #[doc = r" Writes raw bits to the field"]
345 #[inline]
346 pub fn bit(self, value: bool) -> &'a mut W {
347 const MASK: bool = true;
348 const OFFSET: u8 = 13;
349 self.w.bits &= !((MASK as u32) << OFFSET);
350 self.w.bits |= ((value & MASK) as u32) << OFFSET;
351 self.w
352 }
353}
354#[doc = r" Proxy"]
355pub struct _MONOW<'a> {
356 w: &'a mut W,
357}
358impl<'a> _MONOW<'a> {
359 #[doc = r" Sets the field bit"]
360 pub fn set_bit(self) -> &'a mut W {
361 self.bit(true)
362 }
363 #[doc = r" Clears the field bit"]
364 pub fn clear_bit(self) -> &'a mut W {
365 self.bit(false)
366 }
367 #[doc = r" Writes raw bits to the field"]
368 #[inline]
369 pub fn bit(self, value: bool) -> &'a mut W {
370 const MASK: bool = true;
371 const OFFSET: u8 = 12;
372 self.w.bits &= !((MASK as u32) << OFFSET);
373 self.w.bits |= ((value & MASK) as u32) << OFFSET;
374 self.w
375 }
376}
377#[doc = r" Proxy"]
378pub struct _SYNCENW<'a> {
379 w: &'a mut W,
380}
381impl<'a> _SYNCENW<'a> {
382 #[doc = r" Writes raw bits to the field"]
383 #[inline]
384 pub unsafe fn bits(self, value: u8) -> &'a mut W {
385 const MASK: u8 = 3;
386 const OFFSET: u8 = 10;
387 self.w.bits &= !((MASK as u32) << OFFSET);
388 self.w.bits |= ((value & MASK) as u32) << OFFSET;
389 self.w
390 }
391}
392#[doc = r" Proxy"]
393pub struct _CKSTRW<'a> {
394 w: &'a mut W,
395}
396impl<'a> _CKSTRW<'a> {
397 #[doc = r" Sets the field bit"]
398 pub fn set_bit(self) -> &'a mut W {
399 self.bit(true)
400 }
401 #[doc = r" Clears the field bit"]
402 pub fn clear_bit(self) -> &'a mut W {
403 self.bit(false)
404 }
405 #[doc = r" Writes raw bits to the field"]
406 #[inline]
407 pub fn bit(self, value: bool) -> &'a mut W {
408 const MASK: bool = true;
409 const OFFSET: u8 = 9;
410 self.w.bits &= !((MASK as u32) << OFFSET);
411 self.w.bits |= ((value & MASK) as u32) << OFFSET;
412 self.w
413 }
414}
415#[doc = r" Proxy"]
416pub struct _LSBFIRSTW<'a> {
417 w: &'a mut W,
418}
419impl<'a> _LSBFIRSTW<'a> {
420 #[doc = r" Sets the field bit"]
421 pub fn set_bit(self) -> &'a mut W {
422 self.bit(true)
423 }
424 #[doc = r" Clears the field bit"]
425 pub fn clear_bit(self) -> &'a mut W {
426 self.bit(false)
427 }
428 #[doc = r" Writes raw bits to the field"]
429 #[inline]
430 pub fn bit(self, value: bool) -> &'a mut W {
431 const MASK: bool = true;
432 const OFFSET: u8 = 8;
433 self.w.bits &= !((MASK as u32) << OFFSET);
434 self.w.bits |= ((value & MASK) as u32) << OFFSET;
435 self.w
436 }
437}
438#[doc = r" Proxy"]
439pub struct _DSW<'a> {
440 w: &'a mut W,
441}
442impl<'a> _DSW<'a> {
443 #[doc = r" Writes raw bits to the field"]
444 #[inline]
445 pub unsafe fn bits(self, value: u8) -> &'a mut W {
446 const MASK: u8 = 7;
447 const OFFSET: u8 = 5;
448 self.w.bits &= !((MASK as u32) << OFFSET);
449 self.w.bits |= ((value & MASK) as u32) << OFFSET;
450 self.w
451 }
452}
453#[doc = r" Proxy"]
454pub struct _PRTCFGW<'a> {
455 w: &'a mut W,
456}
457impl<'a> _PRTCFGW<'a> {
458 #[doc = r" Writes raw bits to the field"]
459 #[inline]
460 pub unsafe fn bits(self, value: u8) -> &'a mut W {
461 const MASK: u8 = 3;
462 const OFFSET: u8 = 2;
463 self.w.bits &= !((MASK as u32) << OFFSET);
464 self.w.bits |= ((value & MASK) as u32) << OFFSET;
465 self.w
466 }
467}
468#[doc = r" Proxy"]
469pub struct _MODEW<'a> {
470 w: &'a mut W,
471}
472impl<'a> _MODEW<'a> {
473 #[doc = r" Writes raw bits to the field"]
474 #[inline]
475 pub unsafe fn bits(self, value: u8) -> &'a mut W {
476 const MASK: u8 = 3;
477 const OFFSET: u8 = 0;
478 self.w.bits &= !((MASK as u32) << OFFSET);
479 self.w.bits |= ((value & MASK) as u32) << OFFSET;
480 self.w
481 }
482}
483impl R {
484 #[doc = r" Value of the register as raw bits"]
485 #[inline]
486 pub fn bits(&self) -> u32 {
487 self.bits
488 }
489 #[doc = "Bits 20:23 - Master clock divider"]
490 #[inline]
491 pub fn mcjdiv(&self) -> MCJDIVR {
492 let bits = {
493 const MASK: u8 = 15;
494 const OFFSET: u8 = 20;
495 ((self.bits >> OFFSET) & MASK as u32) as u8
496 };
497 MCJDIVR { bits }
498 }
499 #[doc = "Bit 19 - No divider"]
500 #[inline]
501 pub fn nodiv(&self) -> NODIVR {
502 let bits = {
503 const MASK: bool = true;
504 const OFFSET: u8 = 19;
505 ((self.bits >> OFFSET) & MASK as u32) != 0
506 };
507 NODIVR { bits }
508 }
509 #[doc = "Bit 17 - DMA enable"]
510 #[inline]
511 pub fn dmaen(&self) -> DMAENR {
512 let bits = {
513 const MASK: bool = true;
514 const OFFSET: u8 = 17;
515 ((self.bits >> OFFSET) & MASK as u32) != 0
516 };
517 DMAENR { bits }
518 }
519 #[doc = "Bit 16 - Audio block A enable"]
520 #[inline]
521 pub fn saiaen(&self) -> SAIAENR {
522 let bits = {
523 const MASK: bool = true;
524 const OFFSET: u8 = 16;
525 ((self.bits >> OFFSET) & MASK as u32) != 0
526 };
527 SAIAENR { bits }
528 }
529 #[doc = "Bit 13 - Output drive"]
530 #[inline]
531 pub fn out_dri(&self) -> OUTDRIR {
532 let bits = {
533 const MASK: bool = true;
534 const OFFSET: u8 = 13;
535 ((self.bits >> OFFSET) & MASK as u32) != 0
536 };
537 OUTDRIR { bits }
538 }
539 #[doc = "Bit 12 - Mono mode"]
540 #[inline]
541 pub fn mono(&self) -> MONOR {
542 let bits = {
543 const MASK: bool = true;
544 const OFFSET: u8 = 12;
545 ((self.bits >> OFFSET) & MASK as u32) != 0
546 };
547 MONOR { bits }
548 }
549 #[doc = "Bits 10:11 - Synchronization enable"]
550 #[inline]
551 pub fn syncen(&self) -> SYNCENR {
552 let bits = {
553 const MASK: u8 = 3;
554 const OFFSET: u8 = 10;
555 ((self.bits >> OFFSET) & MASK as u32) as u8
556 };
557 SYNCENR { bits }
558 }
559 #[doc = "Bit 9 - Clock strobing edge"]
560 #[inline]
561 pub fn ckstr(&self) -> CKSTRR {
562 let bits = {
563 const MASK: bool = true;
564 const OFFSET: u8 = 9;
565 ((self.bits >> OFFSET) & MASK as u32) != 0
566 };
567 CKSTRR { bits }
568 }
569 #[doc = "Bit 8 - Least significant bit first"]
570 #[inline]
571 pub fn lsbfirst(&self) -> LSBFIRSTR {
572 let bits = {
573 const MASK: bool = true;
574 const OFFSET: u8 = 8;
575 ((self.bits >> OFFSET) & MASK as u32) != 0
576 };
577 LSBFIRSTR { bits }
578 }
579 #[doc = "Bits 5:7 - Data size"]
580 #[inline]
581 pub fn ds(&self) -> DSR {
582 let bits = {
583 const MASK: u8 = 7;
584 const OFFSET: u8 = 5;
585 ((self.bits >> OFFSET) & MASK as u32) as u8
586 };
587 DSR { bits }
588 }
589 #[doc = "Bits 2:3 - Protocol configuration"]
590 #[inline]
591 pub fn prtcfg(&self) -> PRTCFGR {
592 let bits = {
593 const MASK: u8 = 3;
594 const OFFSET: u8 = 2;
595 ((self.bits >> OFFSET) & MASK as u32) as u8
596 };
597 PRTCFGR { bits }
598 }
599 #[doc = "Bits 0:1 - Audio block mode"]
600 #[inline]
601 pub fn mode(&self) -> MODER {
602 let bits = {
603 const MASK: u8 = 3;
604 const OFFSET: u8 = 0;
605 ((self.bits >> OFFSET) & MASK as u32) as u8
606 };
607 MODER { bits }
608 }
609}
610impl W {
611 #[doc = r" Reset value of the register"]
612 #[inline]
613 pub fn reset_value() -> W {
614 W { bits: 64 }
615 }
616 #[doc = r" Writes raw bits to the register"]
617 #[inline]
618 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
619 self.bits = bits;
620 self
621 }
622 #[doc = "Bits 20:23 - Master clock divider"]
623 #[inline]
624 pub fn mcjdiv(&mut self) -> _MCJDIVW {
625 _MCJDIVW { w: self }
626 }
627 #[doc = "Bit 19 - No divider"]
628 #[inline]
629 pub fn nodiv(&mut self) -> _NODIVW {
630 _NODIVW { w: self }
631 }
632 #[doc = "Bit 17 - DMA enable"]
633 #[inline]
634 pub fn dmaen(&mut self) -> _DMAENW {
635 _DMAENW { w: self }
636 }
637 #[doc = "Bit 16 - Audio block A enable"]
638 #[inline]
639 pub fn saiaen(&mut self) -> _SAIAENW {
640 _SAIAENW { w: self }
641 }
642 #[doc = "Bit 13 - Output drive"]
643 #[inline]
644 pub fn out_dri(&mut self) -> _OUTDRIW {
645 _OUTDRIW { w: self }
646 }
647 #[doc = "Bit 12 - Mono mode"]
648 #[inline]
649 pub fn mono(&mut self) -> _MONOW {
650 _MONOW { w: self }
651 }
652 #[doc = "Bits 10:11 - Synchronization enable"]
653 #[inline]
654 pub fn syncen(&mut self) -> _SYNCENW {
655 _SYNCENW { w: self }
656 }
657 #[doc = "Bit 9 - Clock strobing edge"]
658 #[inline]
659 pub fn ckstr(&mut self) -> _CKSTRW {
660 _CKSTRW { w: self }
661 }
662 #[doc = "Bit 8 - Least significant bit first"]
663 #[inline]
664 pub fn lsbfirst(&mut self) -> _LSBFIRSTW {
665 _LSBFIRSTW { w: self }
666 }
667 #[doc = "Bits 5:7 - Data size"]
668 #[inline]
669 pub fn ds(&mut self) -> _DSW {
670 _DSW { w: self }
671 }
672 #[doc = "Bits 2:3 - Protocol configuration"]
673 #[inline]
674 pub fn prtcfg(&mut self) -> _PRTCFGW {
675 _PRTCFGW { w: self }
676 }
677 #[doc = "Bits 0:1 - Audio block mode"]
678 #[inline]
679 pub fn mode(&mut self) -> _MODEW {
680 _MODEW { w: self }
681 }
682}