stm32l4x2_pac/tim1/
or2.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::OR2 {
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 BKINER {
47    bits: bool,
48}
49impl BKINER {
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 BKCMP1ER {
68    bits: bool,
69}
70impl BKCMP1ER {
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 BKCMP2ER {
89    bits: bool,
90}
91impl BKCMP2ER {
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 BKDFBK0ER {
110    bits: bool,
111}
112impl BKDFBK0ER {
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 BKINPR {
131    bits: bool,
132}
133impl BKINPR {
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 BKCMP1PR {
152    bits: bool,
153}
154impl BKCMP1PR {
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 BKCMP2PR {
173    bits: bool,
174}
175impl BKCMP2PR {
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 ETRSELR {
194    bits: u8,
195}
196impl ETRSELR {
197    #[doc = r" Value of the field as raw bits"]
198    #[inline]
199    pub fn bits(&self) -> u8 {
200        self.bits
201    }
202}
203#[doc = r" Proxy"]
204pub struct _BKINEW<'a> {
205    w: &'a mut W,
206}
207impl<'a> _BKINEW<'a> {
208    #[doc = r" Sets the field bit"]
209    pub fn set_bit(self) -> &'a mut W {
210        self.bit(true)
211    }
212    #[doc = r" Clears the field bit"]
213    pub fn clear_bit(self) -> &'a mut W {
214        self.bit(false)
215    }
216    #[doc = r" Writes raw bits to the field"]
217    #[inline]
218    pub fn bit(self, value: bool) -> &'a mut W {
219        const MASK: bool = true;
220        const OFFSET: u8 = 0;
221        self.w.bits &= !((MASK as u32) << OFFSET);
222        self.w.bits |= ((value & MASK) as u32) << OFFSET;
223        self.w
224    }
225}
226#[doc = r" Proxy"]
227pub struct _BKCMP1EW<'a> {
228    w: &'a mut W,
229}
230impl<'a> _BKCMP1EW<'a> {
231    #[doc = r" Sets the field bit"]
232    pub fn set_bit(self) -> &'a mut W {
233        self.bit(true)
234    }
235    #[doc = r" Clears the field bit"]
236    pub fn clear_bit(self) -> &'a mut W {
237        self.bit(false)
238    }
239    #[doc = r" Writes raw bits to the field"]
240    #[inline]
241    pub fn bit(self, value: bool) -> &'a mut W {
242        const MASK: bool = true;
243        const OFFSET: u8 = 1;
244        self.w.bits &= !((MASK as u32) << OFFSET);
245        self.w.bits |= ((value & MASK) as u32) << OFFSET;
246        self.w
247    }
248}
249#[doc = r" Proxy"]
250pub struct _BKCMP2EW<'a> {
251    w: &'a mut W,
252}
253impl<'a> _BKCMP2EW<'a> {
254    #[doc = r" Sets the field bit"]
255    pub fn set_bit(self) -> &'a mut W {
256        self.bit(true)
257    }
258    #[doc = r" Clears the field bit"]
259    pub fn clear_bit(self) -> &'a mut W {
260        self.bit(false)
261    }
262    #[doc = r" Writes raw bits to the field"]
263    #[inline]
264    pub fn bit(self, value: bool) -> &'a mut W {
265        const MASK: bool = true;
266        const OFFSET: u8 = 2;
267        self.w.bits &= !((MASK as u32) << OFFSET);
268        self.w.bits |= ((value & MASK) as u32) << OFFSET;
269        self.w
270    }
271}
272#[doc = r" Proxy"]
273pub struct _BKDFBK0EW<'a> {
274    w: &'a mut W,
275}
276impl<'a> _BKDFBK0EW<'a> {
277    #[doc = r" Sets the field bit"]
278    pub fn set_bit(self) -> &'a mut W {
279        self.bit(true)
280    }
281    #[doc = r" Clears the field bit"]
282    pub fn clear_bit(self) -> &'a mut W {
283        self.bit(false)
284    }
285    #[doc = r" Writes raw bits to the field"]
286    #[inline]
287    pub fn bit(self, value: bool) -> &'a mut W {
288        const MASK: bool = true;
289        const OFFSET: u8 = 8;
290        self.w.bits &= !((MASK as u32) << OFFSET);
291        self.w.bits |= ((value & MASK) as u32) << OFFSET;
292        self.w
293    }
294}
295#[doc = r" Proxy"]
296pub struct _BKINPW<'a> {
297    w: &'a mut W,
298}
299impl<'a> _BKINPW<'a> {
300    #[doc = r" Sets the field bit"]
301    pub fn set_bit(self) -> &'a mut W {
302        self.bit(true)
303    }
304    #[doc = r" Clears the field bit"]
305    pub fn clear_bit(self) -> &'a mut W {
306        self.bit(false)
307    }
308    #[doc = r" Writes raw bits to the field"]
309    #[inline]
310    pub fn bit(self, value: bool) -> &'a mut W {
311        const MASK: bool = true;
312        const OFFSET: u8 = 9;
313        self.w.bits &= !((MASK as u32) << OFFSET);
314        self.w.bits |= ((value & MASK) as u32) << OFFSET;
315        self.w
316    }
317}
318#[doc = r" Proxy"]
319pub struct _BKCMP1PW<'a> {
320    w: &'a mut W,
321}
322impl<'a> _BKCMP1PW<'a> {
323    #[doc = r" Sets the field bit"]
324    pub fn set_bit(self) -> &'a mut W {
325        self.bit(true)
326    }
327    #[doc = r" Clears the field bit"]
328    pub fn clear_bit(self) -> &'a mut W {
329        self.bit(false)
330    }
331    #[doc = r" Writes raw bits to the field"]
332    #[inline]
333    pub fn bit(self, value: bool) -> &'a mut W {
334        const MASK: bool = true;
335        const OFFSET: u8 = 10;
336        self.w.bits &= !((MASK as u32) << OFFSET);
337        self.w.bits |= ((value & MASK) as u32) << OFFSET;
338        self.w
339    }
340}
341#[doc = r" Proxy"]
342pub struct _BKCMP2PW<'a> {
343    w: &'a mut W,
344}
345impl<'a> _BKCMP2PW<'a> {
346    #[doc = r" Sets the field bit"]
347    pub fn set_bit(self) -> &'a mut W {
348        self.bit(true)
349    }
350    #[doc = r" Clears the field bit"]
351    pub fn clear_bit(self) -> &'a mut W {
352        self.bit(false)
353    }
354    #[doc = r" Writes raw bits to the field"]
355    #[inline]
356    pub fn bit(self, value: bool) -> &'a mut W {
357        const MASK: bool = true;
358        const OFFSET: u8 = 11;
359        self.w.bits &= !((MASK as u32) << OFFSET);
360        self.w.bits |= ((value & MASK) as u32) << OFFSET;
361        self.w
362    }
363}
364#[doc = r" Proxy"]
365pub struct _ETRSELW<'a> {
366    w: &'a mut W,
367}
368impl<'a> _ETRSELW<'a> {
369    #[doc = r" Writes raw bits to the field"]
370    #[inline]
371    pub unsafe fn bits(self, value: u8) -> &'a mut W {
372        const MASK: u8 = 7;
373        const OFFSET: u8 = 14;
374        self.w.bits &= !((MASK as u32) << OFFSET);
375        self.w.bits |= ((value & MASK) as u32) << OFFSET;
376        self.w
377    }
378}
379impl R {
380    #[doc = r" Value of the register as raw bits"]
381    #[inline]
382    pub fn bits(&self) -> u32 {
383        self.bits
384    }
385    #[doc = "Bit 0 - BRK BKIN input enable"]
386    #[inline]
387    pub fn bkine(&self) -> BKINER {
388        let bits = {
389            const MASK: bool = true;
390            const OFFSET: u8 = 0;
391            ((self.bits >> OFFSET) & MASK as u32) != 0
392        };
393        BKINER { bits }
394    }
395    #[doc = "Bit 1 - BRK COMP1 enable"]
396    #[inline]
397    pub fn bkcmp1e(&self) -> BKCMP1ER {
398        let bits = {
399            const MASK: bool = true;
400            const OFFSET: u8 = 1;
401            ((self.bits >> OFFSET) & MASK as u32) != 0
402        };
403        BKCMP1ER { bits }
404    }
405    #[doc = "Bit 2 - BRK COMP2 enable"]
406    #[inline]
407    pub fn bkcmp2e(&self) -> BKCMP2ER {
408        let bits = {
409            const MASK: bool = true;
410            const OFFSET: u8 = 2;
411            ((self.bits >> OFFSET) & MASK as u32) != 0
412        };
413        BKCMP2ER { bits }
414    }
415    #[doc = "Bit 8 - BRK DFSDM_BREAK0 enable"]
416    #[inline]
417    pub fn bkdfbk0e(&self) -> BKDFBK0ER {
418        let bits = {
419            const MASK: bool = true;
420            const OFFSET: u8 = 8;
421            ((self.bits >> OFFSET) & MASK as u32) != 0
422        };
423        BKDFBK0ER { bits }
424    }
425    #[doc = "Bit 9 - BRK BKIN input polarity"]
426    #[inline]
427    pub fn bkinp(&self) -> BKINPR {
428        let bits = {
429            const MASK: bool = true;
430            const OFFSET: u8 = 9;
431            ((self.bits >> OFFSET) & MASK as u32) != 0
432        };
433        BKINPR { bits }
434    }
435    #[doc = "Bit 10 - BRK COMP1 input polarity"]
436    #[inline]
437    pub fn bkcmp1p(&self) -> BKCMP1PR {
438        let bits = {
439            const MASK: bool = true;
440            const OFFSET: u8 = 10;
441            ((self.bits >> OFFSET) & MASK as u32) != 0
442        };
443        BKCMP1PR { bits }
444    }
445    #[doc = "Bit 11 - BRK COMP2 input polarity"]
446    #[inline]
447    pub fn bkcmp2p(&self) -> BKCMP2PR {
448        let bits = {
449            const MASK: bool = true;
450            const OFFSET: u8 = 11;
451            ((self.bits >> OFFSET) & MASK as u32) != 0
452        };
453        BKCMP2PR { bits }
454    }
455    #[doc = "Bits 14:16 - ETR source selection"]
456    #[inline]
457    pub fn etrsel(&self) -> ETRSELR {
458        let bits = {
459            const MASK: u8 = 7;
460            const OFFSET: u8 = 14;
461            ((self.bits >> OFFSET) & MASK as u32) as u8
462        };
463        ETRSELR { bits }
464    }
465}
466impl W {
467    #[doc = r" Reset value of the register"]
468    #[inline]
469    pub fn reset_value() -> W {
470        W { bits: 1 }
471    }
472    #[doc = r" Writes raw bits to the register"]
473    #[inline]
474    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
475        self.bits = bits;
476        self
477    }
478    #[doc = "Bit 0 - BRK BKIN input enable"]
479    #[inline]
480    pub fn bkine(&mut self) -> _BKINEW {
481        _BKINEW { w: self }
482    }
483    #[doc = "Bit 1 - BRK COMP1 enable"]
484    #[inline]
485    pub fn bkcmp1e(&mut self) -> _BKCMP1EW {
486        _BKCMP1EW { w: self }
487    }
488    #[doc = "Bit 2 - BRK COMP2 enable"]
489    #[inline]
490    pub fn bkcmp2e(&mut self) -> _BKCMP2EW {
491        _BKCMP2EW { w: self }
492    }
493    #[doc = "Bit 8 - BRK DFSDM_BREAK0 enable"]
494    #[inline]
495    pub fn bkdfbk0e(&mut self) -> _BKDFBK0EW {
496        _BKDFBK0EW { w: self }
497    }
498    #[doc = "Bit 9 - BRK BKIN input polarity"]
499    #[inline]
500    pub fn bkinp(&mut self) -> _BKINPW {
501        _BKINPW { w: self }
502    }
503    #[doc = "Bit 10 - BRK COMP1 input polarity"]
504    #[inline]
505    pub fn bkcmp1p(&mut self) -> _BKCMP1PW {
506        _BKCMP1PW { w: self }
507    }
508    #[doc = "Bit 11 - BRK COMP2 input polarity"]
509    #[inline]
510    pub fn bkcmp2p(&mut self) -> _BKCMP2PW {
511        _BKCMP2PW { w: self }
512    }
513    #[doc = "Bits 14:16 - ETR source selection"]
514    #[inline]
515    pub fn etrsel(&mut self) -> _ETRSELW {
516        _ETRSELW { w: self }
517    }
518}