stm32l4x2_pac/tim2/
ccmr1_output.rs

1#[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::CCMR1_OUTPUT {
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 OC2CER {
47    bits: bool,
48}
49impl OC2CER {
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 OC2MR {
68    bits: u8,
69}
70impl OC2MR {
71    #[doc = r" Value of the field as raw bits"]
72    #[inline]
73    pub fn bits(&self) -> u8 {
74        self.bits
75    }
76}
77#[doc = r" Value of the field"]
78pub struct OC2PER {
79    bits: bool,
80}
81impl OC2PER {
82    #[doc = r" Value of the field as raw bits"]
83    #[inline]
84    pub fn bit(&self) -> bool {
85        self.bits
86    }
87    #[doc = r" Returns `true` if the bit is clear (0)"]
88    #[inline]
89    pub fn bit_is_clear(&self) -> bool {
90        !self.bit()
91    }
92    #[doc = r" Returns `true` if the bit is set (1)"]
93    #[inline]
94    pub fn bit_is_set(&self) -> bool {
95        self.bit()
96    }
97}
98#[doc = r" Value of the field"]
99pub struct OC2FER {
100    bits: bool,
101}
102impl OC2FER {
103    #[doc = r" Value of the field as raw bits"]
104    #[inline]
105    pub fn bit(&self) -> bool {
106        self.bits
107    }
108    #[doc = r" Returns `true` if the bit is clear (0)"]
109    #[inline]
110    pub fn bit_is_clear(&self) -> bool {
111        !self.bit()
112    }
113    #[doc = r" Returns `true` if the bit is set (1)"]
114    #[inline]
115    pub fn bit_is_set(&self) -> bool {
116        self.bit()
117    }
118}
119#[doc = r" Value of the field"]
120pub struct CC2SR {
121    bits: u8,
122}
123impl CC2SR {
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" Value of the field"]
131pub struct OC1CER {
132    bits: bool,
133}
134impl OC1CER {
135    #[doc = r" Value of the field as raw bits"]
136    #[inline]
137    pub fn bit(&self) -> bool {
138        self.bits
139    }
140    #[doc = r" Returns `true` if the bit is clear (0)"]
141    #[inline]
142    pub fn bit_is_clear(&self) -> bool {
143        !self.bit()
144    }
145    #[doc = r" Returns `true` if the bit is set (1)"]
146    #[inline]
147    pub fn bit_is_set(&self) -> bool {
148        self.bit()
149    }
150}
151#[doc = r" Value of the field"]
152pub struct OC1MR {
153    bits: u8,
154}
155impl OC1MR {
156    #[doc = r" Value of the field as raw bits"]
157    #[inline]
158    pub fn bits(&self) -> u8 {
159        self.bits
160    }
161}
162#[doc = r" Value of the field"]
163pub struct OC1PER {
164    bits: bool,
165}
166impl OC1PER {
167    #[doc = r" Value of the field as raw bits"]
168    #[inline]
169    pub fn bit(&self) -> bool {
170        self.bits
171    }
172    #[doc = r" Returns `true` if the bit is clear (0)"]
173    #[inline]
174    pub fn bit_is_clear(&self) -> bool {
175        !self.bit()
176    }
177    #[doc = r" Returns `true` if the bit is set (1)"]
178    #[inline]
179    pub fn bit_is_set(&self) -> bool {
180        self.bit()
181    }
182}
183#[doc = r" Value of the field"]
184pub struct OC1FER {
185    bits: bool,
186}
187impl OC1FER {
188    #[doc = r" Value of the field as raw bits"]
189    #[inline]
190    pub fn bit(&self) -> bool {
191        self.bits
192    }
193    #[doc = r" Returns `true` if the bit is clear (0)"]
194    #[inline]
195    pub fn bit_is_clear(&self) -> bool {
196        !self.bit()
197    }
198    #[doc = r" Returns `true` if the bit is set (1)"]
199    #[inline]
200    pub fn bit_is_set(&self) -> bool {
201        self.bit()
202    }
203}
204#[doc = r" Value of the field"]
205pub struct CC1SR {
206    bits: u8,
207}
208impl CC1SR {
209    #[doc = r" Value of the field as raw bits"]
210    #[inline]
211    pub fn bits(&self) -> u8 {
212        self.bits
213    }
214}
215#[doc = r" Proxy"]
216pub struct _OC2CEW<'a> {
217    w: &'a mut W,
218}
219impl<'a> _OC2CEW<'a> {
220    #[doc = r" Sets the field bit"]
221    pub fn set_bit(self) -> &'a mut W {
222        self.bit(true)
223    }
224    #[doc = r" Clears the field bit"]
225    pub fn clear_bit(self) -> &'a mut W {
226        self.bit(false)
227    }
228    #[doc = r" Writes raw bits to the field"]
229    #[inline]
230    pub fn bit(self, value: bool) -> &'a mut W {
231        const MASK: bool = true;
232        const OFFSET: u8 = 15;
233        self.w.bits &= !((MASK as u32) << OFFSET);
234        self.w.bits |= ((value & MASK) as u32) << OFFSET;
235        self.w
236    }
237}
238#[doc = r" Proxy"]
239pub struct _OC2MW<'a> {
240    w: &'a mut W,
241}
242impl<'a> _OC2MW<'a> {
243    #[doc = r" Writes raw bits to the field"]
244    #[inline]
245    pub unsafe fn bits(self, value: u8) -> &'a mut W {
246        const MASK: u8 = 7;
247        const OFFSET: u8 = 12;
248        self.w.bits &= !((MASK as u32) << OFFSET);
249        self.w.bits |= ((value & MASK) as u32) << OFFSET;
250        self.w
251    }
252}
253#[doc = r" Proxy"]
254pub struct _OC2PEW<'a> {
255    w: &'a mut W,
256}
257impl<'a> _OC2PEW<'a> {
258    #[doc = r" Sets the field bit"]
259    pub fn set_bit(self) -> &'a mut W {
260        self.bit(true)
261    }
262    #[doc = r" Clears the field bit"]
263    pub fn clear_bit(self) -> &'a mut W {
264        self.bit(false)
265    }
266    #[doc = r" Writes raw bits to the field"]
267    #[inline]
268    pub fn bit(self, value: bool) -> &'a mut W {
269        const MASK: bool = true;
270        const OFFSET: u8 = 11;
271        self.w.bits &= !((MASK as u32) << OFFSET);
272        self.w.bits |= ((value & MASK) as u32) << OFFSET;
273        self.w
274    }
275}
276#[doc = r" Proxy"]
277pub struct _OC2FEW<'a> {
278    w: &'a mut W,
279}
280impl<'a> _OC2FEW<'a> {
281    #[doc = r" Sets the field bit"]
282    pub fn set_bit(self) -> &'a mut W {
283        self.bit(true)
284    }
285    #[doc = r" Clears the field bit"]
286    pub fn clear_bit(self) -> &'a mut W {
287        self.bit(false)
288    }
289    #[doc = r" Writes raw bits to the field"]
290    #[inline]
291    pub fn bit(self, value: bool) -> &'a mut W {
292        const MASK: bool = true;
293        const OFFSET: u8 = 10;
294        self.w.bits &= !((MASK as u32) << OFFSET);
295        self.w.bits |= ((value & MASK) as u32) << OFFSET;
296        self.w
297    }
298}
299#[doc = r" Proxy"]
300pub struct _CC2SW<'a> {
301    w: &'a mut W,
302}
303impl<'a> _CC2SW<'a> {
304    #[doc = r" Writes raw bits to the field"]
305    #[inline]
306    pub unsafe fn bits(self, value: u8) -> &'a mut W {
307        const MASK: u8 = 3;
308        const OFFSET: u8 = 8;
309        self.w.bits &= !((MASK as u32) << OFFSET);
310        self.w.bits |= ((value & MASK) as u32) << OFFSET;
311        self.w
312    }
313}
314#[doc = r" Proxy"]
315pub struct _OC1CEW<'a> {
316    w: &'a mut W,
317}
318impl<'a> _OC1CEW<'a> {
319    #[doc = r" Sets the field bit"]
320    pub fn set_bit(self) -> &'a mut W {
321        self.bit(true)
322    }
323    #[doc = r" Clears the field bit"]
324    pub fn clear_bit(self) -> &'a mut W {
325        self.bit(false)
326    }
327    #[doc = r" Writes raw bits to the field"]
328    #[inline]
329    pub fn bit(self, value: bool) -> &'a mut W {
330        const MASK: bool = true;
331        const OFFSET: u8 = 7;
332        self.w.bits &= !((MASK as u32) << OFFSET);
333        self.w.bits |= ((value & MASK) as u32) << OFFSET;
334        self.w
335    }
336}
337#[doc = r" Proxy"]
338pub struct _OC1MW<'a> {
339    w: &'a mut W,
340}
341impl<'a> _OC1MW<'a> {
342    #[doc = r" Writes raw bits to the field"]
343    #[inline]
344    pub unsafe fn bits(self, value: u8) -> &'a mut W {
345        const MASK: u8 = 7;
346        const OFFSET: u8 = 4;
347        self.w.bits &= !((MASK as u32) << OFFSET);
348        self.w.bits |= ((value & MASK) as u32) << OFFSET;
349        self.w
350    }
351}
352#[doc = r" Proxy"]
353pub struct _OC1PEW<'a> {
354    w: &'a mut W,
355}
356impl<'a> _OC1PEW<'a> {
357    #[doc = r" Sets the field bit"]
358    pub fn set_bit(self) -> &'a mut W {
359        self.bit(true)
360    }
361    #[doc = r" Clears the field bit"]
362    pub fn clear_bit(self) -> &'a mut W {
363        self.bit(false)
364    }
365    #[doc = r" Writes raw bits to the field"]
366    #[inline]
367    pub fn bit(self, value: bool) -> &'a mut W {
368        const MASK: bool = true;
369        const OFFSET: u8 = 3;
370        self.w.bits &= !((MASK as u32) << OFFSET);
371        self.w.bits |= ((value & MASK) as u32) << OFFSET;
372        self.w
373    }
374}
375#[doc = r" Proxy"]
376pub struct _OC1FEW<'a> {
377    w: &'a mut W,
378}
379impl<'a> _OC1FEW<'a> {
380    #[doc = r" Sets the field bit"]
381    pub fn set_bit(self) -> &'a mut W {
382        self.bit(true)
383    }
384    #[doc = r" Clears the field bit"]
385    pub fn clear_bit(self) -> &'a mut W {
386        self.bit(false)
387    }
388    #[doc = r" Writes raw bits to the field"]
389    #[inline]
390    pub fn bit(self, value: bool) -> &'a mut W {
391        const MASK: bool = true;
392        const OFFSET: u8 = 2;
393        self.w.bits &= !((MASK as u32) << OFFSET);
394        self.w.bits |= ((value & MASK) as u32) << OFFSET;
395        self.w
396    }
397}
398#[doc = r" Proxy"]
399pub struct _CC1SW<'a> {
400    w: &'a mut W,
401}
402impl<'a> _CC1SW<'a> {
403    #[doc = r" Writes raw bits to the field"]
404    #[inline]
405    pub unsafe fn bits(self, value: u8) -> &'a mut W {
406        const MASK: u8 = 3;
407        const OFFSET: u8 = 0;
408        self.w.bits &= !((MASK as u32) << OFFSET);
409        self.w.bits |= ((value & MASK) as u32) << OFFSET;
410        self.w
411    }
412}
413impl R {
414    #[doc = r" Value of the register as raw bits"]
415    #[inline]
416    pub fn bits(&self) -> u32 {
417        self.bits
418    }
419    #[doc = "Bit 15 - Output compare 2 clear enable"]
420    #[inline]
421    pub fn oc2ce(&self) -> OC2CER {
422        let bits = {
423            const MASK: bool = true;
424            const OFFSET: u8 = 15;
425            ((self.bits >> OFFSET) & MASK as u32) != 0
426        };
427        OC2CER { bits }
428    }
429    #[doc = "Bits 12:14 - Output compare 2 mode"]
430    #[inline]
431    pub fn oc2m(&self) -> OC2MR {
432        let bits = {
433            const MASK: u8 = 7;
434            const OFFSET: u8 = 12;
435            ((self.bits >> OFFSET) & MASK as u32) as u8
436        };
437        OC2MR { bits }
438    }
439    #[doc = "Bit 11 - Output compare 2 preload enable"]
440    #[inline]
441    pub fn oc2pe(&self) -> OC2PER {
442        let bits = {
443            const MASK: bool = true;
444            const OFFSET: u8 = 11;
445            ((self.bits >> OFFSET) & MASK as u32) != 0
446        };
447        OC2PER { bits }
448    }
449    #[doc = "Bit 10 - Output compare 2 fast enable"]
450    #[inline]
451    pub fn oc2fe(&self) -> OC2FER {
452        let bits = {
453            const MASK: bool = true;
454            const OFFSET: u8 = 10;
455            ((self.bits >> OFFSET) & MASK as u32) != 0
456        };
457        OC2FER { bits }
458    }
459    #[doc = "Bits 8:9 - Capture/Compare 2 selection"]
460    #[inline]
461    pub fn cc2s(&self) -> CC2SR {
462        let bits = {
463            const MASK: u8 = 3;
464            const OFFSET: u8 = 8;
465            ((self.bits >> OFFSET) & MASK as u32) as u8
466        };
467        CC2SR { bits }
468    }
469    #[doc = "Bit 7 - Output compare 1 clear enable"]
470    #[inline]
471    pub fn oc1ce(&self) -> OC1CER {
472        let bits = {
473            const MASK: bool = true;
474            const OFFSET: u8 = 7;
475            ((self.bits >> OFFSET) & MASK as u32) != 0
476        };
477        OC1CER { bits }
478    }
479    #[doc = "Bits 4:6 - Output compare 1 mode"]
480    #[inline]
481    pub fn oc1m(&self) -> OC1MR {
482        let bits = {
483            const MASK: u8 = 7;
484            const OFFSET: u8 = 4;
485            ((self.bits >> OFFSET) & MASK as u32) as u8
486        };
487        OC1MR { bits }
488    }
489    #[doc = "Bit 3 - Output compare 1 preload enable"]
490    #[inline]
491    pub fn oc1pe(&self) -> OC1PER {
492        let bits = {
493            const MASK: bool = true;
494            const OFFSET: u8 = 3;
495            ((self.bits >> OFFSET) & MASK as u32) != 0
496        };
497        OC1PER { bits }
498    }
499    #[doc = "Bit 2 - Output compare 1 fast enable"]
500    #[inline]
501    pub fn oc1fe(&self) -> OC1FER {
502        let bits = {
503            const MASK: bool = true;
504            const OFFSET: u8 = 2;
505            ((self.bits >> OFFSET) & MASK as u32) != 0
506        };
507        OC1FER { bits }
508    }
509    #[doc = "Bits 0:1 - Capture/Compare 1 selection"]
510    #[inline]
511    pub fn cc1s(&self) -> CC1SR {
512        let bits = {
513            const MASK: u8 = 3;
514            const OFFSET: u8 = 0;
515            ((self.bits >> OFFSET) & MASK as u32) as u8
516        };
517        CC1SR { bits }
518    }
519}
520impl W {
521    #[doc = r" Reset value of the register"]
522    #[inline]
523    pub fn reset_value() -> W {
524        W { bits: 0 }
525    }
526    #[doc = r" Writes raw bits to the register"]
527    #[inline]
528    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
529        self.bits = bits;
530        self
531    }
532    #[doc = "Bit 15 - Output compare 2 clear enable"]
533    #[inline]
534    pub fn oc2ce(&mut self) -> _OC2CEW {
535        _OC2CEW { w: self }
536    }
537    #[doc = "Bits 12:14 - Output compare 2 mode"]
538    #[inline]
539    pub fn oc2m(&mut self) -> _OC2MW {
540        _OC2MW { w: self }
541    }
542    #[doc = "Bit 11 - Output compare 2 preload enable"]
543    #[inline]
544    pub fn oc2pe(&mut self) -> _OC2PEW {
545        _OC2PEW { w: self }
546    }
547    #[doc = "Bit 10 - Output compare 2 fast enable"]
548    #[inline]
549    pub fn oc2fe(&mut self) -> _OC2FEW {
550        _OC2FEW { w: self }
551    }
552    #[doc = "Bits 8:9 - Capture/Compare 2 selection"]
553    #[inline]
554    pub fn cc2s(&mut self) -> _CC2SW {
555        _CC2SW { w: self }
556    }
557    #[doc = "Bit 7 - Output compare 1 clear enable"]
558    #[inline]
559    pub fn oc1ce(&mut self) -> _OC1CEW {
560        _OC1CEW { w: self }
561    }
562    #[doc = "Bits 4:6 - Output compare 1 mode"]
563    #[inline]
564    pub fn oc1m(&mut self) -> _OC1MW {
565        _OC1MW { w: self }
566    }
567    #[doc = "Bit 3 - Output compare 1 preload enable"]
568    #[inline]
569    pub fn oc1pe(&mut self) -> _OC1PEW {
570        _OC1PEW { w: self }
571    }
572    #[doc = "Bit 2 - Output compare 1 fast enable"]
573    #[inline]
574    pub fn oc1fe(&mut self) -> _OC1FEW {
575        _OC1FEW { w: self }
576    }
577    #[doc = "Bits 0:1 - Capture/Compare 1 selection"]
578    #[inline]
579    pub fn cc1s(&mut self) -> _CC1SW {
580        _CC1SW { w: self }
581    }
582}