stm32l4x2_pac/tim15/
bdtr.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::BDTR {
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 DTGR {
47    bits: u8,
48}
49impl DTGR {
50    #[doc = r" Value of the field as raw bits"]
51    #[inline]
52    pub fn bits(&self) -> u8 {
53        self.bits
54    }
55}
56#[doc = r" Value of the field"]
57pub struct LOCKR {
58    bits: u8,
59}
60impl LOCKR {
61    #[doc = r" Value of the field as raw bits"]
62    #[inline]
63    pub fn bits(&self) -> u8 {
64        self.bits
65    }
66}
67#[doc = r" Value of the field"]
68pub struct OSSIR {
69    bits: bool,
70}
71impl OSSIR {
72    #[doc = r" Value of the field as raw bits"]
73    #[inline]
74    pub fn bit(&self) -> bool {
75        self.bits
76    }
77    #[doc = r" Returns `true` if the bit is clear (0)"]
78    #[inline]
79    pub fn bit_is_clear(&self) -> bool {
80        !self.bit()
81    }
82    #[doc = r" Returns `true` if the bit is set (1)"]
83    #[inline]
84    pub fn bit_is_set(&self) -> bool {
85        self.bit()
86    }
87}
88#[doc = r" Value of the field"]
89pub struct OSSRR {
90    bits: bool,
91}
92impl OSSRR {
93    #[doc = r" Value of the field as raw bits"]
94    #[inline]
95    pub fn bit(&self) -> bool {
96        self.bits
97    }
98    #[doc = r" Returns `true` if the bit is clear (0)"]
99    #[inline]
100    pub fn bit_is_clear(&self) -> bool {
101        !self.bit()
102    }
103    #[doc = r" Returns `true` if the bit is set (1)"]
104    #[inline]
105    pub fn bit_is_set(&self) -> bool {
106        self.bit()
107    }
108}
109#[doc = r" Value of the field"]
110pub struct BKER {
111    bits: bool,
112}
113impl BKER {
114    #[doc = r" Value of the field as raw bits"]
115    #[inline]
116    pub fn bit(&self) -> bool {
117        self.bits
118    }
119    #[doc = r" Returns `true` if the bit is clear (0)"]
120    #[inline]
121    pub fn bit_is_clear(&self) -> bool {
122        !self.bit()
123    }
124    #[doc = r" Returns `true` if the bit is set (1)"]
125    #[inline]
126    pub fn bit_is_set(&self) -> bool {
127        self.bit()
128    }
129}
130#[doc = r" Value of the field"]
131pub struct BKPR {
132    bits: bool,
133}
134impl BKPR {
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 AOER {
153    bits: bool,
154}
155impl AOER {
156    #[doc = r" Value of the field as raw bits"]
157    #[inline]
158    pub fn bit(&self) -> bool {
159        self.bits
160    }
161    #[doc = r" Returns `true` if the bit is clear (0)"]
162    #[inline]
163    pub fn bit_is_clear(&self) -> bool {
164        !self.bit()
165    }
166    #[doc = r" Returns `true` if the bit is set (1)"]
167    #[inline]
168    pub fn bit_is_set(&self) -> bool {
169        self.bit()
170    }
171}
172#[doc = r" Value of the field"]
173pub struct MOER {
174    bits: bool,
175}
176impl MOER {
177    #[doc = r" Value of the field as raw bits"]
178    #[inline]
179    pub fn bit(&self) -> bool {
180        self.bits
181    }
182    #[doc = r" Returns `true` if the bit is clear (0)"]
183    #[inline]
184    pub fn bit_is_clear(&self) -> bool {
185        !self.bit()
186    }
187    #[doc = r" Returns `true` if the bit is set (1)"]
188    #[inline]
189    pub fn bit_is_set(&self) -> bool {
190        self.bit()
191    }
192}
193#[doc = r" Value of the field"]
194pub struct BKFR {
195    bits: u8,
196}
197impl BKFR {
198    #[doc = r" Value of the field as raw bits"]
199    #[inline]
200    pub fn bits(&self) -> u8 {
201        self.bits
202    }
203}
204#[doc = r" Proxy"]
205pub struct _DTGW<'a> {
206    w: &'a mut W,
207}
208impl<'a> _DTGW<'a> {
209    #[doc = r" Writes raw bits to the field"]
210    #[inline]
211    pub unsafe fn bits(self, value: u8) -> &'a mut W {
212        const MASK: u8 = 255;
213        const OFFSET: u8 = 0;
214        self.w.bits &= !((MASK as u32) << OFFSET);
215        self.w.bits |= ((value & MASK) as u32) << OFFSET;
216        self.w
217    }
218}
219#[doc = r" Proxy"]
220pub struct _LOCKW<'a> {
221    w: &'a mut W,
222}
223impl<'a> _LOCKW<'a> {
224    #[doc = r" Writes raw bits to the field"]
225    #[inline]
226    pub unsafe fn bits(self, value: u8) -> &'a mut W {
227        const MASK: u8 = 3;
228        const OFFSET: u8 = 8;
229        self.w.bits &= !((MASK as u32) << OFFSET);
230        self.w.bits |= ((value & MASK) as u32) << OFFSET;
231        self.w
232    }
233}
234#[doc = r" Proxy"]
235pub struct _OSSIW<'a> {
236    w: &'a mut W,
237}
238impl<'a> _OSSIW<'a> {
239    #[doc = r" Sets the field bit"]
240    pub fn set_bit(self) -> &'a mut W {
241        self.bit(true)
242    }
243    #[doc = r" Clears the field bit"]
244    pub fn clear_bit(self) -> &'a mut W {
245        self.bit(false)
246    }
247    #[doc = r" Writes raw bits to the field"]
248    #[inline]
249    pub fn bit(self, value: bool) -> &'a mut W {
250        const MASK: bool = true;
251        const OFFSET: u8 = 10;
252        self.w.bits &= !((MASK as u32) << OFFSET);
253        self.w.bits |= ((value & MASK) as u32) << OFFSET;
254        self.w
255    }
256}
257#[doc = r" Proxy"]
258pub struct _OSSRW<'a> {
259    w: &'a mut W,
260}
261impl<'a> _OSSRW<'a> {
262    #[doc = r" Sets the field bit"]
263    pub fn set_bit(self) -> &'a mut W {
264        self.bit(true)
265    }
266    #[doc = r" Clears the field bit"]
267    pub fn clear_bit(self) -> &'a mut W {
268        self.bit(false)
269    }
270    #[doc = r" Writes raw bits to the field"]
271    #[inline]
272    pub fn bit(self, value: bool) -> &'a mut W {
273        const MASK: bool = true;
274        const OFFSET: u8 = 11;
275        self.w.bits &= !((MASK as u32) << OFFSET);
276        self.w.bits |= ((value & MASK) as u32) << OFFSET;
277        self.w
278    }
279}
280#[doc = r" Proxy"]
281pub struct _BKEW<'a> {
282    w: &'a mut W,
283}
284impl<'a> _BKEW<'a> {
285    #[doc = r" Sets the field bit"]
286    pub fn set_bit(self) -> &'a mut W {
287        self.bit(true)
288    }
289    #[doc = r" Clears the field bit"]
290    pub fn clear_bit(self) -> &'a mut W {
291        self.bit(false)
292    }
293    #[doc = r" Writes raw bits to the field"]
294    #[inline]
295    pub fn bit(self, value: bool) -> &'a mut W {
296        const MASK: bool = true;
297        const OFFSET: u8 = 12;
298        self.w.bits &= !((MASK as u32) << OFFSET);
299        self.w.bits |= ((value & MASK) as u32) << OFFSET;
300        self.w
301    }
302}
303#[doc = r" Proxy"]
304pub struct _BKPW<'a> {
305    w: &'a mut W,
306}
307impl<'a> _BKPW<'a> {
308    #[doc = r" Sets the field bit"]
309    pub fn set_bit(self) -> &'a mut W {
310        self.bit(true)
311    }
312    #[doc = r" Clears the field bit"]
313    pub fn clear_bit(self) -> &'a mut W {
314        self.bit(false)
315    }
316    #[doc = r" Writes raw bits to the field"]
317    #[inline]
318    pub fn bit(self, value: bool) -> &'a mut W {
319        const MASK: bool = true;
320        const OFFSET: u8 = 13;
321        self.w.bits &= !((MASK as u32) << OFFSET);
322        self.w.bits |= ((value & MASK) as u32) << OFFSET;
323        self.w
324    }
325}
326#[doc = r" Proxy"]
327pub struct _AOEW<'a> {
328    w: &'a mut W,
329}
330impl<'a> _AOEW<'a> {
331    #[doc = r" Sets the field bit"]
332    pub fn set_bit(self) -> &'a mut W {
333        self.bit(true)
334    }
335    #[doc = r" Clears the field bit"]
336    pub fn clear_bit(self) -> &'a mut W {
337        self.bit(false)
338    }
339    #[doc = r" Writes raw bits to the field"]
340    #[inline]
341    pub fn bit(self, value: bool) -> &'a mut W {
342        const MASK: bool = true;
343        const OFFSET: u8 = 14;
344        self.w.bits &= !((MASK as u32) << OFFSET);
345        self.w.bits |= ((value & MASK) as u32) << OFFSET;
346        self.w
347    }
348}
349#[doc = r" Proxy"]
350pub struct _MOEW<'a> {
351    w: &'a mut W,
352}
353impl<'a> _MOEW<'a> {
354    #[doc = r" Sets the field bit"]
355    pub fn set_bit(self) -> &'a mut W {
356        self.bit(true)
357    }
358    #[doc = r" Clears the field bit"]
359    pub fn clear_bit(self) -> &'a mut W {
360        self.bit(false)
361    }
362    #[doc = r" Writes raw bits to the field"]
363    #[inline]
364    pub fn bit(self, value: bool) -> &'a mut W {
365        const MASK: bool = true;
366        const OFFSET: u8 = 15;
367        self.w.bits &= !((MASK as u32) << OFFSET);
368        self.w.bits |= ((value & MASK) as u32) << OFFSET;
369        self.w
370    }
371}
372#[doc = r" Proxy"]
373pub struct _BKFW<'a> {
374    w: &'a mut W,
375}
376impl<'a> _BKFW<'a> {
377    #[doc = r" Writes raw bits to the field"]
378    #[inline]
379    pub unsafe fn bits(self, value: u8) -> &'a mut W {
380        const MASK: u8 = 15;
381        const OFFSET: u8 = 16;
382        self.w.bits &= !((MASK as u32) << OFFSET);
383        self.w.bits |= ((value & MASK) as u32) << OFFSET;
384        self.w
385    }
386}
387impl R {
388    #[doc = r" Value of the register as raw bits"]
389    #[inline]
390    pub fn bits(&self) -> u32 {
391        self.bits
392    }
393    #[doc = "Bits 0:7 - Dead-time generator setup"]
394    #[inline]
395    pub fn dtg(&self) -> DTGR {
396        let bits = {
397            const MASK: u8 = 255;
398            const OFFSET: u8 = 0;
399            ((self.bits >> OFFSET) & MASK as u32) as u8
400        };
401        DTGR { bits }
402    }
403    #[doc = "Bits 8:9 - Lock configuration"]
404    #[inline]
405    pub fn lock(&self) -> LOCKR {
406        let bits = {
407            const MASK: u8 = 3;
408            const OFFSET: u8 = 8;
409            ((self.bits >> OFFSET) & MASK as u32) as u8
410        };
411        LOCKR { bits }
412    }
413    #[doc = "Bit 10 - Off-state selection for Idle mode"]
414    #[inline]
415    pub fn ossi(&self) -> OSSIR {
416        let bits = {
417            const MASK: bool = true;
418            const OFFSET: u8 = 10;
419            ((self.bits >> OFFSET) & MASK as u32) != 0
420        };
421        OSSIR { bits }
422    }
423    #[doc = "Bit 11 - Off-state selection for Run mode"]
424    #[inline]
425    pub fn ossr(&self) -> OSSRR {
426        let bits = {
427            const MASK: bool = true;
428            const OFFSET: u8 = 11;
429            ((self.bits >> OFFSET) & MASK as u32) != 0
430        };
431        OSSRR { bits }
432    }
433    #[doc = "Bit 12 - Break enable"]
434    #[inline]
435    pub fn bke(&self) -> BKER {
436        let bits = {
437            const MASK: bool = true;
438            const OFFSET: u8 = 12;
439            ((self.bits >> OFFSET) & MASK as u32) != 0
440        };
441        BKER { bits }
442    }
443    #[doc = "Bit 13 - Break polarity"]
444    #[inline]
445    pub fn bkp(&self) -> BKPR {
446        let bits = {
447            const MASK: bool = true;
448            const OFFSET: u8 = 13;
449            ((self.bits >> OFFSET) & MASK as u32) != 0
450        };
451        BKPR { bits }
452    }
453    #[doc = "Bit 14 - Automatic output enable"]
454    #[inline]
455    pub fn aoe(&self) -> AOER {
456        let bits = {
457            const MASK: bool = true;
458            const OFFSET: u8 = 14;
459            ((self.bits >> OFFSET) & MASK as u32) != 0
460        };
461        AOER { bits }
462    }
463    #[doc = "Bit 15 - Main output enable"]
464    #[inline]
465    pub fn moe(&self) -> MOER {
466        let bits = {
467            const MASK: bool = true;
468            const OFFSET: u8 = 15;
469            ((self.bits >> OFFSET) & MASK as u32) != 0
470        };
471        MOER { bits }
472    }
473    #[doc = "Bits 16:19 - Break filter"]
474    #[inline]
475    pub fn bkf(&self) -> BKFR {
476        let bits = {
477            const MASK: u8 = 15;
478            const OFFSET: u8 = 16;
479            ((self.bits >> OFFSET) & MASK as u32) as u8
480        };
481        BKFR { bits }
482    }
483}
484impl W {
485    #[doc = r" Reset value of the register"]
486    #[inline]
487    pub fn reset_value() -> W {
488        W { bits: 0 }
489    }
490    #[doc = r" Writes raw bits to the register"]
491    #[inline]
492    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
493        self.bits = bits;
494        self
495    }
496    #[doc = "Bits 0:7 - Dead-time generator setup"]
497    #[inline]
498    pub fn dtg(&mut self) -> _DTGW {
499        _DTGW { w: self }
500    }
501    #[doc = "Bits 8:9 - Lock configuration"]
502    #[inline]
503    pub fn lock(&mut self) -> _LOCKW {
504        _LOCKW { w: self }
505    }
506    #[doc = "Bit 10 - Off-state selection for Idle mode"]
507    #[inline]
508    pub fn ossi(&mut self) -> _OSSIW {
509        _OSSIW { w: self }
510    }
511    #[doc = "Bit 11 - Off-state selection for Run mode"]
512    #[inline]
513    pub fn ossr(&mut self) -> _OSSRW {
514        _OSSRW { w: self }
515    }
516    #[doc = "Bit 12 - Break enable"]
517    #[inline]
518    pub fn bke(&mut self) -> _BKEW {
519        _BKEW { w: self }
520    }
521    #[doc = "Bit 13 - Break polarity"]
522    #[inline]
523    pub fn bkp(&mut self) -> _BKPW {
524        _BKPW { w: self }
525    }
526    #[doc = "Bit 14 - Automatic output enable"]
527    #[inline]
528    pub fn aoe(&mut self) -> _AOEW {
529        _AOEW { w: self }
530    }
531    #[doc = "Bit 15 - Main output enable"]
532    #[inline]
533    pub fn moe(&mut self) -> _MOEW {
534        _MOEW { w: self }
535    }
536    #[doc = "Bits 16:19 - Break filter"]
537    #[inline]
538    pub fn bkf(&mut self) -> _BKFW {
539        _BKFW { w: self }
540    }
541}