stm32wb_pac/tim1/
cr2.rs

1#[doc = "Reader of register CR2"]
2pub type R = crate::R<u32, super::CR2>;
3#[doc = "Writer for register CR2"]
4pub type W = crate::W<u32, super::CR2>;
5#[doc = "Register CR2 `reset()`'s with value 0"]
6impl crate::ResetValue for super::CR2 {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `MMS2`"]
14pub type MMS2_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `MMS2`"]
16pub struct MMS2_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> MMS2_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 & !(0x0f << 20)) | (((value as u32) & 0x0f) << 20);
24        self.w
25    }
26}
27#[doc = "Reader of field `OIS6`"]
28pub type OIS6_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `OIS6`"]
30pub struct OIS6_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> OIS6_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 << 18)) | (((value as u32) & 0x01) << 18);
48        self.w
49    }
50}
51#[doc = "Reader of field `OIS5`"]
52pub type OIS5_R = crate::R<bool, bool>;
53#[doc = "Write proxy for field `OIS5`"]
54pub struct OIS5_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> OIS5_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 << 16)) | (((value as u32) & 0x01) << 16);
72        self.w
73    }
74}
75#[doc = "Reader of field `OIS4`"]
76pub type OIS4_R = crate::R<bool, bool>;
77#[doc = "Write proxy for field `OIS4`"]
78pub struct OIS4_W<'a> {
79    w: &'a mut W,
80}
81impl<'a> OIS4_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 << 14)) | (((value as u32) & 0x01) << 14);
96        self.w
97    }
98}
99#[doc = "Reader of field `OIS3N`"]
100pub type OIS3N_R = crate::R<bool, bool>;
101#[doc = "Write proxy for field `OIS3N`"]
102pub struct OIS3N_W<'a> {
103    w: &'a mut W,
104}
105impl<'a> OIS3N_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 << 13)) | (((value as u32) & 0x01) << 13);
120        self.w
121    }
122}
123#[doc = "Reader of field `OIS3`"]
124pub type OIS3_R = crate::R<bool, bool>;
125#[doc = "Write proxy for field `OIS3`"]
126pub struct OIS3_W<'a> {
127    w: &'a mut W,
128}
129impl<'a> OIS3_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 << 12)) | (((value as u32) & 0x01) << 12);
144        self.w
145    }
146}
147#[doc = "Reader of field `OIS2N`"]
148pub type OIS2N_R = crate::R<bool, bool>;
149#[doc = "Write proxy for field `OIS2N`"]
150pub struct OIS2N_W<'a> {
151    w: &'a mut W,
152}
153impl<'a> OIS2N_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 << 11)) | (((value as u32) & 0x01) << 11);
168        self.w
169    }
170}
171#[doc = "Reader of field `OIS2`"]
172pub type OIS2_R = crate::R<bool, bool>;
173#[doc = "Write proxy for field `OIS2`"]
174pub struct OIS2_W<'a> {
175    w: &'a mut W,
176}
177impl<'a> OIS2_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 << 10)) | (((value as u32) & 0x01) << 10);
192        self.w
193    }
194}
195#[doc = "Reader of field `OIS1N`"]
196pub type OIS1N_R = crate::R<bool, bool>;
197#[doc = "Write proxy for field `OIS1N`"]
198pub struct OIS1N_W<'a> {
199    w: &'a mut W,
200}
201impl<'a> OIS1N_W<'a> {
202    #[doc = r"Sets the field bit"]
203    #[inline(always)]
204    pub fn set_bit(self) -> &'a mut W {
205        self.bit(true)
206    }
207    #[doc = r"Clears the field bit"]
208    #[inline(always)]
209    pub fn clear_bit(self) -> &'a mut W {
210        self.bit(false)
211    }
212    #[doc = r"Writes raw bits to the field"]
213    #[inline(always)]
214    pub fn bit(self, value: bool) -> &'a mut W {
215        self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
216        self.w
217    }
218}
219#[doc = "Reader of field `OIS1`"]
220pub type OIS1_R = crate::R<bool, bool>;
221#[doc = "Write proxy for field `OIS1`"]
222pub struct OIS1_W<'a> {
223    w: &'a mut W,
224}
225impl<'a> OIS1_W<'a> {
226    #[doc = r"Sets the field bit"]
227    #[inline(always)]
228    pub fn set_bit(self) -> &'a mut W {
229        self.bit(true)
230    }
231    #[doc = r"Clears the field bit"]
232    #[inline(always)]
233    pub fn clear_bit(self) -> &'a mut W {
234        self.bit(false)
235    }
236    #[doc = r"Writes raw bits to the field"]
237    #[inline(always)]
238    pub fn bit(self, value: bool) -> &'a mut W {
239        self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
240        self.w
241    }
242}
243#[doc = "Reader of field `TI1S`"]
244pub type TI1S_R = crate::R<bool, bool>;
245#[doc = "Write proxy for field `TI1S`"]
246pub struct TI1S_W<'a> {
247    w: &'a mut W,
248}
249impl<'a> TI1S_W<'a> {
250    #[doc = r"Sets the field bit"]
251    #[inline(always)]
252    pub fn set_bit(self) -> &'a mut W {
253        self.bit(true)
254    }
255    #[doc = r"Clears the field bit"]
256    #[inline(always)]
257    pub fn clear_bit(self) -> &'a mut W {
258        self.bit(false)
259    }
260    #[doc = r"Writes raw bits to the field"]
261    #[inline(always)]
262    pub fn bit(self, value: bool) -> &'a mut W {
263        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
264        self.w
265    }
266}
267#[doc = "Reader of field `MMS`"]
268pub type MMS_R = crate::R<u8, u8>;
269#[doc = "Write proxy for field `MMS`"]
270pub struct MMS_W<'a> {
271    w: &'a mut W,
272}
273impl<'a> MMS_W<'a> {
274    #[doc = r"Writes raw bits to the field"]
275    #[inline(always)]
276    pub unsafe fn bits(self, value: u8) -> &'a mut W {
277        self.w.bits = (self.w.bits & !(0x07 << 4)) | (((value as u32) & 0x07) << 4);
278        self.w
279    }
280}
281#[doc = "Reader of field `CCDS`"]
282pub type CCDS_R = crate::R<bool, bool>;
283#[doc = "Write proxy for field `CCDS`"]
284pub struct CCDS_W<'a> {
285    w: &'a mut W,
286}
287impl<'a> CCDS_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 << 3)) | (((value as u32) & 0x01) << 3);
302        self.w
303    }
304}
305#[doc = "Reader of field `CCUS`"]
306pub type CCUS_R = crate::R<bool, bool>;
307#[doc = "Write proxy for field `CCUS`"]
308pub struct CCUS_W<'a> {
309    w: &'a mut W,
310}
311impl<'a> CCUS_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 << 2)) | (((value as u32) & 0x01) << 2);
326        self.w
327    }
328}
329#[doc = "Reader of field `CCPC`"]
330pub type CCPC_R = crate::R<bool, bool>;
331#[doc = "Write proxy for field `CCPC`"]
332pub struct CCPC_W<'a> {
333    w: &'a mut W,
334}
335impl<'a> CCPC_W<'a> {
336    #[doc = r"Sets the field bit"]
337    #[inline(always)]
338    pub fn set_bit(self) -> &'a mut W {
339        self.bit(true)
340    }
341    #[doc = r"Clears the field bit"]
342    #[inline(always)]
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(always)]
348    pub fn bit(self, value: bool) -> &'a mut W {
349        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
350        self.w
351    }
352}
353impl R {
354    #[doc = "Bits 20:23 - Master mode selection 2"]
355    #[inline(always)]
356    pub fn mms2(&self) -> MMS2_R {
357        MMS2_R::new(((self.bits >> 20) & 0x0f) as u8)
358    }
359    #[doc = "Bit 18 - Output Idle state 6 (OC6 output)"]
360    #[inline(always)]
361    pub fn ois6(&self) -> OIS6_R {
362        OIS6_R::new(((self.bits >> 18) & 0x01) != 0)
363    }
364    #[doc = "Bit 16 - Output Idle state 5 (OC5 output)"]
365    #[inline(always)]
366    pub fn ois5(&self) -> OIS5_R {
367        OIS5_R::new(((self.bits >> 16) & 0x01) != 0)
368    }
369    #[doc = "Bit 14 - Output Idle state 4"]
370    #[inline(always)]
371    pub fn ois4(&self) -> OIS4_R {
372        OIS4_R::new(((self.bits >> 14) & 0x01) != 0)
373    }
374    #[doc = "Bit 13 - Output Idle state 3"]
375    #[inline(always)]
376    pub fn ois3n(&self) -> OIS3N_R {
377        OIS3N_R::new(((self.bits >> 13) & 0x01) != 0)
378    }
379    #[doc = "Bit 12 - Output Idle state 3"]
380    #[inline(always)]
381    pub fn ois3(&self) -> OIS3_R {
382        OIS3_R::new(((self.bits >> 12) & 0x01) != 0)
383    }
384    #[doc = "Bit 11 - Output Idle state 2"]
385    #[inline(always)]
386    pub fn ois2n(&self) -> OIS2N_R {
387        OIS2N_R::new(((self.bits >> 11) & 0x01) != 0)
388    }
389    #[doc = "Bit 10 - Output Idle state 2"]
390    #[inline(always)]
391    pub fn ois2(&self) -> OIS2_R {
392        OIS2_R::new(((self.bits >> 10) & 0x01) != 0)
393    }
394    #[doc = "Bit 9 - Output Idle state 1"]
395    #[inline(always)]
396    pub fn ois1n(&self) -> OIS1N_R {
397        OIS1N_R::new(((self.bits >> 9) & 0x01) != 0)
398    }
399    #[doc = "Bit 8 - Output Idle state 1"]
400    #[inline(always)]
401    pub fn ois1(&self) -> OIS1_R {
402        OIS1_R::new(((self.bits >> 8) & 0x01) != 0)
403    }
404    #[doc = "Bit 7 - TI1 selection"]
405    #[inline(always)]
406    pub fn ti1s(&self) -> TI1S_R {
407        TI1S_R::new(((self.bits >> 7) & 0x01) != 0)
408    }
409    #[doc = "Bits 4:6 - Master mode selection"]
410    #[inline(always)]
411    pub fn mms(&self) -> MMS_R {
412        MMS_R::new(((self.bits >> 4) & 0x07) as u8)
413    }
414    #[doc = "Bit 3 - Capture/compare DMA selection"]
415    #[inline(always)]
416    pub fn ccds(&self) -> CCDS_R {
417        CCDS_R::new(((self.bits >> 3) & 0x01) != 0)
418    }
419    #[doc = "Bit 2 - Capture/compare control update selection"]
420    #[inline(always)]
421    pub fn ccus(&self) -> CCUS_R {
422        CCUS_R::new(((self.bits >> 2) & 0x01) != 0)
423    }
424    #[doc = "Bit 0 - Capture/compare preloaded control"]
425    #[inline(always)]
426    pub fn ccpc(&self) -> CCPC_R {
427        CCPC_R::new((self.bits & 0x01) != 0)
428    }
429}
430impl W {
431    #[doc = "Bits 20:23 - Master mode selection 2"]
432    #[inline(always)]
433    pub fn mms2(&mut self) -> MMS2_W {
434        MMS2_W { w: self }
435    }
436    #[doc = "Bit 18 - Output Idle state 6 (OC6 output)"]
437    #[inline(always)]
438    pub fn ois6(&mut self) -> OIS6_W {
439        OIS6_W { w: self }
440    }
441    #[doc = "Bit 16 - Output Idle state 5 (OC5 output)"]
442    #[inline(always)]
443    pub fn ois5(&mut self) -> OIS5_W {
444        OIS5_W { w: self }
445    }
446    #[doc = "Bit 14 - Output Idle state 4"]
447    #[inline(always)]
448    pub fn ois4(&mut self) -> OIS4_W {
449        OIS4_W { w: self }
450    }
451    #[doc = "Bit 13 - Output Idle state 3"]
452    #[inline(always)]
453    pub fn ois3n(&mut self) -> OIS3N_W {
454        OIS3N_W { w: self }
455    }
456    #[doc = "Bit 12 - Output Idle state 3"]
457    #[inline(always)]
458    pub fn ois3(&mut self) -> OIS3_W {
459        OIS3_W { w: self }
460    }
461    #[doc = "Bit 11 - Output Idle state 2"]
462    #[inline(always)]
463    pub fn ois2n(&mut self) -> OIS2N_W {
464        OIS2N_W { w: self }
465    }
466    #[doc = "Bit 10 - Output Idle state 2"]
467    #[inline(always)]
468    pub fn ois2(&mut self) -> OIS2_W {
469        OIS2_W { w: self }
470    }
471    #[doc = "Bit 9 - Output Idle state 1"]
472    #[inline(always)]
473    pub fn ois1n(&mut self) -> OIS1N_W {
474        OIS1N_W { w: self }
475    }
476    #[doc = "Bit 8 - Output Idle state 1"]
477    #[inline(always)]
478    pub fn ois1(&mut self) -> OIS1_W {
479        OIS1_W { w: self }
480    }
481    #[doc = "Bit 7 - TI1 selection"]
482    #[inline(always)]
483    pub fn ti1s(&mut self) -> TI1S_W {
484        TI1S_W { w: self }
485    }
486    #[doc = "Bits 4:6 - Master mode selection"]
487    #[inline(always)]
488    pub fn mms(&mut self) -> MMS_W {
489        MMS_W { w: self }
490    }
491    #[doc = "Bit 3 - Capture/compare DMA selection"]
492    #[inline(always)]
493    pub fn ccds(&mut self) -> CCDS_W {
494        CCDS_W { w: self }
495    }
496    #[doc = "Bit 2 - Capture/compare control update selection"]
497    #[inline(always)]
498    pub fn ccus(&mut self) -> CCUS_W {
499        CCUS_W { w: self }
500    }
501    #[doc = "Bit 0 - Capture/compare preloaded control"]
502    #[inline(always)]
503    pub fn ccpc(&mut self) -> CCPC_W {
504        CCPC_W { w: self }
505    }
506}