stm32l4x2_pac/tim15/
dier.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::DIER {
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 TDER {
47    bits: bool,
48}
49impl TDER {
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 COMDER {
68    bits: bool,
69}
70impl COMDER {
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 CC1DER {
89    bits: bool,
90}
91impl CC1DER {
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 UDER {
110    bits: bool,
111}
112impl UDER {
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 BIER {
131    bits: bool,
132}
133impl BIER {
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 TIER {
152    bits: bool,
153}
154impl TIER {
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 COMIER {
173    bits: bool,
174}
175impl COMIER {
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 CC1IER {
194    bits: bool,
195}
196impl CC1IER {
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 = "Possible values of the field `UIE`"]
214#[derive(Clone, Copy, Debug, PartialEq)]
215pub enum UIER {
216    #[doc = "Update interrupt disabled"]
217    DISABLED,
218    #[doc = "Update interrupt enabled"]
219    ENABLED,
220}
221impl UIER {
222    #[doc = r" Returns `true` if the bit is clear (0)"]
223    #[inline]
224    pub fn bit_is_clear(&self) -> bool {
225        !self.bit()
226    }
227    #[doc = r" Returns `true` if the bit is set (1)"]
228    #[inline]
229    pub fn bit_is_set(&self) -> bool {
230        self.bit()
231    }
232    #[doc = r" Value of the field as raw bits"]
233    #[inline]
234    pub fn bit(&self) -> bool {
235        match *self {
236            UIER::DISABLED => false,
237            UIER::ENABLED => true,
238        }
239    }
240    #[allow(missing_docs)]
241    #[doc(hidden)]
242    #[inline]
243    pub fn _from(value: bool) -> UIER {
244        match value {
245            false => UIER::DISABLED,
246            true => UIER::ENABLED,
247        }
248    }
249    #[doc = "Checks if the value of the field is `DISABLED`"]
250    #[inline]
251    pub fn is_disabled(&self) -> bool {
252        *self == UIER::DISABLED
253    }
254    #[doc = "Checks if the value of the field is `ENABLED`"]
255    #[inline]
256    pub fn is_enabled(&self) -> bool {
257        *self == UIER::ENABLED
258    }
259}
260#[doc = r" Proxy"]
261pub struct _TDEW<'a> {
262    w: &'a mut W,
263}
264impl<'a> _TDEW<'a> {
265    #[doc = r" Sets the field bit"]
266    pub fn set_bit(self) -> &'a mut W {
267        self.bit(true)
268    }
269    #[doc = r" Clears the field bit"]
270    pub fn clear_bit(self) -> &'a mut W {
271        self.bit(false)
272    }
273    #[doc = r" Writes raw bits to the field"]
274    #[inline]
275    pub fn bit(self, value: bool) -> &'a mut W {
276        const MASK: bool = true;
277        const OFFSET: u8 = 14;
278        self.w.bits &= !((MASK as u32) << OFFSET);
279        self.w.bits |= ((value & MASK) as u32) << OFFSET;
280        self.w
281    }
282}
283#[doc = r" Proxy"]
284pub struct _COMDEW<'a> {
285    w: &'a mut W,
286}
287impl<'a> _COMDEW<'a> {
288    #[doc = r" Sets the field bit"]
289    pub fn set_bit(self) -> &'a mut W {
290        self.bit(true)
291    }
292    #[doc = r" Clears the field bit"]
293    pub fn clear_bit(self) -> &'a mut W {
294        self.bit(false)
295    }
296    #[doc = r" Writes raw bits to the field"]
297    #[inline]
298    pub fn bit(self, value: bool) -> &'a mut W {
299        const MASK: bool = true;
300        const OFFSET: u8 = 13;
301        self.w.bits &= !((MASK as u32) << OFFSET);
302        self.w.bits |= ((value & MASK) as u32) << OFFSET;
303        self.w
304    }
305}
306#[doc = r" Proxy"]
307pub struct _CC1DEW<'a> {
308    w: &'a mut W,
309}
310impl<'a> _CC1DEW<'a> {
311    #[doc = r" Sets the field bit"]
312    pub fn set_bit(self) -> &'a mut W {
313        self.bit(true)
314    }
315    #[doc = r" Clears the field bit"]
316    pub fn clear_bit(self) -> &'a mut W {
317        self.bit(false)
318    }
319    #[doc = r" Writes raw bits to the field"]
320    #[inline]
321    pub fn bit(self, value: bool) -> &'a mut W {
322        const MASK: bool = true;
323        const OFFSET: u8 = 9;
324        self.w.bits &= !((MASK as u32) << OFFSET);
325        self.w.bits |= ((value & MASK) as u32) << OFFSET;
326        self.w
327    }
328}
329#[doc = r" Proxy"]
330pub struct _UDEW<'a> {
331    w: &'a mut W,
332}
333impl<'a> _UDEW<'a> {
334    #[doc = r" Sets the field bit"]
335    pub fn set_bit(self) -> &'a mut W {
336        self.bit(true)
337    }
338    #[doc = r" Clears the field bit"]
339    pub fn clear_bit(self) -> &'a mut W {
340        self.bit(false)
341    }
342    #[doc = r" Writes raw bits to the field"]
343    #[inline]
344    pub fn bit(self, value: bool) -> &'a mut W {
345        const MASK: bool = true;
346        const OFFSET: u8 = 8;
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 _BIEW<'a> {
354    w: &'a mut W,
355}
356impl<'a> _BIEW<'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 = 7;
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 _TIEW<'a> {
377    w: &'a mut W,
378}
379impl<'a> _TIEW<'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 = 6;
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 _COMIEW<'a> {
400    w: &'a mut W,
401}
402impl<'a> _COMIEW<'a> {
403    #[doc = r" Sets the field bit"]
404    pub fn set_bit(self) -> &'a mut W {
405        self.bit(true)
406    }
407    #[doc = r" Clears the field bit"]
408    pub fn clear_bit(self) -> &'a mut W {
409        self.bit(false)
410    }
411    #[doc = r" Writes raw bits to the field"]
412    #[inline]
413    pub fn bit(self, value: bool) -> &'a mut W {
414        const MASK: bool = true;
415        const OFFSET: u8 = 5;
416        self.w.bits &= !((MASK as u32) << OFFSET);
417        self.w.bits |= ((value & MASK) as u32) << OFFSET;
418        self.w
419    }
420}
421#[doc = r" Proxy"]
422pub struct _CC1IEW<'a> {
423    w: &'a mut W,
424}
425impl<'a> _CC1IEW<'a> {
426    #[doc = r" Sets the field bit"]
427    pub fn set_bit(self) -> &'a mut W {
428        self.bit(true)
429    }
430    #[doc = r" Clears the field bit"]
431    pub fn clear_bit(self) -> &'a mut W {
432        self.bit(false)
433    }
434    #[doc = r" Writes raw bits to the field"]
435    #[inline]
436    pub fn bit(self, value: bool) -> &'a mut W {
437        const MASK: bool = true;
438        const OFFSET: u8 = 1;
439        self.w.bits &= !((MASK as u32) << OFFSET);
440        self.w.bits |= ((value & MASK) as u32) << OFFSET;
441        self.w
442    }
443}
444#[doc = "Values that can be written to the field `UIE`"]
445pub enum UIEW {
446    #[doc = "Update interrupt disabled"]
447    DISABLED,
448    #[doc = "Update interrupt enabled"]
449    ENABLED,
450}
451impl UIEW {
452    #[allow(missing_docs)]
453    #[doc(hidden)]
454    #[inline]
455    pub fn _bits(&self) -> bool {
456        match *self {
457            UIEW::DISABLED => false,
458            UIEW::ENABLED => true,
459        }
460    }
461}
462#[doc = r" Proxy"]
463pub struct _UIEW<'a> {
464    w: &'a mut W,
465}
466impl<'a> _UIEW<'a> {
467    #[doc = r" Writes `variant` to the field"]
468    #[inline]
469    pub fn variant(self, variant: UIEW) -> &'a mut W {
470        {
471            self.bit(variant._bits())
472        }
473    }
474    #[doc = "Update interrupt disabled"]
475    #[inline]
476    pub fn disabled(self) -> &'a mut W {
477        self.variant(UIEW::DISABLED)
478    }
479    #[doc = "Update interrupt enabled"]
480    #[inline]
481    pub fn enabled(self) -> &'a mut W {
482        self.variant(UIEW::ENABLED)
483    }
484    #[doc = r" Sets the field bit"]
485    pub fn set_bit(self) -> &'a mut W {
486        self.bit(true)
487    }
488    #[doc = r" Clears the field bit"]
489    pub fn clear_bit(self) -> &'a mut W {
490        self.bit(false)
491    }
492    #[doc = r" Writes raw bits to the field"]
493    #[inline]
494    pub fn bit(self, value: bool) -> &'a mut W {
495        const MASK: bool = true;
496        const OFFSET: u8 = 0;
497        self.w.bits &= !((MASK as u32) << OFFSET);
498        self.w.bits |= ((value & MASK) as u32) << OFFSET;
499        self.w
500    }
501}
502impl R {
503    #[doc = r" Value of the register as raw bits"]
504    #[inline]
505    pub fn bits(&self) -> u32 {
506        self.bits
507    }
508    #[doc = "Bit 14 - Trigger DMA request enable"]
509    #[inline]
510    pub fn tde(&self) -> TDER {
511        let bits = {
512            const MASK: bool = true;
513            const OFFSET: u8 = 14;
514            ((self.bits >> OFFSET) & MASK as u32) != 0
515        };
516        TDER { bits }
517    }
518    #[doc = "Bit 13 - COM DMA request enable"]
519    #[inline]
520    pub fn comde(&self) -> COMDER {
521        let bits = {
522            const MASK: bool = true;
523            const OFFSET: u8 = 13;
524            ((self.bits >> OFFSET) & MASK as u32) != 0
525        };
526        COMDER { bits }
527    }
528    #[doc = "Bit 9 - Capture/Compare 1 DMA request enable"]
529    #[inline]
530    pub fn cc1de(&self) -> CC1DER {
531        let bits = {
532            const MASK: bool = true;
533            const OFFSET: u8 = 9;
534            ((self.bits >> OFFSET) & MASK as u32) != 0
535        };
536        CC1DER { bits }
537    }
538    #[doc = "Bit 8 - Update DMA request enable"]
539    #[inline]
540    pub fn ude(&self) -> UDER {
541        let bits = {
542            const MASK: bool = true;
543            const OFFSET: u8 = 8;
544            ((self.bits >> OFFSET) & MASK as u32) != 0
545        };
546        UDER { bits }
547    }
548    #[doc = "Bit 7 - Break interrupt enable"]
549    #[inline]
550    pub fn bie(&self) -> BIER {
551        let bits = {
552            const MASK: bool = true;
553            const OFFSET: u8 = 7;
554            ((self.bits >> OFFSET) & MASK as u32) != 0
555        };
556        BIER { bits }
557    }
558    #[doc = "Bit 6 - Trigger interrupt enable"]
559    #[inline]
560    pub fn tie(&self) -> TIER {
561        let bits = {
562            const MASK: bool = true;
563            const OFFSET: u8 = 6;
564            ((self.bits >> OFFSET) & MASK as u32) != 0
565        };
566        TIER { bits }
567    }
568    #[doc = "Bit 5 - COM interrupt enable"]
569    #[inline]
570    pub fn comie(&self) -> COMIER {
571        let bits = {
572            const MASK: bool = true;
573            const OFFSET: u8 = 5;
574            ((self.bits >> OFFSET) & MASK as u32) != 0
575        };
576        COMIER { bits }
577    }
578    #[doc = "Bit 1 - Capture/Compare 1 interrupt enable"]
579    #[inline]
580    pub fn cc1ie(&self) -> CC1IER {
581        let bits = {
582            const MASK: bool = true;
583            const OFFSET: u8 = 1;
584            ((self.bits >> OFFSET) & MASK as u32) != 0
585        };
586        CC1IER { bits }
587    }
588    #[doc = "Bit 0 - Update interrupt enable"]
589    #[inline]
590    pub fn uie(&self) -> UIER {
591        UIER::_from({
592            const MASK: bool = true;
593            const OFFSET: u8 = 0;
594            ((self.bits >> OFFSET) & MASK as u32) != 0
595        })
596    }
597}
598impl W {
599    #[doc = r" Reset value of the register"]
600    #[inline]
601    pub fn reset_value() -> W {
602        W { bits: 0 }
603    }
604    #[doc = r" Writes raw bits to the register"]
605    #[inline]
606    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
607        self.bits = bits;
608        self
609    }
610    #[doc = "Bit 14 - Trigger DMA request enable"]
611    #[inline]
612    pub fn tde(&mut self) -> _TDEW {
613        _TDEW { w: self }
614    }
615    #[doc = "Bit 13 - COM DMA request enable"]
616    #[inline]
617    pub fn comde(&mut self) -> _COMDEW {
618        _COMDEW { w: self }
619    }
620    #[doc = "Bit 9 - Capture/Compare 1 DMA request enable"]
621    #[inline]
622    pub fn cc1de(&mut self) -> _CC1DEW {
623        _CC1DEW { w: self }
624    }
625    #[doc = "Bit 8 - Update DMA request enable"]
626    #[inline]
627    pub fn ude(&mut self) -> _UDEW {
628        _UDEW { w: self }
629    }
630    #[doc = "Bit 7 - Break interrupt enable"]
631    #[inline]
632    pub fn bie(&mut self) -> _BIEW {
633        _BIEW { w: self }
634    }
635    #[doc = "Bit 6 - Trigger interrupt enable"]
636    #[inline]
637    pub fn tie(&mut self) -> _TIEW {
638        _TIEW { w: self }
639    }
640    #[doc = "Bit 5 - COM interrupt enable"]
641    #[inline]
642    pub fn comie(&mut self) -> _COMIEW {
643        _COMIEW { w: self }
644    }
645    #[doc = "Bit 1 - Capture/Compare 1 interrupt enable"]
646    #[inline]
647    pub fn cc1ie(&mut self) -> _CC1IEW {
648        _CC1IEW { w: self }
649    }
650    #[doc = "Bit 0 - Update interrupt enable"]
651    #[inline]
652    pub fn uie(&mut self) -> _UIEW {
653        _UIEW { w: self }
654    }
655}