stm32l4x2_pac/tim1/
cr2.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::CR2 {
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 OIS4R {
47    bits: bool,
48}
49impl OIS4R {
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 OIS3NR {
68    bits: bool,
69}
70impl OIS3NR {
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 OIS3R {
89    bits: bool,
90}
91impl OIS3R {
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 OIS2NR {
110    bits: bool,
111}
112impl OIS2NR {
113    #[doc = r" Value of the field as raw bits"]
114    #[inline]
115    pub fn bit(&self) -> bool {
116        self.bits
117    }
118    #[doc = r" Returns `true` if the bit is clear (0)"]
119    #[inline]
120    pub fn bit_is_clear(&self) -> bool {
121        !self.bit()
122    }
123    #[doc = r" Returns `true` if the bit is set (1)"]
124    #[inline]
125    pub fn bit_is_set(&self) -> bool {
126        self.bit()
127    }
128}
129#[doc = r" Value of the field"]
130pub struct OIS2R {
131    bits: bool,
132}
133impl OIS2R {
134    #[doc = r" Value of the field as raw bits"]
135    #[inline]
136    pub fn bit(&self) -> bool {
137        self.bits
138    }
139    #[doc = r" Returns `true` if the bit is clear (0)"]
140    #[inline]
141    pub fn bit_is_clear(&self) -> bool {
142        !self.bit()
143    }
144    #[doc = r" Returns `true` if the bit is set (1)"]
145    #[inline]
146    pub fn bit_is_set(&self) -> bool {
147        self.bit()
148    }
149}
150#[doc = r" Value of the field"]
151pub struct OIS1NR {
152    bits: bool,
153}
154impl OIS1NR {
155    #[doc = r" Value of the field as raw bits"]
156    #[inline]
157    pub fn bit(&self) -> bool {
158        self.bits
159    }
160    #[doc = r" Returns `true` if the bit is clear (0)"]
161    #[inline]
162    pub fn bit_is_clear(&self) -> bool {
163        !self.bit()
164    }
165    #[doc = r" Returns `true` if the bit is set (1)"]
166    #[inline]
167    pub fn bit_is_set(&self) -> bool {
168        self.bit()
169    }
170}
171#[doc = r" Value of the field"]
172pub struct OIS1R {
173    bits: bool,
174}
175impl OIS1R {
176    #[doc = r" Value of the field as raw bits"]
177    #[inline]
178    pub fn bit(&self) -> bool {
179        self.bits
180    }
181    #[doc = r" Returns `true` if the bit is clear (0)"]
182    #[inline]
183    pub fn bit_is_clear(&self) -> bool {
184        !self.bit()
185    }
186    #[doc = r" Returns `true` if the bit is set (1)"]
187    #[inline]
188    pub fn bit_is_set(&self) -> bool {
189        self.bit()
190    }
191}
192#[doc = r" Value of the field"]
193pub struct TI1SR {
194    bits: bool,
195}
196impl TI1SR {
197    #[doc = r" Value of the field as raw bits"]
198    #[inline]
199    pub fn bit(&self) -> bool {
200        self.bits
201    }
202    #[doc = r" Returns `true` if the bit is clear (0)"]
203    #[inline]
204    pub fn bit_is_clear(&self) -> bool {
205        !self.bit()
206    }
207    #[doc = r" Returns `true` if the bit is set (1)"]
208    #[inline]
209    pub fn bit_is_set(&self) -> bool {
210        self.bit()
211    }
212}
213#[doc = r" Value of the field"]
214pub struct MMSR {
215    bits: u8,
216}
217impl MMSR {
218    #[doc = r" Value of the field as raw bits"]
219    #[inline]
220    pub fn bits(&self) -> u8 {
221        self.bits
222    }
223}
224#[doc = r" Value of the field"]
225pub struct CCDSR {
226    bits: bool,
227}
228impl CCDSR {
229    #[doc = r" Value of the field as raw bits"]
230    #[inline]
231    pub fn bit(&self) -> bool {
232        self.bits
233    }
234    #[doc = r" Returns `true` if the bit is clear (0)"]
235    #[inline]
236    pub fn bit_is_clear(&self) -> bool {
237        !self.bit()
238    }
239    #[doc = r" Returns `true` if the bit is set (1)"]
240    #[inline]
241    pub fn bit_is_set(&self) -> bool {
242        self.bit()
243    }
244}
245#[doc = r" Value of the field"]
246pub struct CCUSR {
247    bits: bool,
248}
249impl CCUSR {
250    #[doc = r" Value of the field as raw bits"]
251    #[inline]
252    pub fn bit(&self) -> bool {
253        self.bits
254    }
255    #[doc = r" Returns `true` if the bit is clear (0)"]
256    #[inline]
257    pub fn bit_is_clear(&self) -> bool {
258        !self.bit()
259    }
260    #[doc = r" Returns `true` if the bit is set (1)"]
261    #[inline]
262    pub fn bit_is_set(&self) -> bool {
263        self.bit()
264    }
265}
266#[doc = r" Value of the field"]
267pub struct CCPCR {
268    bits: bool,
269}
270impl CCPCR {
271    #[doc = r" Value of the field as raw bits"]
272    #[inline]
273    pub fn bit(&self) -> bool {
274        self.bits
275    }
276    #[doc = r" Returns `true` if the bit is clear (0)"]
277    #[inline]
278    pub fn bit_is_clear(&self) -> bool {
279        !self.bit()
280    }
281    #[doc = r" Returns `true` if the bit is set (1)"]
282    #[inline]
283    pub fn bit_is_set(&self) -> bool {
284        self.bit()
285    }
286}
287#[doc = r" Proxy"]
288pub struct _OIS4W<'a> {
289    w: &'a mut W,
290}
291impl<'a> _OIS4W<'a> {
292    #[doc = r" Sets the field bit"]
293    pub fn set_bit(self) -> &'a mut W {
294        self.bit(true)
295    }
296    #[doc = r" Clears the field bit"]
297    pub fn clear_bit(self) -> &'a mut W {
298        self.bit(false)
299    }
300    #[doc = r" Writes raw bits to the field"]
301    #[inline]
302    pub fn bit(self, value: bool) -> &'a mut W {
303        const MASK: bool = true;
304        const OFFSET: u8 = 14;
305        self.w.bits &= !((MASK as u32) << OFFSET);
306        self.w.bits |= ((value & MASK) as u32) << OFFSET;
307        self.w
308    }
309}
310#[doc = r" Proxy"]
311pub struct _OIS3NW<'a> {
312    w: &'a mut W,
313}
314impl<'a> _OIS3NW<'a> {
315    #[doc = r" Sets the field bit"]
316    pub fn set_bit(self) -> &'a mut W {
317        self.bit(true)
318    }
319    #[doc = r" Clears the field bit"]
320    pub fn clear_bit(self) -> &'a mut W {
321        self.bit(false)
322    }
323    #[doc = r" Writes raw bits to the field"]
324    #[inline]
325    pub fn bit(self, value: bool) -> &'a mut W {
326        const MASK: bool = true;
327        const OFFSET: u8 = 13;
328        self.w.bits &= !((MASK as u32) << OFFSET);
329        self.w.bits |= ((value & MASK) as u32) << OFFSET;
330        self.w
331    }
332}
333#[doc = r" Proxy"]
334pub struct _OIS3W<'a> {
335    w: &'a mut W,
336}
337impl<'a> _OIS3W<'a> {
338    #[doc = r" Sets the field bit"]
339    pub fn set_bit(self) -> &'a mut W {
340        self.bit(true)
341    }
342    #[doc = r" Clears the field bit"]
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]
348    pub fn bit(self, value: bool) -> &'a mut W {
349        const MASK: bool = true;
350        const OFFSET: u8 = 12;
351        self.w.bits &= !((MASK as u32) << OFFSET);
352        self.w.bits |= ((value & MASK) as u32) << OFFSET;
353        self.w
354    }
355}
356#[doc = r" Proxy"]
357pub struct _OIS2NW<'a> {
358    w: &'a mut W,
359}
360impl<'a> _OIS2NW<'a> {
361    #[doc = r" Sets the field bit"]
362    pub fn set_bit(self) -> &'a mut W {
363        self.bit(true)
364    }
365    #[doc = r" Clears the field bit"]
366    pub fn clear_bit(self) -> &'a mut W {
367        self.bit(false)
368    }
369    #[doc = r" Writes raw bits to the field"]
370    #[inline]
371    pub fn bit(self, value: bool) -> &'a mut W {
372        const MASK: bool = true;
373        const OFFSET: u8 = 11;
374        self.w.bits &= !((MASK as u32) << OFFSET);
375        self.w.bits |= ((value & MASK) as u32) << OFFSET;
376        self.w
377    }
378}
379#[doc = r" Proxy"]
380pub struct _OIS2W<'a> {
381    w: &'a mut W,
382}
383impl<'a> _OIS2W<'a> {
384    #[doc = r" Sets the field bit"]
385    pub fn set_bit(self) -> &'a mut W {
386        self.bit(true)
387    }
388    #[doc = r" Clears the field bit"]
389    pub fn clear_bit(self) -> &'a mut W {
390        self.bit(false)
391    }
392    #[doc = r" Writes raw bits to the field"]
393    #[inline]
394    pub fn bit(self, value: bool) -> &'a mut W {
395        const MASK: bool = true;
396        const OFFSET: u8 = 10;
397        self.w.bits &= !((MASK as u32) << OFFSET);
398        self.w.bits |= ((value & MASK) as u32) << OFFSET;
399        self.w
400    }
401}
402#[doc = r" Proxy"]
403pub struct _OIS1NW<'a> {
404    w: &'a mut W,
405}
406impl<'a> _OIS1NW<'a> {
407    #[doc = r" Sets the field bit"]
408    pub fn set_bit(self) -> &'a mut W {
409        self.bit(true)
410    }
411    #[doc = r" Clears the field bit"]
412    pub fn clear_bit(self) -> &'a mut W {
413        self.bit(false)
414    }
415    #[doc = r" Writes raw bits to the field"]
416    #[inline]
417    pub fn bit(self, value: bool) -> &'a mut W {
418        const MASK: bool = true;
419        const OFFSET: u8 = 9;
420        self.w.bits &= !((MASK as u32) << OFFSET);
421        self.w.bits |= ((value & MASK) as u32) << OFFSET;
422        self.w
423    }
424}
425#[doc = r" Proxy"]
426pub struct _OIS1W<'a> {
427    w: &'a mut W,
428}
429impl<'a> _OIS1W<'a> {
430    #[doc = r" Sets the field bit"]
431    pub fn set_bit(self) -> &'a mut W {
432        self.bit(true)
433    }
434    #[doc = r" Clears the field bit"]
435    pub fn clear_bit(self) -> &'a mut W {
436        self.bit(false)
437    }
438    #[doc = r" Writes raw bits to the field"]
439    #[inline]
440    pub fn bit(self, value: bool) -> &'a mut W {
441        const MASK: bool = true;
442        const OFFSET: u8 = 8;
443        self.w.bits &= !((MASK as u32) << OFFSET);
444        self.w.bits |= ((value & MASK) as u32) << OFFSET;
445        self.w
446    }
447}
448#[doc = r" Proxy"]
449pub struct _TI1SW<'a> {
450    w: &'a mut W,
451}
452impl<'a> _TI1SW<'a> {
453    #[doc = r" Sets the field bit"]
454    pub fn set_bit(self) -> &'a mut W {
455        self.bit(true)
456    }
457    #[doc = r" Clears the field bit"]
458    pub fn clear_bit(self) -> &'a mut W {
459        self.bit(false)
460    }
461    #[doc = r" Writes raw bits to the field"]
462    #[inline]
463    pub fn bit(self, value: bool) -> &'a mut W {
464        const MASK: bool = true;
465        const OFFSET: u8 = 7;
466        self.w.bits &= !((MASK as u32) << OFFSET);
467        self.w.bits |= ((value & MASK) as u32) << OFFSET;
468        self.w
469    }
470}
471#[doc = r" Proxy"]
472pub struct _MMSW<'a> {
473    w: &'a mut W,
474}
475impl<'a> _MMSW<'a> {
476    #[doc = r" Writes raw bits to the field"]
477    #[inline]
478    pub unsafe fn bits(self, value: u8) -> &'a mut W {
479        const MASK: u8 = 7;
480        const OFFSET: u8 = 4;
481        self.w.bits &= !((MASK as u32) << OFFSET);
482        self.w.bits |= ((value & MASK) as u32) << OFFSET;
483        self.w
484    }
485}
486#[doc = r" Proxy"]
487pub struct _CCDSW<'a> {
488    w: &'a mut W,
489}
490impl<'a> _CCDSW<'a> {
491    #[doc = r" Sets the field bit"]
492    pub fn set_bit(self) -> &'a mut W {
493        self.bit(true)
494    }
495    #[doc = r" Clears the field bit"]
496    pub fn clear_bit(self) -> &'a mut W {
497        self.bit(false)
498    }
499    #[doc = r" Writes raw bits to the field"]
500    #[inline]
501    pub fn bit(self, value: bool) -> &'a mut W {
502        const MASK: bool = true;
503        const OFFSET: u8 = 3;
504        self.w.bits &= !((MASK as u32) << OFFSET);
505        self.w.bits |= ((value & MASK) as u32) << OFFSET;
506        self.w
507    }
508}
509#[doc = r" Proxy"]
510pub struct _CCUSW<'a> {
511    w: &'a mut W,
512}
513impl<'a> _CCUSW<'a> {
514    #[doc = r" Sets the field bit"]
515    pub fn set_bit(self) -> &'a mut W {
516        self.bit(true)
517    }
518    #[doc = r" Clears the field bit"]
519    pub fn clear_bit(self) -> &'a mut W {
520        self.bit(false)
521    }
522    #[doc = r" Writes raw bits to the field"]
523    #[inline]
524    pub fn bit(self, value: bool) -> &'a mut W {
525        const MASK: bool = true;
526        const OFFSET: u8 = 2;
527        self.w.bits &= !((MASK as u32) << OFFSET);
528        self.w.bits |= ((value & MASK) as u32) << OFFSET;
529        self.w
530    }
531}
532#[doc = r" Proxy"]
533pub struct _CCPCW<'a> {
534    w: &'a mut W,
535}
536impl<'a> _CCPCW<'a> {
537    #[doc = r" Sets the field bit"]
538    pub fn set_bit(self) -> &'a mut W {
539        self.bit(true)
540    }
541    #[doc = r" Clears the field bit"]
542    pub fn clear_bit(self) -> &'a mut W {
543        self.bit(false)
544    }
545    #[doc = r" Writes raw bits to the field"]
546    #[inline]
547    pub fn bit(self, value: bool) -> &'a mut W {
548        const MASK: bool = true;
549        const OFFSET: u8 = 0;
550        self.w.bits &= !((MASK as u32) << OFFSET);
551        self.w.bits |= ((value & MASK) as u32) << OFFSET;
552        self.w
553    }
554}
555impl R {
556    #[doc = r" Value of the register as raw bits"]
557    #[inline]
558    pub fn bits(&self) -> u32 {
559        self.bits
560    }
561    #[doc = "Bit 14 - Output Idle state 4"]
562    #[inline]
563    pub fn ois4(&self) -> OIS4R {
564        let bits = {
565            const MASK: bool = true;
566            const OFFSET: u8 = 14;
567            ((self.bits >> OFFSET) & MASK as u32) != 0
568        };
569        OIS4R { bits }
570    }
571    #[doc = "Bit 13 - Output Idle state 3"]
572    #[inline]
573    pub fn ois3n(&self) -> OIS3NR {
574        let bits = {
575            const MASK: bool = true;
576            const OFFSET: u8 = 13;
577            ((self.bits >> OFFSET) & MASK as u32) != 0
578        };
579        OIS3NR { bits }
580    }
581    #[doc = "Bit 12 - Output Idle state 3"]
582    #[inline]
583    pub fn ois3(&self) -> OIS3R {
584        let bits = {
585            const MASK: bool = true;
586            const OFFSET: u8 = 12;
587            ((self.bits >> OFFSET) & MASK as u32) != 0
588        };
589        OIS3R { bits }
590    }
591    #[doc = "Bit 11 - Output Idle state 2"]
592    #[inline]
593    pub fn ois2n(&self) -> OIS2NR {
594        let bits = {
595            const MASK: bool = true;
596            const OFFSET: u8 = 11;
597            ((self.bits >> OFFSET) & MASK as u32) != 0
598        };
599        OIS2NR { bits }
600    }
601    #[doc = "Bit 10 - Output Idle state 2"]
602    #[inline]
603    pub fn ois2(&self) -> OIS2R {
604        let bits = {
605            const MASK: bool = true;
606            const OFFSET: u8 = 10;
607            ((self.bits >> OFFSET) & MASK as u32) != 0
608        };
609        OIS2R { bits }
610    }
611    #[doc = "Bit 9 - Output Idle state 1"]
612    #[inline]
613    pub fn ois1n(&self) -> OIS1NR {
614        let bits = {
615            const MASK: bool = true;
616            const OFFSET: u8 = 9;
617            ((self.bits >> OFFSET) & MASK as u32) != 0
618        };
619        OIS1NR { bits }
620    }
621    #[doc = "Bit 8 - Output Idle state 1"]
622    #[inline]
623    pub fn ois1(&self) -> OIS1R {
624        let bits = {
625            const MASK: bool = true;
626            const OFFSET: u8 = 8;
627            ((self.bits >> OFFSET) & MASK as u32) != 0
628        };
629        OIS1R { bits }
630    }
631    #[doc = "Bit 7 - TI1 selection"]
632    #[inline]
633    pub fn ti1s(&self) -> TI1SR {
634        let bits = {
635            const MASK: bool = true;
636            const OFFSET: u8 = 7;
637            ((self.bits >> OFFSET) & MASK as u32) != 0
638        };
639        TI1SR { bits }
640    }
641    #[doc = "Bits 4:6 - Master mode selection"]
642    #[inline]
643    pub fn mms(&self) -> MMSR {
644        let bits = {
645            const MASK: u8 = 7;
646            const OFFSET: u8 = 4;
647            ((self.bits >> OFFSET) & MASK as u32) as u8
648        };
649        MMSR { bits }
650    }
651    #[doc = "Bit 3 - Capture/compare DMA selection"]
652    #[inline]
653    pub fn ccds(&self) -> CCDSR {
654        let bits = {
655            const MASK: bool = true;
656            const OFFSET: u8 = 3;
657            ((self.bits >> OFFSET) & MASK as u32) != 0
658        };
659        CCDSR { bits }
660    }
661    #[doc = "Bit 2 - Capture/compare control update selection"]
662    #[inline]
663    pub fn ccus(&self) -> CCUSR {
664        let bits = {
665            const MASK: bool = true;
666            const OFFSET: u8 = 2;
667            ((self.bits >> OFFSET) & MASK as u32) != 0
668        };
669        CCUSR { bits }
670    }
671    #[doc = "Bit 0 - Capture/compare preloaded control"]
672    #[inline]
673    pub fn ccpc(&self) -> CCPCR {
674        let bits = {
675            const MASK: bool = true;
676            const OFFSET: u8 = 0;
677            ((self.bits >> OFFSET) & MASK as u32) != 0
678        };
679        CCPCR { bits }
680    }
681}
682impl W {
683    #[doc = r" Reset value of the register"]
684    #[inline]
685    pub fn reset_value() -> W {
686        W { bits: 0 }
687    }
688    #[doc = r" Writes raw bits to the register"]
689    #[inline]
690    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
691        self.bits = bits;
692        self
693    }
694    #[doc = "Bit 14 - Output Idle state 4"]
695    #[inline]
696    pub fn ois4(&mut self) -> _OIS4W {
697        _OIS4W { w: self }
698    }
699    #[doc = "Bit 13 - Output Idle state 3"]
700    #[inline]
701    pub fn ois3n(&mut self) -> _OIS3NW {
702        _OIS3NW { w: self }
703    }
704    #[doc = "Bit 12 - Output Idle state 3"]
705    #[inline]
706    pub fn ois3(&mut self) -> _OIS3W {
707        _OIS3W { w: self }
708    }
709    #[doc = "Bit 11 - Output Idle state 2"]
710    #[inline]
711    pub fn ois2n(&mut self) -> _OIS2NW {
712        _OIS2NW { w: self }
713    }
714    #[doc = "Bit 10 - Output Idle state 2"]
715    #[inline]
716    pub fn ois2(&mut self) -> _OIS2W {
717        _OIS2W { w: self }
718    }
719    #[doc = "Bit 9 - Output Idle state 1"]
720    #[inline]
721    pub fn ois1n(&mut self) -> _OIS1NW {
722        _OIS1NW { w: self }
723    }
724    #[doc = "Bit 8 - Output Idle state 1"]
725    #[inline]
726    pub fn ois1(&mut self) -> _OIS1W {
727        _OIS1W { w: self }
728    }
729    #[doc = "Bit 7 - TI1 selection"]
730    #[inline]
731    pub fn ti1s(&mut self) -> _TI1SW {
732        _TI1SW { w: self }
733    }
734    #[doc = "Bits 4:6 - Master mode selection"]
735    #[inline]
736    pub fn mms(&mut self) -> _MMSW {
737        _MMSW { w: self }
738    }
739    #[doc = "Bit 3 - Capture/compare DMA selection"]
740    #[inline]
741    pub fn ccds(&mut self) -> _CCDSW {
742        _CCDSW { w: self }
743    }
744    #[doc = "Bit 2 - Capture/compare control update selection"]
745    #[inline]
746    pub fn ccus(&mut self) -> _CCUSW {
747        _CCUSW { w: self }
748    }
749    #[doc = "Bit 0 - Capture/compare preloaded control"]
750    #[inline]
751    pub fn ccpc(&mut self) -> _CCPCW {
752        _CCPCW { w: self }
753    }
754}