stm32wb_pac/tim2/
ccmr2_output.rs

1#[doc = "Reader of register CCMR2_Output"]
2pub type R = crate::R<u32, super::CCMR2_OUTPUT>;
3#[doc = "Writer for register CCMR2_Output"]
4pub type W = crate::W<u32, super::CCMR2_OUTPUT>;
5#[doc = "Register CCMR2_Output `reset()`'s with value 0"]
6impl crate::ResetValue for super::CCMR2_OUTPUT {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `OC4M_3`"]
14pub type OC4M_3_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `OC4M_3`"]
16pub struct OC4M_3_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> OC4M_3_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 << 24)) | (((value as u32) & 0x01) << 24);
34        self.w
35    }
36}
37#[doc = "Reader of field `OC3M_3`"]
38pub type OC3M_3_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `OC3M_3`"]
40pub struct OC3M_3_W<'a> {
41    w: &'a mut W,
42}
43impl<'a> OC3M_3_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 << 16)) | (((value as u32) & 0x01) << 16);
58        self.w
59    }
60}
61#[doc = "Reader of field `OC4CE`"]
62pub type OC4CE_R = crate::R<bool, bool>;
63#[doc = "Write proxy for field `OC4CE`"]
64pub struct OC4CE_W<'a> {
65    w: &'a mut W,
66}
67impl<'a> OC4CE_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 << 15)) | (((value as u32) & 0x01) << 15);
82        self.w
83    }
84}
85#[doc = "Reader of field `OC4M`"]
86pub type OC4M_R = crate::R<u8, u8>;
87#[doc = "Write proxy for field `OC4M`"]
88pub struct OC4M_W<'a> {
89    w: &'a mut W,
90}
91impl<'a> OC4M_W<'a> {
92    #[doc = r"Writes raw bits to the field"]
93    #[inline(always)]
94    pub unsafe fn bits(self, value: u8) -> &'a mut W {
95        self.w.bits = (self.w.bits & !(0x07 << 12)) | (((value as u32) & 0x07) << 12);
96        self.w
97    }
98}
99#[doc = "Reader of field `OC4PE`"]
100pub type OC4PE_R = crate::R<bool, bool>;
101#[doc = "Write proxy for field `OC4PE`"]
102pub struct OC4PE_W<'a> {
103    w: &'a mut W,
104}
105impl<'a> OC4PE_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 << 11)) | (((value as u32) & 0x01) << 11);
120        self.w
121    }
122}
123#[doc = "Reader of field `OC4FE`"]
124pub type OC4FE_R = crate::R<bool, bool>;
125#[doc = "Write proxy for field `OC4FE`"]
126pub struct OC4FE_W<'a> {
127    w: &'a mut W,
128}
129impl<'a> OC4FE_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 << 10)) | (((value as u32) & 0x01) << 10);
144        self.w
145    }
146}
147#[doc = "Reader of field `CC4S`"]
148pub type CC4S_R = crate::R<u8, u8>;
149#[doc = "Write proxy for field `CC4S`"]
150pub struct CC4S_W<'a> {
151    w: &'a mut W,
152}
153impl<'a> CC4S_W<'a> {
154    #[doc = r"Writes raw bits to the field"]
155    #[inline(always)]
156    pub unsafe fn bits(self, value: u8) -> &'a mut W {
157        self.w.bits = (self.w.bits & !(0x03 << 8)) | (((value as u32) & 0x03) << 8);
158        self.w
159    }
160}
161#[doc = "Reader of field `OC3CE`"]
162pub type OC3CE_R = crate::R<bool, bool>;
163#[doc = "Write proxy for field `OC3CE`"]
164pub struct OC3CE_W<'a> {
165    w: &'a mut W,
166}
167impl<'a> OC3CE_W<'a> {
168    #[doc = r"Sets the field bit"]
169    #[inline(always)]
170    pub fn set_bit(self) -> &'a mut W {
171        self.bit(true)
172    }
173    #[doc = r"Clears the field bit"]
174    #[inline(always)]
175    pub fn clear_bit(self) -> &'a mut W {
176        self.bit(false)
177    }
178    #[doc = r"Writes raw bits to the field"]
179    #[inline(always)]
180    pub fn bit(self, value: bool) -> &'a mut W {
181        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
182        self.w
183    }
184}
185#[doc = "Reader of field `OC3M`"]
186pub type OC3M_R = crate::R<u8, u8>;
187#[doc = "Write proxy for field `OC3M`"]
188pub struct OC3M_W<'a> {
189    w: &'a mut W,
190}
191impl<'a> OC3M_W<'a> {
192    #[doc = r"Writes raw bits to the field"]
193    #[inline(always)]
194    pub unsafe fn bits(self, value: u8) -> &'a mut W {
195        self.w.bits = (self.w.bits & !(0x07 << 4)) | (((value as u32) & 0x07) << 4);
196        self.w
197    }
198}
199#[doc = "Reader of field `OC3PE`"]
200pub type OC3PE_R = crate::R<bool, bool>;
201#[doc = "Write proxy for field `OC3PE`"]
202pub struct OC3PE_W<'a> {
203    w: &'a mut W,
204}
205impl<'a> OC3PE_W<'a> {
206    #[doc = r"Sets the field bit"]
207    #[inline(always)]
208    pub fn set_bit(self) -> &'a mut W {
209        self.bit(true)
210    }
211    #[doc = r"Clears the field bit"]
212    #[inline(always)]
213    pub fn clear_bit(self) -> &'a mut W {
214        self.bit(false)
215    }
216    #[doc = r"Writes raw bits to the field"]
217    #[inline(always)]
218    pub fn bit(self, value: bool) -> &'a mut W {
219        self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
220        self.w
221    }
222}
223#[doc = "Reader of field `OC3FE`"]
224pub type OC3FE_R = crate::R<bool, bool>;
225#[doc = "Write proxy for field `OC3FE`"]
226pub struct OC3FE_W<'a> {
227    w: &'a mut W,
228}
229impl<'a> OC3FE_W<'a> {
230    #[doc = r"Sets the field bit"]
231    #[inline(always)]
232    pub fn set_bit(self) -> &'a mut W {
233        self.bit(true)
234    }
235    #[doc = r"Clears the field bit"]
236    #[inline(always)]
237    pub fn clear_bit(self) -> &'a mut W {
238        self.bit(false)
239    }
240    #[doc = r"Writes raw bits to the field"]
241    #[inline(always)]
242    pub fn bit(self, value: bool) -> &'a mut W {
243        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
244        self.w
245    }
246}
247#[doc = "Reader of field `CC3S`"]
248pub type CC3S_R = crate::R<u8, u8>;
249#[doc = "Write proxy for field `CC3S`"]
250pub struct CC3S_W<'a> {
251    w: &'a mut W,
252}
253impl<'a> CC3S_W<'a> {
254    #[doc = r"Writes raw bits to the field"]
255    #[inline(always)]
256    pub unsafe fn bits(self, value: u8) -> &'a mut W {
257        self.w.bits = (self.w.bits & !0x03) | ((value as u32) & 0x03);
258        self.w
259    }
260}
261impl R {
262    #[doc = "Bit 24 - Output Compare 4 mode - bit 3"]
263    #[inline(always)]
264    pub fn oc4m_3(&self) -> OC4M_3_R {
265        OC4M_3_R::new(((self.bits >> 24) & 0x01) != 0)
266    }
267    #[doc = "Bit 16 - Output Compare 3 mode - bit 3"]
268    #[inline(always)]
269    pub fn oc3m_3(&self) -> OC3M_3_R {
270        OC3M_3_R::new(((self.bits >> 16) & 0x01) != 0)
271    }
272    #[doc = "Bit 15 - Output compare 4 clear enable"]
273    #[inline(always)]
274    pub fn oc4ce(&self) -> OC4CE_R {
275        OC4CE_R::new(((self.bits >> 15) & 0x01) != 0)
276    }
277    #[doc = "Bits 12:14 - Output compare 4 mode"]
278    #[inline(always)]
279    pub fn oc4m(&self) -> OC4M_R {
280        OC4M_R::new(((self.bits >> 12) & 0x07) as u8)
281    }
282    #[doc = "Bit 11 - Output compare 4 preload enable"]
283    #[inline(always)]
284    pub fn oc4pe(&self) -> OC4PE_R {
285        OC4PE_R::new(((self.bits >> 11) & 0x01) != 0)
286    }
287    #[doc = "Bit 10 - Output compare 4 fast enable"]
288    #[inline(always)]
289    pub fn oc4fe(&self) -> OC4FE_R {
290        OC4FE_R::new(((self.bits >> 10) & 0x01) != 0)
291    }
292    #[doc = "Bits 8:9 - Capture/Compare 4 selection"]
293    #[inline(always)]
294    pub fn cc4s(&self) -> CC4S_R {
295        CC4S_R::new(((self.bits >> 8) & 0x03) as u8)
296    }
297    #[doc = "Bit 7 - Output compare 3 clear enable"]
298    #[inline(always)]
299    pub fn oc3ce(&self) -> OC3CE_R {
300        OC3CE_R::new(((self.bits >> 7) & 0x01) != 0)
301    }
302    #[doc = "Bits 4:6 - Output compare 3 mode"]
303    #[inline(always)]
304    pub fn oc3m(&self) -> OC3M_R {
305        OC3M_R::new(((self.bits >> 4) & 0x07) as u8)
306    }
307    #[doc = "Bit 3 - Output compare 3 preload enable"]
308    #[inline(always)]
309    pub fn oc3pe(&self) -> OC3PE_R {
310        OC3PE_R::new(((self.bits >> 3) & 0x01) != 0)
311    }
312    #[doc = "Bit 2 - Output compare 3 fast enable"]
313    #[inline(always)]
314    pub fn oc3fe(&self) -> OC3FE_R {
315        OC3FE_R::new(((self.bits >> 2) & 0x01) != 0)
316    }
317    #[doc = "Bits 0:1 - Capture/Compare 3 selection"]
318    #[inline(always)]
319    pub fn cc3s(&self) -> CC3S_R {
320        CC3S_R::new((self.bits & 0x03) as u8)
321    }
322}
323impl W {
324    #[doc = "Bit 24 - Output Compare 4 mode - bit 3"]
325    #[inline(always)]
326    pub fn oc4m_3(&mut self) -> OC4M_3_W {
327        OC4M_3_W { w: self }
328    }
329    #[doc = "Bit 16 - Output Compare 3 mode - bit 3"]
330    #[inline(always)]
331    pub fn oc3m_3(&mut self) -> OC3M_3_W {
332        OC3M_3_W { w: self }
333    }
334    #[doc = "Bit 15 - Output compare 4 clear enable"]
335    #[inline(always)]
336    pub fn oc4ce(&mut self) -> OC4CE_W {
337        OC4CE_W { w: self }
338    }
339    #[doc = "Bits 12:14 - Output compare 4 mode"]
340    #[inline(always)]
341    pub fn oc4m(&mut self) -> OC4M_W {
342        OC4M_W { w: self }
343    }
344    #[doc = "Bit 11 - Output compare 4 preload enable"]
345    #[inline(always)]
346    pub fn oc4pe(&mut self) -> OC4PE_W {
347        OC4PE_W { w: self }
348    }
349    #[doc = "Bit 10 - Output compare 4 fast enable"]
350    #[inline(always)]
351    pub fn oc4fe(&mut self) -> OC4FE_W {
352        OC4FE_W { w: self }
353    }
354    #[doc = "Bits 8:9 - Capture/Compare 4 selection"]
355    #[inline(always)]
356    pub fn cc4s(&mut self) -> CC4S_W {
357        CC4S_W { w: self }
358    }
359    #[doc = "Bit 7 - Output compare 3 clear enable"]
360    #[inline(always)]
361    pub fn oc3ce(&mut self) -> OC3CE_W {
362        OC3CE_W { w: self }
363    }
364    #[doc = "Bits 4:6 - Output compare 3 mode"]
365    #[inline(always)]
366    pub fn oc3m(&mut self) -> OC3M_W {
367        OC3M_W { w: self }
368    }
369    #[doc = "Bit 3 - Output compare 3 preload enable"]
370    #[inline(always)]
371    pub fn oc3pe(&mut self) -> OC3PE_W {
372        OC3PE_W { w: self }
373    }
374    #[doc = "Bit 2 - Output compare 3 fast enable"]
375    #[inline(always)]
376    pub fn oc3fe(&mut self) -> OC3FE_W {
377        OC3FE_W { w: self }
378    }
379    #[doc = "Bits 0:1 - Capture/Compare 3 selection"]
380    #[inline(always)]
381    pub fn cc3s(&mut self) -> CC3S_W {
382        CC3S_W { w: self }
383    }
384}