stm32l4x2_pac/sai1/ch/
frcr.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::FRCR {
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 FSOFFR {
47 bits: bool,
48}
49impl FSOFFR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bit(&self) -> bool {
53 self.bits
54 }
55 #[doc = r" Returns `true` if the bit is clear (0)"]
56 #[inline]
57 pub fn bit_is_clear(&self) -> bool {
58 !self.bit()
59 }
60 #[doc = r" Returns `true` if the bit is set (1)"]
61 #[inline]
62 pub fn bit_is_set(&self) -> bool {
63 self.bit()
64 }
65}
66#[doc = r" Value of the field"]
67pub struct FSPOLR {
68 bits: bool,
69}
70impl FSPOLR {
71 #[doc = r" Value of the field as raw bits"]
72 #[inline]
73 pub fn bit(&self) -> bool {
74 self.bits
75 }
76 #[doc = r" Returns `true` if the bit is clear (0)"]
77 #[inline]
78 pub fn bit_is_clear(&self) -> bool {
79 !self.bit()
80 }
81 #[doc = r" Returns `true` if the bit is set (1)"]
82 #[inline]
83 pub fn bit_is_set(&self) -> bool {
84 self.bit()
85 }
86}
87#[doc = r" Value of the field"]
88pub struct FSDEFR {
89 bits: bool,
90}
91impl FSDEFR {
92 #[doc = r" Value of the field as raw bits"]
93 #[inline]
94 pub fn bit(&self) -> bool {
95 self.bits
96 }
97 #[doc = r" Returns `true` if the bit is clear (0)"]
98 #[inline]
99 pub fn bit_is_clear(&self) -> bool {
100 !self.bit()
101 }
102 #[doc = r" Returns `true` if the bit is set (1)"]
103 #[inline]
104 pub fn bit_is_set(&self) -> bool {
105 self.bit()
106 }
107}
108#[doc = r" Value of the field"]
109pub struct FSALLR {
110 bits: u8,
111}
112impl FSALLR {
113 #[doc = r" Value of the field as raw bits"]
114 #[inline]
115 pub fn bits(&self) -> u8 {
116 self.bits
117 }
118}
119#[doc = r" Value of the field"]
120pub struct FRLR {
121 bits: u8,
122}
123impl FRLR {
124 #[doc = r" Value of the field as raw bits"]
125 #[inline]
126 pub fn bits(&self) -> u8 {
127 self.bits
128 }
129}
130#[doc = r" Proxy"]
131pub struct _FSOFFW<'a> {
132 w: &'a mut W,
133}
134impl<'a> _FSOFFW<'a> {
135 #[doc = r" Sets the field bit"]
136 pub fn set_bit(self) -> &'a mut W {
137 self.bit(true)
138 }
139 #[doc = r" Clears the field bit"]
140 pub fn clear_bit(self) -> &'a mut W {
141 self.bit(false)
142 }
143 #[doc = r" Writes raw bits to the field"]
144 #[inline]
145 pub fn bit(self, value: bool) -> &'a mut W {
146 const MASK: bool = true;
147 const OFFSET: u8 = 18;
148 self.w.bits &= !((MASK as u32) << OFFSET);
149 self.w.bits |= ((value & MASK) as u32) << OFFSET;
150 self.w
151 }
152}
153#[doc = r" Proxy"]
154pub struct _FSPOLW<'a> {
155 w: &'a mut W,
156}
157impl<'a> _FSPOLW<'a> {
158 #[doc = r" Sets the field bit"]
159 pub fn set_bit(self) -> &'a mut W {
160 self.bit(true)
161 }
162 #[doc = r" Clears the field bit"]
163 pub fn clear_bit(self) -> &'a mut W {
164 self.bit(false)
165 }
166 #[doc = r" Writes raw bits to the field"]
167 #[inline]
168 pub fn bit(self, value: bool) -> &'a mut W {
169 const MASK: bool = true;
170 const OFFSET: u8 = 17;
171 self.w.bits &= !((MASK as u32) << OFFSET);
172 self.w.bits |= ((value & MASK) as u32) << OFFSET;
173 self.w
174 }
175}
176#[doc = r" Proxy"]
177pub struct _FSDEFW<'a> {
178 w: &'a mut W,
179}
180impl<'a> _FSDEFW<'a> {
181 #[doc = r" Sets the field bit"]
182 pub fn set_bit(self) -> &'a mut W {
183 self.bit(true)
184 }
185 #[doc = r" Clears the field bit"]
186 pub fn clear_bit(self) -> &'a mut W {
187 self.bit(false)
188 }
189 #[doc = r" Writes raw bits to the field"]
190 #[inline]
191 pub fn bit(self, value: bool) -> &'a mut W {
192 const MASK: bool = true;
193 const OFFSET: u8 = 16;
194 self.w.bits &= !((MASK as u32) << OFFSET);
195 self.w.bits |= ((value & MASK) as u32) << OFFSET;
196 self.w
197 }
198}
199#[doc = r" Proxy"]
200pub struct _FSALLW<'a> {
201 w: &'a mut W,
202}
203impl<'a> _FSALLW<'a> {
204 #[doc = r" Writes raw bits to the field"]
205 #[inline]
206 pub unsafe fn bits(self, value: u8) -> &'a mut W {
207 const MASK: u8 = 127;
208 const OFFSET: u8 = 8;
209 self.w.bits &= !((MASK as u32) << OFFSET);
210 self.w.bits |= ((value & MASK) as u32) << OFFSET;
211 self.w
212 }
213}
214#[doc = r" Proxy"]
215pub struct _FRLW<'a> {
216 w: &'a mut W,
217}
218impl<'a> _FRLW<'a> {
219 #[doc = r" Writes raw bits to the field"]
220 #[inline]
221 pub unsafe fn bits(self, value: u8) -> &'a mut W {
222 const MASK: u8 = 255;
223 const OFFSET: u8 = 0;
224 self.w.bits &= !((MASK as u32) << OFFSET);
225 self.w.bits |= ((value & MASK) as u32) << OFFSET;
226 self.w
227 }
228}
229impl R {
230 #[doc = r" Value of the register as raw bits"]
231 #[inline]
232 pub fn bits(&self) -> u32 {
233 self.bits
234 }
235 #[doc = "Bit 18 - Frame synchronization offset"]
236 #[inline]
237 pub fn fsoff(&self) -> FSOFFR {
238 let bits = {
239 const MASK: bool = true;
240 const OFFSET: u8 = 18;
241 ((self.bits >> OFFSET) & MASK as u32) != 0
242 };
243 FSOFFR { bits }
244 }
245 #[doc = "Bit 17 - Frame synchronization polarity"]
246 #[inline]
247 pub fn fspol(&self) -> FSPOLR {
248 let bits = {
249 const MASK: bool = true;
250 const OFFSET: u8 = 17;
251 ((self.bits >> OFFSET) & MASK as u32) != 0
252 };
253 FSPOLR { bits }
254 }
255 #[doc = "Bit 16 - Frame synchronization definition"]
256 #[inline]
257 pub fn fsdef(&self) -> FSDEFR {
258 let bits = {
259 const MASK: bool = true;
260 const OFFSET: u8 = 16;
261 ((self.bits >> OFFSET) & MASK as u32) != 0
262 };
263 FSDEFR { bits }
264 }
265 #[doc = "Bits 8:14 - Frame synchronization active level length"]
266 #[inline]
267 pub fn fsall(&self) -> FSALLR {
268 let bits = {
269 const MASK: u8 = 127;
270 const OFFSET: u8 = 8;
271 ((self.bits >> OFFSET) & MASK as u32) as u8
272 };
273 FSALLR { bits }
274 }
275 #[doc = "Bits 0:7 - Frame length"]
276 #[inline]
277 pub fn frl(&self) -> FRLR {
278 let bits = {
279 const MASK: u8 = 255;
280 const OFFSET: u8 = 0;
281 ((self.bits >> OFFSET) & MASK as u32) as u8
282 };
283 FRLR { bits }
284 }
285}
286impl W {
287 #[doc = r" Reset value of the register"]
288 #[inline]
289 pub fn reset_value() -> W {
290 W { bits: 7 }
291 }
292 #[doc = r" Writes raw bits to the register"]
293 #[inline]
294 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
295 self.bits = bits;
296 self
297 }
298 #[doc = "Bit 18 - Frame synchronization offset"]
299 #[inline]
300 pub fn fsoff(&mut self) -> _FSOFFW {
301 _FSOFFW { w: self }
302 }
303 #[doc = "Bit 17 - Frame synchronization polarity"]
304 #[inline]
305 pub fn fspol(&mut self) -> _FSPOLW {
306 _FSPOLW { w: self }
307 }
308 #[doc = "Bit 16 - Frame synchronization definition"]
309 #[inline]
310 pub fn fsdef(&mut self) -> _FSDEFW {
311 _FSDEFW { w: self }
312 }
313 #[doc = "Bits 8:14 - Frame synchronization active level length"]
314 #[inline]
315 pub fn fsall(&mut self) -> _FSALLW {
316 _FSALLW { w: self }
317 }
318 #[doc = "Bits 0:7 - Frame length"]
319 #[inline]
320 pub fn frl(&mut self) -> _FRLW {
321 _FRLW { w: self }
322 }
323}