stm32f103xx/tim2/sr/
mod.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::SR {
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 CC4OFR {
47    bits: bool,
48}
49impl CC4OFR {
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 CC3OFR {
68    bits: bool,
69}
70impl CC3OFR {
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 CC2OFR {
89    bits: bool,
90}
91impl CC2OFR {
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 CC1OFR {
110    bits: bool,
111}
112impl CC1OFR {
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 TIFR {
131    bits: bool,
132}
133impl TIFR {
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 CC4IFR {
152    bits: bool,
153}
154impl CC4IFR {
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 CC3IFR {
173    bits: bool,
174}
175impl CC3IFR {
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 CC2IFR {
194    bits: bool,
195}
196impl CC2IFR {
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 CC1IFR {
215    bits: bool,
216}
217impl CC1IFR {
218    #[doc = r" Value of the field as raw bits"]
219    #[inline]
220    pub fn bit(&self) -> bool {
221        self.bits
222    }
223    #[doc = r" Returns `true` if the bit is clear (0)"]
224    #[inline]
225    pub fn bit_is_clear(&self) -> bool {
226        !self.bit()
227    }
228    #[doc = r" Returns `true` if the bit is set (1)"]
229    #[inline]
230    pub fn bit_is_set(&self) -> bool {
231        self.bit()
232    }
233}
234#[doc = "Possible values of the field `UIF`"]
235pub type UIFR = ::tim1::sr::UIFR;
236#[doc = r" Proxy"]
237pub struct _CC4OFW<'a> {
238    w: &'a mut W,
239}
240impl<'a> _CC4OFW<'a> {
241    #[doc = r" Sets the field bit"]
242    pub fn set_bit(self) -> &'a mut W {
243        self.bit(true)
244    }
245    #[doc = r" Clears the field bit"]
246    pub fn clear_bit(self) -> &'a mut W {
247        self.bit(false)
248    }
249    #[doc = r" Writes raw bits to the field"]
250    #[inline]
251    pub fn bit(self, value: bool) -> &'a mut W {
252        const MASK: bool = true;
253        const OFFSET: u8 = 12;
254        self.w.bits &= !((MASK as u32) << OFFSET);
255        self.w.bits |= ((value & MASK) as u32) << OFFSET;
256        self.w
257    }
258}
259#[doc = r" Proxy"]
260pub struct _CC3OFW<'a> {
261    w: &'a mut W,
262}
263impl<'a> _CC3OFW<'a> {
264    #[doc = r" Sets the field bit"]
265    pub fn set_bit(self) -> &'a mut W {
266        self.bit(true)
267    }
268    #[doc = r" Clears the field bit"]
269    pub fn clear_bit(self) -> &'a mut W {
270        self.bit(false)
271    }
272    #[doc = r" Writes raw bits to the field"]
273    #[inline]
274    pub fn bit(self, value: bool) -> &'a mut W {
275        const MASK: bool = true;
276        const OFFSET: u8 = 11;
277        self.w.bits &= !((MASK as u32) << OFFSET);
278        self.w.bits |= ((value & MASK) as u32) << OFFSET;
279        self.w
280    }
281}
282#[doc = r" Proxy"]
283pub struct _CC2OFW<'a> {
284    w: &'a mut W,
285}
286impl<'a> _CC2OFW<'a> {
287    #[doc = r" Sets the field bit"]
288    pub fn set_bit(self) -> &'a mut W {
289        self.bit(true)
290    }
291    #[doc = r" Clears the field bit"]
292    pub fn clear_bit(self) -> &'a mut W {
293        self.bit(false)
294    }
295    #[doc = r" Writes raw bits to the field"]
296    #[inline]
297    pub fn bit(self, value: bool) -> &'a mut W {
298        const MASK: bool = true;
299        const OFFSET: u8 = 10;
300        self.w.bits &= !((MASK as u32) << OFFSET);
301        self.w.bits |= ((value & MASK) as u32) << OFFSET;
302        self.w
303    }
304}
305#[doc = r" Proxy"]
306pub struct _CC1OFW<'a> {
307    w: &'a mut W,
308}
309impl<'a> _CC1OFW<'a> {
310    #[doc = r" Sets the field bit"]
311    pub fn set_bit(self) -> &'a mut W {
312        self.bit(true)
313    }
314    #[doc = r" Clears the field bit"]
315    pub fn clear_bit(self) -> &'a mut W {
316        self.bit(false)
317    }
318    #[doc = r" Writes raw bits to the field"]
319    #[inline]
320    pub fn bit(self, value: bool) -> &'a mut W {
321        const MASK: bool = true;
322        const OFFSET: u8 = 9;
323        self.w.bits &= !((MASK as u32) << OFFSET);
324        self.w.bits |= ((value & MASK) as u32) << OFFSET;
325        self.w
326    }
327}
328#[doc = r" Proxy"]
329pub struct _TIFW<'a> {
330    w: &'a mut W,
331}
332impl<'a> _TIFW<'a> {
333    #[doc = r" Sets the field bit"]
334    pub fn set_bit(self) -> &'a mut W {
335        self.bit(true)
336    }
337    #[doc = r" Clears the field bit"]
338    pub fn clear_bit(self) -> &'a mut W {
339        self.bit(false)
340    }
341    #[doc = r" Writes raw bits to the field"]
342    #[inline]
343    pub fn bit(self, value: bool) -> &'a mut W {
344        const MASK: bool = true;
345        const OFFSET: u8 = 6;
346        self.w.bits &= !((MASK as u32) << OFFSET);
347        self.w.bits |= ((value & MASK) as u32) << OFFSET;
348        self.w
349    }
350}
351#[doc = r" Proxy"]
352pub struct _CC4IFW<'a> {
353    w: &'a mut W,
354}
355impl<'a> _CC4IFW<'a> {
356    #[doc = r" Sets the field bit"]
357    pub fn set_bit(self) -> &'a mut W {
358        self.bit(true)
359    }
360    #[doc = r" Clears the field bit"]
361    pub fn clear_bit(self) -> &'a mut W {
362        self.bit(false)
363    }
364    #[doc = r" Writes raw bits to the field"]
365    #[inline]
366    pub fn bit(self, value: bool) -> &'a mut W {
367        const MASK: bool = true;
368        const OFFSET: u8 = 4;
369        self.w.bits &= !((MASK as u32) << OFFSET);
370        self.w.bits |= ((value & MASK) as u32) << OFFSET;
371        self.w
372    }
373}
374#[doc = r" Proxy"]
375pub struct _CC3IFW<'a> {
376    w: &'a mut W,
377}
378impl<'a> _CC3IFW<'a> {
379    #[doc = r" Sets the field bit"]
380    pub fn set_bit(self) -> &'a mut W {
381        self.bit(true)
382    }
383    #[doc = r" Clears the field bit"]
384    pub fn clear_bit(self) -> &'a mut W {
385        self.bit(false)
386    }
387    #[doc = r" Writes raw bits to the field"]
388    #[inline]
389    pub fn bit(self, value: bool) -> &'a mut W {
390        const MASK: bool = true;
391        const OFFSET: u8 = 3;
392        self.w.bits &= !((MASK as u32) << OFFSET);
393        self.w.bits |= ((value & MASK) as u32) << OFFSET;
394        self.w
395    }
396}
397#[doc = r" Proxy"]
398pub struct _CC2IFW<'a> {
399    w: &'a mut W,
400}
401impl<'a> _CC2IFW<'a> {
402    #[doc = r" Sets the field bit"]
403    pub fn set_bit(self) -> &'a mut W {
404        self.bit(true)
405    }
406    #[doc = r" Clears the field bit"]
407    pub fn clear_bit(self) -> &'a mut W {
408        self.bit(false)
409    }
410    #[doc = r" Writes raw bits to the field"]
411    #[inline]
412    pub fn bit(self, value: bool) -> &'a mut W {
413        const MASK: bool = true;
414        const OFFSET: u8 = 2;
415        self.w.bits &= !((MASK as u32) << OFFSET);
416        self.w.bits |= ((value & MASK) as u32) << OFFSET;
417        self.w
418    }
419}
420#[doc = r" Proxy"]
421pub struct _CC1IFW<'a> {
422    w: &'a mut W,
423}
424impl<'a> _CC1IFW<'a> {
425    #[doc = r" Sets the field bit"]
426    pub fn set_bit(self) -> &'a mut W {
427        self.bit(true)
428    }
429    #[doc = r" Clears the field bit"]
430    pub fn clear_bit(self) -> &'a mut W {
431        self.bit(false)
432    }
433    #[doc = r" Writes raw bits to the field"]
434    #[inline]
435    pub fn bit(self, value: bool) -> &'a mut W {
436        const MASK: bool = true;
437        const OFFSET: u8 = 1;
438        self.w.bits &= !((MASK as u32) << OFFSET);
439        self.w.bits |= ((value & MASK) as u32) << OFFSET;
440        self.w
441    }
442}
443#[doc = "Values that can be written to the field `UIF`"]
444pub type UIFW = ::tim1::sr::UIFW;
445#[doc = r" Proxy"]
446pub struct _UIFW<'a> {
447    w: &'a mut W,
448}
449impl<'a> _UIFW<'a> {
450    #[doc = r" Writes `variant` to the field"]
451    #[inline]
452    pub fn variant(self, variant: UIFW) -> &'a mut W {
453        {
454            self.bit(variant._bits())
455        }
456    }
457    #[doc = "Clears the update interrupt flag"]
458    #[inline]
459    pub fn clear(self) -> &'a mut W {
460        self.variant(::tim1::sr::UIFW::CLEAR)
461    }
462    #[doc = r" Sets the field bit"]
463    pub fn set_bit(self) -> &'a mut W {
464        self.bit(true)
465    }
466    #[doc = r" Clears the field bit"]
467    pub fn clear_bit(self) -> &'a mut W {
468        self.bit(false)
469    }
470    #[doc = r" Writes raw bits to the field"]
471    #[inline]
472    pub fn bit(self, value: bool) -> &'a mut W {
473        const MASK: bool = true;
474        const OFFSET: u8 = 0;
475        self.w.bits &= !((MASK as u32) << OFFSET);
476        self.w.bits |= ((value & MASK) as u32) << OFFSET;
477        self.w
478    }
479}
480impl R {
481    #[doc = r" Value of the register as raw bits"]
482    #[inline]
483    pub fn bits(&self) -> u32 {
484        self.bits
485    }
486    #[doc = "Bit 12 - Capture/Compare 4 overcapture flag"]
487    #[inline]
488    pub fn cc4of(&self) -> CC4OFR {
489        let bits = {
490            const MASK: bool = true;
491            const OFFSET: u8 = 12;
492            ((self.bits >> OFFSET) & MASK as u32) != 0
493        };
494        CC4OFR { bits }
495    }
496    #[doc = "Bit 11 - Capture/Compare 3 overcapture flag"]
497    #[inline]
498    pub fn cc3of(&self) -> CC3OFR {
499        let bits = {
500            const MASK: bool = true;
501            const OFFSET: u8 = 11;
502            ((self.bits >> OFFSET) & MASK as u32) != 0
503        };
504        CC3OFR { bits }
505    }
506    #[doc = "Bit 10 - Capture/compare 2 overcapture flag"]
507    #[inline]
508    pub fn cc2of(&self) -> CC2OFR {
509        let bits = {
510            const MASK: bool = true;
511            const OFFSET: u8 = 10;
512            ((self.bits >> OFFSET) & MASK as u32) != 0
513        };
514        CC2OFR { bits }
515    }
516    #[doc = "Bit 9 - Capture/Compare 1 overcapture flag"]
517    #[inline]
518    pub fn cc1of(&self) -> CC1OFR {
519        let bits = {
520            const MASK: bool = true;
521            const OFFSET: u8 = 9;
522            ((self.bits >> OFFSET) & MASK as u32) != 0
523        };
524        CC1OFR { bits }
525    }
526    #[doc = "Bit 6 - Trigger interrupt flag"]
527    #[inline]
528    pub fn tif(&self) -> TIFR {
529        let bits = {
530            const MASK: bool = true;
531            const OFFSET: u8 = 6;
532            ((self.bits >> OFFSET) & MASK as u32) != 0
533        };
534        TIFR { bits }
535    }
536    #[doc = "Bit 4 - Capture/Compare 4 interrupt flag"]
537    #[inline]
538    pub fn cc4if(&self) -> CC4IFR {
539        let bits = {
540            const MASK: bool = true;
541            const OFFSET: u8 = 4;
542            ((self.bits >> OFFSET) & MASK as u32) != 0
543        };
544        CC4IFR { bits }
545    }
546    #[doc = "Bit 3 - Capture/Compare 3 interrupt flag"]
547    #[inline]
548    pub fn cc3if(&self) -> CC3IFR {
549        let bits = {
550            const MASK: bool = true;
551            const OFFSET: u8 = 3;
552            ((self.bits >> OFFSET) & MASK as u32) != 0
553        };
554        CC3IFR { bits }
555    }
556    #[doc = "Bit 2 - Capture/Compare 2 interrupt flag"]
557    #[inline]
558    pub fn cc2if(&self) -> CC2IFR {
559        let bits = {
560            const MASK: bool = true;
561            const OFFSET: u8 = 2;
562            ((self.bits >> OFFSET) & MASK as u32) != 0
563        };
564        CC2IFR { bits }
565    }
566    #[doc = "Bit 1 - Capture/compare 1 interrupt flag"]
567    #[inline]
568    pub fn cc1if(&self) -> CC1IFR {
569        let bits = {
570            const MASK: bool = true;
571            const OFFSET: u8 = 1;
572            ((self.bits >> OFFSET) & MASK as u32) != 0
573        };
574        CC1IFR { bits }
575    }
576    #[doc = "Bit 0 - Update interrupt flag"]
577    #[inline]
578    pub fn uif(&self) -> UIFR {
579        UIFR::_from({
580            const MASK: bool = true;
581            const OFFSET: u8 = 0;
582            ((self.bits >> OFFSET) & MASK as u32) != 0
583        })
584    }
585}
586impl W {
587    #[doc = r" Reset value of the register"]
588    #[inline]
589    pub fn reset_value() -> W {
590        W { bits: 0 }
591    }
592    #[doc = r" Writes raw bits to the register"]
593    #[inline]
594    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
595        self.bits = bits;
596        self
597    }
598    #[doc = "Bit 12 - Capture/Compare 4 overcapture flag"]
599    #[inline]
600    pub fn cc4of(&mut self) -> _CC4OFW {
601        _CC4OFW { w: self }
602    }
603    #[doc = "Bit 11 - Capture/Compare 3 overcapture flag"]
604    #[inline]
605    pub fn cc3of(&mut self) -> _CC3OFW {
606        _CC3OFW { w: self }
607    }
608    #[doc = "Bit 10 - Capture/compare 2 overcapture flag"]
609    #[inline]
610    pub fn cc2of(&mut self) -> _CC2OFW {
611        _CC2OFW { w: self }
612    }
613    #[doc = "Bit 9 - Capture/Compare 1 overcapture flag"]
614    #[inline]
615    pub fn cc1of(&mut self) -> _CC1OFW {
616        _CC1OFW { w: self }
617    }
618    #[doc = "Bit 6 - Trigger interrupt flag"]
619    #[inline]
620    pub fn tif(&mut self) -> _TIFW {
621        _TIFW { w: self }
622    }
623    #[doc = "Bit 4 - Capture/Compare 4 interrupt flag"]
624    #[inline]
625    pub fn cc4if(&mut self) -> _CC4IFW {
626        _CC4IFW { w: self }
627    }
628    #[doc = "Bit 3 - Capture/Compare 3 interrupt flag"]
629    #[inline]
630    pub fn cc3if(&mut self) -> _CC3IFW {
631        _CC3IFW { w: self }
632    }
633    #[doc = "Bit 2 - Capture/Compare 2 interrupt flag"]
634    #[inline]
635    pub fn cc2if(&mut self) -> _CC2IFW {
636        _CC2IFW { w: self }
637    }
638    #[doc = "Bit 1 - Capture/compare 1 interrupt flag"]
639    #[inline]
640    pub fn cc1if(&mut self) -> _CC1IFW {
641        _CC1IFW { w: self }
642    }
643    #[doc = "Bit 0 - Update interrupt flag"]
644    #[inline]
645    pub fn uif(&mut self) -> _UIFW {
646        _UIFW { w: self }
647    }
648}