stm32l4x2_pac/tim1/
bdtr.rs1#[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 MOER {
47 bits: bool,
48}
49impl MOER {
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 AOER {
68 bits: bool,
69}
70impl AOER {
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 BKPR {
89 bits: bool,
90}
91impl BKPR {
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 BKER {
110 bits: bool,
111}
112impl BKER {
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 OSSRR {
131 bits: bool,
132}
133impl OSSRR {
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 OSSIR {
152 bits: bool,
153}
154impl OSSIR {
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 LOCKR {
173 bits: u8,
174}
175impl LOCKR {
176 #[doc = r" Value of the field as raw bits"]
177 #[inline]
178 pub fn bits(&self) -> u8 {
179 self.bits
180 }
181}
182#[doc = r" Value of the field"]
183pub struct DTGR {
184 bits: u8,
185}
186impl DTGR {
187 #[doc = r" Value of the field as raw bits"]
188 #[inline]
189 pub fn bits(&self) -> u8 {
190 self.bits
191 }
192}
193#[doc = r" Proxy"]
194pub struct _MOEW<'a> {
195 w: &'a mut W,
196}
197impl<'a> _MOEW<'a> {
198 #[doc = r" Sets the field bit"]
199 pub fn set_bit(self) -> &'a mut W {
200 self.bit(true)
201 }
202 #[doc = r" Clears the field bit"]
203 pub fn clear_bit(self) -> &'a mut W {
204 self.bit(false)
205 }
206 #[doc = r" Writes raw bits to the field"]
207 #[inline]
208 pub fn bit(self, value: bool) -> &'a mut W {
209 const MASK: bool = true;
210 const OFFSET: u8 = 15;
211 self.w.bits &= !((MASK as u32) << OFFSET);
212 self.w.bits |= ((value & MASK) as u32) << OFFSET;
213 self.w
214 }
215}
216#[doc = r" Proxy"]
217pub struct _AOEW<'a> {
218 w: &'a mut W,
219}
220impl<'a> _AOEW<'a> {
221 #[doc = r" Sets the field bit"]
222 pub fn set_bit(self) -> &'a mut W {
223 self.bit(true)
224 }
225 #[doc = r" Clears the field bit"]
226 pub fn clear_bit(self) -> &'a mut W {
227 self.bit(false)
228 }
229 #[doc = r" Writes raw bits to the field"]
230 #[inline]
231 pub fn bit(self, value: bool) -> &'a mut W {
232 const MASK: bool = true;
233 const OFFSET: u8 = 14;
234 self.w.bits &= !((MASK as u32) << OFFSET);
235 self.w.bits |= ((value & MASK) as u32) << OFFSET;
236 self.w
237 }
238}
239#[doc = r" Proxy"]
240pub struct _BKPW<'a> {
241 w: &'a mut W,
242}
243impl<'a> _BKPW<'a> {
244 #[doc = r" Sets the field bit"]
245 pub fn set_bit(self) -> &'a mut W {
246 self.bit(true)
247 }
248 #[doc = r" Clears the field bit"]
249 pub fn clear_bit(self) -> &'a mut W {
250 self.bit(false)
251 }
252 #[doc = r" Writes raw bits to the field"]
253 #[inline]
254 pub fn bit(self, value: bool) -> &'a mut W {
255 const MASK: bool = true;
256 const OFFSET: u8 = 13;
257 self.w.bits &= !((MASK as u32) << OFFSET);
258 self.w.bits |= ((value & MASK) as u32) << OFFSET;
259 self.w
260 }
261}
262#[doc = r" Proxy"]
263pub struct _BKEW<'a> {
264 w: &'a mut W,
265}
266impl<'a> _BKEW<'a> {
267 #[doc = r" Sets the field bit"]
268 pub fn set_bit(self) -> &'a mut W {
269 self.bit(true)
270 }
271 #[doc = r" Clears the field bit"]
272 pub fn clear_bit(self) -> &'a mut W {
273 self.bit(false)
274 }
275 #[doc = r" Writes raw bits to the field"]
276 #[inline]
277 pub fn bit(self, value: bool) -> &'a mut W {
278 const MASK: bool = true;
279 const OFFSET: u8 = 12;
280 self.w.bits &= !((MASK as u32) << OFFSET);
281 self.w.bits |= ((value & MASK) as u32) << OFFSET;
282 self.w
283 }
284}
285#[doc = r" Proxy"]
286pub struct _OSSRW<'a> {
287 w: &'a mut W,
288}
289impl<'a> _OSSRW<'a> {
290 #[doc = r" Sets the field bit"]
291 pub fn set_bit(self) -> &'a mut W {
292 self.bit(true)
293 }
294 #[doc = r" Clears the field bit"]
295 pub fn clear_bit(self) -> &'a mut W {
296 self.bit(false)
297 }
298 #[doc = r" Writes raw bits to the field"]
299 #[inline]
300 pub fn bit(self, value: bool) -> &'a mut W {
301 const MASK: bool = true;
302 const OFFSET: u8 = 11;
303 self.w.bits &= !((MASK as u32) << OFFSET);
304 self.w.bits |= ((value & MASK) as u32) << OFFSET;
305 self.w
306 }
307}
308#[doc = r" Proxy"]
309pub struct _OSSIW<'a> {
310 w: &'a mut W,
311}
312impl<'a> _OSSIW<'a> {
313 #[doc = r" Sets the field bit"]
314 pub fn set_bit(self) -> &'a mut W {
315 self.bit(true)
316 }
317 #[doc = r" Clears the field bit"]
318 pub fn clear_bit(self) -> &'a mut W {
319 self.bit(false)
320 }
321 #[doc = r" Writes raw bits to the field"]
322 #[inline]
323 pub fn bit(self, value: bool) -> &'a mut W {
324 const MASK: bool = true;
325 const OFFSET: u8 = 10;
326 self.w.bits &= !((MASK as u32) << OFFSET);
327 self.w.bits |= ((value & MASK) as u32) << OFFSET;
328 self.w
329 }
330}
331#[doc = r" Proxy"]
332pub struct _LOCKW<'a> {
333 w: &'a mut W,
334}
335impl<'a> _LOCKW<'a> {
336 #[doc = r" Writes raw bits to the field"]
337 #[inline]
338 pub unsafe fn bits(self, value: u8) -> &'a mut W {
339 const MASK: u8 = 3;
340 const OFFSET: u8 = 8;
341 self.w.bits &= !((MASK as u32) << OFFSET);
342 self.w.bits |= ((value & MASK) as u32) << OFFSET;
343 self.w
344 }
345}
346#[doc = r" Proxy"]
347pub struct _DTGW<'a> {
348 w: &'a mut W,
349}
350impl<'a> _DTGW<'a> {
351 #[doc = r" Writes raw bits to the field"]
352 #[inline]
353 pub unsafe fn bits(self, value: u8) -> &'a mut W {
354 const MASK: u8 = 255;
355 const OFFSET: u8 = 0;
356 self.w.bits &= !((MASK as u32) << OFFSET);
357 self.w.bits |= ((value & MASK) as u32) << OFFSET;
358 self.w
359 }
360}
361impl R {
362 #[doc = r" Value of the register as raw bits"]
363 #[inline]
364 pub fn bits(&self) -> u32 {
365 self.bits
366 }
367 #[doc = "Bit 15 - Main output enable"]
368 #[inline]
369 pub fn moe(&self) -> MOER {
370 let bits = {
371 const MASK: bool = true;
372 const OFFSET: u8 = 15;
373 ((self.bits >> OFFSET) & MASK as u32) != 0
374 };
375 MOER { bits }
376 }
377 #[doc = "Bit 14 - Automatic output enable"]
378 #[inline]
379 pub fn aoe(&self) -> AOER {
380 let bits = {
381 const MASK: bool = true;
382 const OFFSET: u8 = 14;
383 ((self.bits >> OFFSET) & MASK as u32) != 0
384 };
385 AOER { bits }
386 }
387 #[doc = "Bit 13 - Break polarity"]
388 #[inline]
389 pub fn bkp(&self) -> BKPR {
390 let bits = {
391 const MASK: bool = true;
392 const OFFSET: u8 = 13;
393 ((self.bits >> OFFSET) & MASK as u32) != 0
394 };
395 BKPR { bits }
396 }
397 #[doc = "Bit 12 - Break enable"]
398 #[inline]
399 pub fn bke(&self) -> BKER {
400 let bits = {
401 const MASK: bool = true;
402 const OFFSET: u8 = 12;
403 ((self.bits >> OFFSET) & MASK as u32) != 0
404 };
405 BKER { bits }
406 }
407 #[doc = "Bit 11 - Off-state selection for Run mode"]
408 #[inline]
409 pub fn ossr(&self) -> OSSRR {
410 let bits = {
411 const MASK: bool = true;
412 const OFFSET: u8 = 11;
413 ((self.bits >> OFFSET) & MASK as u32) != 0
414 };
415 OSSRR { bits }
416 }
417 #[doc = "Bit 10 - Off-state selection for Idle mode"]
418 #[inline]
419 pub fn ossi(&self) -> OSSIR {
420 let bits = {
421 const MASK: bool = true;
422 const OFFSET: u8 = 10;
423 ((self.bits >> OFFSET) & MASK as u32) != 0
424 };
425 OSSIR { bits }
426 }
427 #[doc = "Bits 8:9 - Lock configuration"]
428 #[inline]
429 pub fn lock(&self) -> LOCKR {
430 let bits = {
431 const MASK: u8 = 3;
432 const OFFSET: u8 = 8;
433 ((self.bits >> OFFSET) & MASK as u32) as u8
434 };
435 LOCKR { bits }
436 }
437 #[doc = "Bits 0:7 - Dead-time generator setup"]
438 #[inline]
439 pub fn dtg(&self) -> DTGR {
440 let bits = {
441 const MASK: u8 = 255;
442 const OFFSET: u8 = 0;
443 ((self.bits >> OFFSET) & MASK as u32) as u8
444 };
445 DTGR { bits }
446 }
447}
448impl W {
449 #[doc = r" Reset value of the register"]
450 #[inline]
451 pub fn reset_value() -> W {
452 W { bits: 0 }
453 }
454 #[doc = r" Writes raw bits to the register"]
455 #[inline]
456 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
457 self.bits = bits;
458 self
459 }
460 #[doc = "Bit 15 - Main output enable"]
461 #[inline]
462 pub fn moe(&mut self) -> _MOEW {
463 _MOEW { w: self }
464 }
465 #[doc = "Bit 14 - Automatic output enable"]
466 #[inline]
467 pub fn aoe(&mut self) -> _AOEW {
468 _AOEW { w: self }
469 }
470 #[doc = "Bit 13 - Break polarity"]
471 #[inline]
472 pub fn bkp(&mut self) -> _BKPW {
473 _BKPW { w: self }
474 }
475 #[doc = "Bit 12 - Break enable"]
476 #[inline]
477 pub fn bke(&mut self) -> _BKEW {
478 _BKEW { w: self }
479 }
480 #[doc = "Bit 11 - Off-state selection for Run mode"]
481 #[inline]
482 pub fn ossr(&mut self) -> _OSSRW {
483 _OSSRW { w: self }
484 }
485 #[doc = "Bit 10 - Off-state selection for Idle mode"]
486 #[inline]
487 pub fn ossi(&mut self) -> _OSSIW {
488 _OSSIW { w: self }
489 }
490 #[doc = "Bits 8:9 - Lock configuration"]
491 #[inline]
492 pub fn lock(&mut self) -> _LOCKW {
493 _LOCKW { w: self }
494 }
495 #[doc = "Bits 0:7 - Dead-time generator setup"]
496 #[inline]
497 pub fn dtg(&mut self) -> _DTGW {
498 _DTGW { w: self }
499 }
500}