stm32wb_pac/sai1/
pdmcr.rs1#[doc = "Reader of register PDMCR"]
2pub type R = crate::R<u32, super::PDMCR>;
3#[doc = "Writer for register PDMCR"]
4pub type W = crate::W<u32, super::PDMCR>;
5#[doc = "Register PDMCR `reset()`'s with value 0"]
6impl crate::ResetValue for super::PDMCR {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `CKEN4`"]
14pub type CKEN4_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `CKEN4`"]
16pub struct CKEN4_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> CKEN4_W<'a> {
20 #[doc = r"Sets the field bit"]
21 #[inline(always)]
22 pub fn set_bit(self) -> &'a mut W {
23 self.bit(true)
24 }
25 #[doc = r"Clears the field bit"]
26 #[inline(always)]
27 pub fn clear_bit(self) -> &'a mut W {
28 self.bit(false)
29 }
30 #[doc = r"Writes raw bits to the field"]
31 #[inline(always)]
32 pub fn bit(self, value: bool) -> &'a mut W {
33 self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11);
34 self.w
35 }
36}
37#[doc = "Reader of field `CKEN3`"]
38pub type CKEN3_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `CKEN3`"]
40pub struct CKEN3_W<'a> {
41 w: &'a mut W,
42}
43impl<'a> CKEN3_W<'a> {
44 #[doc = r"Sets the field bit"]
45 #[inline(always)]
46 pub fn set_bit(self) -> &'a mut W {
47 self.bit(true)
48 }
49 #[doc = r"Clears the field bit"]
50 #[inline(always)]
51 pub fn clear_bit(self) -> &'a mut W {
52 self.bit(false)
53 }
54 #[doc = r"Writes raw bits to the field"]
55 #[inline(always)]
56 pub fn bit(self, value: bool) -> &'a mut W {
57 self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10);
58 self.w
59 }
60}
61#[doc = "Reader of field `CKEN2`"]
62pub type CKEN2_R = crate::R<bool, bool>;
63#[doc = "Write proxy for field `CKEN2`"]
64pub struct CKEN2_W<'a> {
65 w: &'a mut W,
66}
67impl<'a> CKEN2_W<'a> {
68 #[doc = r"Sets the field bit"]
69 #[inline(always)]
70 pub fn set_bit(self) -> &'a mut W {
71 self.bit(true)
72 }
73 #[doc = r"Clears the field bit"]
74 #[inline(always)]
75 pub fn clear_bit(self) -> &'a mut W {
76 self.bit(false)
77 }
78 #[doc = r"Writes raw bits to the field"]
79 #[inline(always)]
80 pub fn bit(self, value: bool) -> &'a mut W {
81 self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
82 self.w
83 }
84}
85#[doc = "Reader of field `CKEN1`"]
86pub type CKEN1_R = crate::R<bool, bool>;
87#[doc = "Write proxy for field `CKEN1`"]
88pub struct CKEN1_W<'a> {
89 w: &'a mut W,
90}
91impl<'a> CKEN1_W<'a> {
92 #[doc = r"Sets the field bit"]
93 #[inline(always)]
94 pub fn set_bit(self) -> &'a mut W {
95 self.bit(true)
96 }
97 #[doc = r"Clears the field bit"]
98 #[inline(always)]
99 pub fn clear_bit(self) -> &'a mut W {
100 self.bit(false)
101 }
102 #[doc = r"Writes raw bits to the field"]
103 #[inline(always)]
104 pub fn bit(self, value: bool) -> &'a mut W {
105 self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
106 self.w
107 }
108}
109#[doc = "Reader of field `MICNBR`"]
110pub type MICNBR_R = crate::R<u8, u8>;
111#[doc = "Write proxy for field `MICNBR`"]
112pub struct MICNBR_W<'a> {
113 w: &'a mut W,
114}
115impl<'a> MICNBR_W<'a> {
116 #[doc = r"Writes raw bits to the field"]
117 #[inline(always)]
118 pub unsafe fn bits(self, value: u8) -> &'a mut W {
119 self.w.bits = (self.w.bits & !(0x03 << 4)) | (((value as u32) & 0x03) << 4);
120 self.w
121 }
122}
123#[doc = "Reader of field `PDMEN`"]
124pub type PDMEN_R = crate::R<bool, bool>;
125#[doc = "Write proxy for field `PDMEN`"]
126pub struct PDMEN_W<'a> {
127 w: &'a mut W,
128}
129impl<'a> PDMEN_W<'a> {
130 #[doc = r"Sets the field bit"]
131 #[inline(always)]
132 pub fn set_bit(self) -> &'a mut W {
133 self.bit(true)
134 }
135 #[doc = r"Clears the field bit"]
136 #[inline(always)]
137 pub fn clear_bit(self) -> &'a mut W {
138 self.bit(false)
139 }
140 #[doc = r"Writes raw bits to the field"]
141 #[inline(always)]
142 pub fn bit(self, value: bool) -> &'a mut W {
143 self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
144 self.w
145 }
146}
147impl R {
148 #[doc = "Bit 11 - Clock enable of bitstream clock number 4"]
149 #[inline(always)]
150 pub fn cken4(&self) -> CKEN4_R {
151 CKEN4_R::new(((self.bits >> 11) & 0x01) != 0)
152 }
153 #[doc = "Bit 10 - Clock enable of bitstream clock number 3"]
154 #[inline(always)]
155 pub fn cken3(&self) -> CKEN3_R {
156 CKEN3_R::new(((self.bits >> 10) & 0x01) != 0)
157 }
158 #[doc = "Bit 9 - Clock enable of bitstream clock number 2"]
159 #[inline(always)]
160 pub fn cken2(&self) -> CKEN2_R {
161 CKEN2_R::new(((self.bits >> 9) & 0x01) != 0)
162 }
163 #[doc = "Bit 8 - Clock enable of bitstream clock number 1"]
164 #[inline(always)]
165 pub fn cken1(&self) -> CKEN1_R {
166 CKEN1_R::new(((self.bits >> 8) & 0x01) != 0)
167 }
168 #[doc = "Bits 4:5 - Number of microphones"]
169 #[inline(always)]
170 pub fn micnbr(&self) -> MICNBR_R {
171 MICNBR_R::new(((self.bits >> 4) & 0x03) as u8)
172 }
173 #[doc = "Bit 0 - PDM enable"]
174 #[inline(always)]
175 pub fn pdmen(&self) -> PDMEN_R {
176 PDMEN_R::new((self.bits & 0x01) != 0)
177 }
178}
179impl W {
180 #[doc = "Bit 11 - Clock enable of bitstream clock number 4"]
181 #[inline(always)]
182 pub fn cken4(&mut self) -> CKEN4_W {
183 CKEN4_W { w: self }
184 }
185 #[doc = "Bit 10 - Clock enable of bitstream clock number 3"]
186 #[inline(always)]
187 pub fn cken3(&mut self) -> CKEN3_W {
188 CKEN3_W { w: self }
189 }
190 #[doc = "Bit 9 - Clock enable of bitstream clock number 2"]
191 #[inline(always)]
192 pub fn cken2(&mut self) -> CKEN2_W {
193 CKEN2_W { w: self }
194 }
195 #[doc = "Bit 8 - Clock enable of bitstream clock number 1"]
196 #[inline(always)]
197 pub fn cken1(&mut self) -> CKEN1_W {
198 CKEN1_W { w: self }
199 }
200 #[doc = "Bits 4:5 - Number of microphones"]
201 #[inline(always)]
202 pub fn micnbr(&mut self) -> MICNBR_W {
203 MICNBR_W { w: self }
204 }
205 #[doc = "Bit 0 - PDM enable"]
206 #[inline(always)]
207 pub fn pdmen(&mut self) -> PDMEN_W {
208 PDMEN_W { w: self }
209 }
210}