stm32wb_pac/quadspi/
cr.rs

1#[doc = "Reader of register CR"]
2pub type R = crate::R<u32, super::CR>;
3#[doc = "Writer for register CR"]
4pub type W = crate::W<u32, super::CR>;
5#[doc = "Register CR `reset()`'s with value 0"]
6impl crate::ResetValue for super::CR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `PRESCALER`"]
14pub type PRESCALER_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `PRESCALER`"]
16pub struct PRESCALER_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> PRESCALER_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u8) -> &'a mut W {
23        self.w.bits = (self.w.bits & !(0xff << 24)) | (((value as u32) & 0xff) << 24);
24        self.w
25    }
26}
27#[doc = "Reader of field `PMM`"]
28pub type PMM_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `PMM`"]
30pub struct PMM_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> PMM_W<'a> {
34    #[doc = r"Sets the field bit"]
35    #[inline(always)]
36    pub fn set_bit(self) -> &'a mut W {
37        self.bit(true)
38    }
39    #[doc = r"Clears the field bit"]
40    #[inline(always)]
41    pub fn clear_bit(self) -> &'a mut W {
42        self.bit(false)
43    }
44    #[doc = r"Writes raw bits to the field"]
45    #[inline(always)]
46    pub fn bit(self, value: bool) -> &'a mut W {
47        self.w.bits = (self.w.bits & !(0x01 << 23)) | (((value as u32) & 0x01) << 23);
48        self.w
49    }
50}
51#[doc = "Reader of field `APMS`"]
52pub type APMS_R = crate::R<bool, bool>;
53#[doc = "Write proxy for field `APMS`"]
54pub struct APMS_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> APMS_W<'a> {
58    #[doc = r"Sets the field bit"]
59    #[inline(always)]
60    pub fn set_bit(self) -> &'a mut W {
61        self.bit(true)
62    }
63    #[doc = r"Clears the field bit"]
64    #[inline(always)]
65    pub fn clear_bit(self) -> &'a mut W {
66        self.bit(false)
67    }
68    #[doc = r"Writes raw bits to the field"]
69    #[inline(always)]
70    pub fn bit(self, value: bool) -> &'a mut W {
71        self.w.bits = (self.w.bits & !(0x01 << 22)) | (((value as u32) & 0x01) << 22);
72        self.w
73    }
74}
75#[doc = "Reader of field `TOIE`"]
76pub type TOIE_R = crate::R<bool, bool>;
77#[doc = "Write proxy for field `TOIE`"]
78pub struct TOIE_W<'a> {
79    w: &'a mut W,
80}
81impl<'a> TOIE_W<'a> {
82    #[doc = r"Sets the field bit"]
83    #[inline(always)]
84    pub fn set_bit(self) -> &'a mut W {
85        self.bit(true)
86    }
87    #[doc = r"Clears the field bit"]
88    #[inline(always)]
89    pub fn clear_bit(self) -> &'a mut W {
90        self.bit(false)
91    }
92    #[doc = r"Writes raw bits to the field"]
93    #[inline(always)]
94    pub fn bit(self, value: bool) -> &'a mut W {
95        self.w.bits = (self.w.bits & !(0x01 << 20)) | (((value as u32) & 0x01) << 20);
96        self.w
97    }
98}
99#[doc = "Reader of field `SMIE`"]
100pub type SMIE_R = crate::R<bool, bool>;
101#[doc = "Write proxy for field `SMIE`"]
102pub struct SMIE_W<'a> {
103    w: &'a mut W,
104}
105impl<'a> SMIE_W<'a> {
106    #[doc = r"Sets the field bit"]
107    #[inline(always)]
108    pub fn set_bit(self) -> &'a mut W {
109        self.bit(true)
110    }
111    #[doc = r"Clears the field bit"]
112    #[inline(always)]
113    pub fn clear_bit(self) -> &'a mut W {
114        self.bit(false)
115    }
116    #[doc = r"Writes raw bits to the field"]
117    #[inline(always)]
118    pub fn bit(self, value: bool) -> &'a mut W {
119        self.w.bits = (self.w.bits & !(0x01 << 19)) | (((value as u32) & 0x01) << 19);
120        self.w
121    }
122}
123#[doc = "Reader of field `FTIE`"]
124pub type FTIE_R = crate::R<bool, bool>;
125#[doc = "Write proxy for field `FTIE`"]
126pub struct FTIE_W<'a> {
127    w: &'a mut W,
128}
129impl<'a> FTIE_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 << 18)) | (((value as u32) & 0x01) << 18);
144        self.w
145    }
146}
147#[doc = "Reader of field `TCIE`"]
148pub type TCIE_R = crate::R<bool, bool>;
149#[doc = "Write proxy for field `TCIE`"]
150pub struct TCIE_W<'a> {
151    w: &'a mut W,
152}
153impl<'a> TCIE_W<'a> {
154    #[doc = r"Sets the field bit"]
155    #[inline(always)]
156    pub fn set_bit(self) -> &'a mut W {
157        self.bit(true)
158    }
159    #[doc = r"Clears the field bit"]
160    #[inline(always)]
161    pub fn clear_bit(self) -> &'a mut W {
162        self.bit(false)
163    }
164    #[doc = r"Writes raw bits to the field"]
165    #[inline(always)]
166    pub fn bit(self, value: bool) -> &'a mut W {
167        self.w.bits = (self.w.bits & !(0x01 << 17)) | (((value as u32) & 0x01) << 17);
168        self.w
169    }
170}
171#[doc = "Reader of field `TEIE`"]
172pub type TEIE_R = crate::R<bool, bool>;
173#[doc = "Write proxy for field `TEIE`"]
174pub struct TEIE_W<'a> {
175    w: &'a mut W,
176}
177impl<'a> TEIE_W<'a> {
178    #[doc = r"Sets the field bit"]
179    #[inline(always)]
180    pub fn set_bit(self) -> &'a mut W {
181        self.bit(true)
182    }
183    #[doc = r"Clears the field bit"]
184    #[inline(always)]
185    pub fn clear_bit(self) -> &'a mut W {
186        self.bit(false)
187    }
188    #[doc = r"Writes raw bits to the field"]
189    #[inline(always)]
190    pub fn bit(self, value: bool) -> &'a mut W {
191        self.w.bits = (self.w.bits & !(0x01 << 16)) | (((value as u32) & 0x01) << 16);
192        self.w
193    }
194}
195#[doc = "Reader of field `FTHRES`"]
196pub type FTHRES_R = crate::R<u8, u8>;
197#[doc = "Write proxy for field `FTHRES`"]
198pub struct FTHRES_W<'a> {
199    w: &'a mut W,
200}
201impl<'a> FTHRES_W<'a> {
202    #[doc = r"Writes raw bits to the field"]
203    #[inline(always)]
204    pub unsafe fn bits(self, value: u8) -> &'a mut W {
205        self.w.bits = (self.w.bits & !(0x0f << 8)) | (((value as u32) & 0x0f) << 8);
206        self.w
207    }
208}
209#[doc = "Reader of field `SSHIFT`"]
210pub type SSHIFT_R = crate::R<bool, bool>;
211#[doc = "Write proxy for field `SSHIFT`"]
212pub struct SSHIFT_W<'a> {
213    w: &'a mut W,
214}
215impl<'a> SSHIFT_W<'a> {
216    #[doc = r"Sets the field bit"]
217    #[inline(always)]
218    pub fn set_bit(self) -> &'a mut W {
219        self.bit(true)
220    }
221    #[doc = r"Clears the field bit"]
222    #[inline(always)]
223    pub fn clear_bit(self) -> &'a mut W {
224        self.bit(false)
225    }
226    #[doc = r"Writes raw bits to the field"]
227    #[inline(always)]
228    pub fn bit(self, value: bool) -> &'a mut W {
229        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
230        self.w
231    }
232}
233#[doc = "Reader of field `TCEN`"]
234pub type TCEN_R = crate::R<bool, bool>;
235#[doc = "Write proxy for field `TCEN`"]
236pub struct TCEN_W<'a> {
237    w: &'a mut W,
238}
239impl<'a> TCEN_W<'a> {
240    #[doc = r"Sets the field bit"]
241    #[inline(always)]
242    pub fn set_bit(self) -> &'a mut W {
243        self.bit(true)
244    }
245    #[doc = r"Clears the field bit"]
246    #[inline(always)]
247    pub fn clear_bit(self) -> &'a mut W {
248        self.bit(false)
249    }
250    #[doc = r"Writes raw bits to the field"]
251    #[inline(always)]
252    pub fn bit(self, value: bool) -> &'a mut W {
253        self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
254        self.w
255    }
256}
257#[doc = "Reader of field `DMAEN`"]
258pub type DMAEN_R = crate::R<bool, bool>;
259#[doc = "Write proxy for field `DMAEN`"]
260pub struct DMAEN_W<'a> {
261    w: &'a mut W,
262}
263impl<'a> DMAEN_W<'a> {
264    #[doc = r"Sets the field bit"]
265    #[inline(always)]
266    pub fn set_bit(self) -> &'a mut W {
267        self.bit(true)
268    }
269    #[doc = r"Clears the field bit"]
270    #[inline(always)]
271    pub fn clear_bit(self) -> &'a mut W {
272        self.bit(false)
273    }
274    #[doc = r"Writes raw bits to the field"]
275    #[inline(always)]
276    pub fn bit(self, value: bool) -> &'a mut W {
277        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
278        self.w
279    }
280}
281#[doc = "Reader of field `ABORT`"]
282pub type ABORT_R = crate::R<bool, bool>;
283#[doc = "Write proxy for field `ABORT`"]
284pub struct ABORT_W<'a> {
285    w: &'a mut W,
286}
287impl<'a> ABORT_W<'a> {
288    #[doc = r"Sets the field bit"]
289    #[inline(always)]
290    pub fn set_bit(self) -> &'a mut W {
291        self.bit(true)
292    }
293    #[doc = r"Clears the field bit"]
294    #[inline(always)]
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(always)]
300    pub fn bit(self, value: bool) -> &'a mut W {
301        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
302        self.w
303    }
304}
305#[doc = "Reader of field `EN`"]
306pub type EN_R = crate::R<bool, bool>;
307#[doc = "Write proxy for field `EN`"]
308pub struct EN_W<'a> {
309    w: &'a mut W,
310}
311impl<'a> EN_W<'a> {
312    #[doc = r"Sets the field bit"]
313    #[inline(always)]
314    pub fn set_bit(self) -> &'a mut W {
315        self.bit(true)
316    }
317    #[doc = r"Clears the field bit"]
318    #[inline(always)]
319    pub fn clear_bit(self) -> &'a mut W {
320        self.bit(false)
321    }
322    #[doc = r"Writes raw bits to the field"]
323    #[inline(always)]
324    pub fn bit(self, value: bool) -> &'a mut W {
325        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
326        self.w
327    }
328}
329impl R {
330    #[doc = "Bits 24:31 - Clock prescaler"]
331    #[inline(always)]
332    pub fn prescaler(&self) -> PRESCALER_R {
333        PRESCALER_R::new(((self.bits >> 24) & 0xff) as u8)
334    }
335    #[doc = "Bit 23 - Polling match mode"]
336    #[inline(always)]
337    pub fn pmm(&self) -> PMM_R {
338        PMM_R::new(((self.bits >> 23) & 0x01) != 0)
339    }
340    #[doc = "Bit 22 - Automatic poll mode stop"]
341    #[inline(always)]
342    pub fn apms(&self) -> APMS_R {
343        APMS_R::new(((self.bits >> 22) & 0x01) != 0)
344    }
345    #[doc = "Bit 20 - TimeOut interrupt enable"]
346    #[inline(always)]
347    pub fn toie(&self) -> TOIE_R {
348        TOIE_R::new(((self.bits >> 20) & 0x01) != 0)
349    }
350    #[doc = "Bit 19 - Status match interrupt enable"]
351    #[inline(always)]
352    pub fn smie(&self) -> SMIE_R {
353        SMIE_R::new(((self.bits >> 19) & 0x01) != 0)
354    }
355    #[doc = "Bit 18 - FIFO threshold interrupt enable"]
356    #[inline(always)]
357    pub fn ftie(&self) -> FTIE_R {
358        FTIE_R::new(((self.bits >> 18) & 0x01) != 0)
359    }
360    #[doc = "Bit 17 - Transfer complete interrupt enable"]
361    #[inline(always)]
362    pub fn tcie(&self) -> TCIE_R {
363        TCIE_R::new(((self.bits >> 17) & 0x01) != 0)
364    }
365    #[doc = "Bit 16 - Transfer error interrupt enable"]
366    #[inline(always)]
367    pub fn teie(&self) -> TEIE_R {
368        TEIE_R::new(((self.bits >> 16) & 0x01) != 0)
369    }
370    #[doc = "Bits 8:11 - FIFO threshold level"]
371    #[inline(always)]
372    pub fn fthres(&self) -> FTHRES_R {
373        FTHRES_R::new(((self.bits >> 8) & 0x0f) as u8)
374    }
375    #[doc = "Bit 4 - Sample shift"]
376    #[inline(always)]
377    pub fn sshift(&self) -> SSHIFT_R {
378        SSHIFT_R::new(((self.bits >> 4) & 0x01) != 0)
379    }
380    #[doc = "Bit 3 - Timeout counter enable"]
381    #[inline(always)]
382    pub fn tcen(&self) -> TCEN_R {
383        TCEN_R::new(((self.bits >> 3) & 0x01) != 0)
384    }
385    #[doc = "Bit 2 - DMA enable"]
386    #[inline(always)]
387    pub fn dmaen(&self) -> DMAEN_R {
388        DMAEN_R::new(((self.bits >> 2) & 0x01) != 0)
389    }
390    #[doc = "Bit 1 - Abort request"]
391    #[inline(always)]
392    pub fn abort(&self) -> ABORT_R {
393        ABORT_R::new(((self.bits >> 1) & 0x01) != 0)
394    }
395    #[doc = "Bit 0 - Enable"]
396    #[inline(always)]
397    pub fn en(&self) -> EN_R {
398        EN_R::new((self.bits & 0x01) != 0)
399    }
400}
401impl W {
402    #[doc = "Bits 24:31 - Clock prescaler"]
403    #[inline(always)]
404    pub fn prescaler(&mut self) -> PRESCALER_W {
405        PRESCALER_W { w: self }
406    }
407    #[doc = "Bit 23 - Polling match mode"]
408    #[inline(always)]
409    pub fn pmm(&mut self) -> PMM_W {
410        PMM_W { w: self }
411    }
412    #[doc = "Bit 22 - Automatic poll mode stop"]
413    #[inline(always)]
414    pub fn apms(&mut self) -> APMS_W {
415        APMS_W { w: self }
416    }
417    #[doc = "Bit 20 - TimeOut interrupt enable"]
418    #[inline(always)]
419    pub fn toie(&mut self) -> TOIE_W {
420        TOIE_W { w: self }
421    }
422    #[doc = "Bit 19 - Status match interrupt enable"]
423    #[inline(always)]
424    pub fn smie(&mut self) -> SMIE_W {
425        SMIE_W { w: self }
426    }
427    #[doc = "Bit 18 - FIFO threshold interrupt enable"]
428    #[inline(always)]
429    pub fn ftie(&mut self) -> FTIE_W {
430        FTIE_W { w: self }
431    }
432    #[doc = "Bit 17 - Transfer complete interrupt enable"]
433    #[inline(always)]
434    pub fn tcie(&mut self) -> TCIE_W {
435        TCIE_W { w: self }
436    }
437    #[doc = "Bit 16 - Transfer error interrupt enable"]
438    #[inline(always)]
439    pub fn teie(&mut self) -> TEIE_W {
440        TEIE_W { w: self }
441    }
442    #[doc = "Bits 8:11 - FIFO threshold level"]
443    #[inline(always)]
444    pub fn fthres(&mut self) -> FTHRES_W {
445        FTHRES_W { w: self }
446    }
447    #[doc = "Bit 4 - Sample shift"]
448    #[inline(always)]
449    pub fn sshift(&mut self) -> SSHIFT_W {
450        SSHIFT_W { w: self }
451    }
452    #[doc = "Bit 3 - Timeout counter enable"]
453    #[inline(always)]
454    pub fn tcen(&mut self) -> TCEN_W {
455        TCEN_W { w: self }
456    }
457    #[doc = "Bit 2 - DMA enable"]
458    #[inline(always)]
459    pub fn dmaen(&mut self) -> DMAEN_W {
460        DMAEN_W { w: self }
461    }
462    #[doc = "Bit 1 - Abort request"]
463    #[inline(always)]
464    pub fn abort(&mut self) -> ABORT_W {
465        ABORT_W { w: self }
466    }
467    #[doc = "Bit 0 - Enable"]
468    #[inline(always)]
469    pub fn en(&mut self) -> EN_W {
470        EN_W { w: self }
471    }
472}