stm32l4x2_pac/rcc/
bdcr.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::BDCR {
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 LSCOSELR {
47 bits: bool,
48}
49impl LSCOSELR {
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 LSCOENR {
68 bits: bool,
69}
70impl LSCOENR {
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 BDRSTR {
89 bits: bool,
90}
91impl BDRSTR {
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 RTCENR {
110 bits: bool,
111}
112impl RTCENR {
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 RTCSELR {
131 bits: u8,
132}
133impl RTCSELR {
134 #[doc = r" Value of the field as raw bits"]
135 #[inline]
136 pub fn bits(&self) -> u8 {
137 self.bits
138 }
139}
140#[doc = r" Value of the field"]
141pub struct LSECSSDR {
142 bits: bool,
143}
144impl LSECSSDR {
145 #[doc = r" Value of the field as raw bits"]
146 #[inline]
147 pub fn bit(&self) -> bool {
148 self.bits
149 }
150 #[doc = r" Returns `true` if the bit is clear (0)"]
151 #[inline]
152 pub fn bit_is_clear(&self) -> bool {
153 !self.bit()
154 }
155 #[doc = r" Returns `true` if the bit is set (1)"]
156 #[inline]
157 pub fn bit_is_set(&self) -> bool {
158 self.bit()
159 }
160}
161#[doc = r" Value of the field"]
162pub struct LSECSSONR {
163 bits: bool,
164}
165impl LSECSSONR {
166 #[doc = r" Value of the field as raw bits"]
167 #[inline]
168 pub fn bit(&self) -> bool {
169 self.bits
170 }
171 #[doc = r" Returns `true` if the bit is clear (0)"]
172 #[inline]
173 pub fn bit_is_clear(&self) -> bool {
174 !self.bit()
175 }
176 #[doc = r" Returns `true` if the bit is set (1)"]
177 #[inline]
178 pub fn bit_is_set(&self) -> bool {
179 self.bit()
180 }
181}
182#[doc = r" Value of the field"]
183pub struct LSEDRVR {
184 bits: u8,
185}
186impl LSEDRVR {
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" Value of the field"]
194pub struct LSEBYPR {
195 bits: bool,
196}
197impl LSEBYPR {
198 #[doc = r" Value of the field as raw bits"]
199 #[inline]
200 pub fn bit(&self) -> bool {
201 self.bits
202 }
203 #[doc = r" Returns `true` if the bit is clear (0)"]
204 #[inline]
205 pub fn bit_is_clear(&self) -> bool {
206 !self.bit()
207 }
208 #[doc = r" Returns `true` if the bit is set (1)"]
209 #[inline]
210 pub fn bit_is_set(&self) -> bool {
211 self.bit()
212 }
213}
214#[doc = r" Value of the field"]
215pub struct LSERDYR {
216 bits: bool,
217}
218impl LSERDYR {
219 #[doc = r" Value of the field as raw bits"]
220 #[inline]
221 pub fn bit(&self) -> bool {
222 self.bits
223 }
224 #[doc = r" Returns `true` if the bit is clear (0)"]
225 #[inline]
226 pub fn bit_is_clear(&self) -> bool {
227 !self.bit()
228 }
229 #[doc = r" Returns `true` if the bit is set (1)"]
230 #[inline]
231 pub fn bit_is_set(&self) -> bool {
232 self.bit()
233 }
234}
235#[doc = r" Value of the field"]
236pub struct LSEONR {
237 bits: bool,
238}
239impl LSEONR {
240 #[doc = r" Value of the field as raw bits"]
241 #[inline]
242 pub fn bit(&self) -> bool {
243 self.bits
244 }
245 #[doc = r" Returns `true` if the bit is clear (0)"]
246 #[inline]
247 pub fn bit_is_clear(&self) -> bool {
248 !self.bit()
249 }
250 #[doc = r" Returns `true` if the bit is set (1)"]
251 #[inline]
252 pub fn bit_is_set(&self) -> bool {
253 self.bit()
254 }
255}
256#[doc = r" Proxy"]
257pub struct _LSCOSELW<'a> {
258 w: &'a mut W,
259}
260impl<'a> _LSCOSELW<'a> {
261 #[doc = r" Sets the field bit"]
262 pub fn set_bit(self) -> &'a mut W {
263 self.bit(true)
264 }
265 #[doc = r" Clears the field bit"]
266 pub fn clear_bit(self) -> &'a mut W {
267 self.bit(false)
268 }
269 #[doc = r" Writes raw bits to the field"]
270 #[inline]
271 pub fn bit(self, value: bool) -> &'a mut W {
272 const MASK: bool = true;
273 const OFFSET: u8 = 25;
274 self.w.bits &= !((MASK as u32) << OFFSET);
275 self.w.bits |= ((value & MASK) as u32) << OFFSET;
276 self.w
277 }
278}
279#[doc = r" Proxy"]
280pub struct _LSCOENW<'a> {
281 w: &'a mut W,
282}
283impl<'a> _LSCOENW<'a> {
284 #[doc = r" Sets the field bit"]
285 pub fn set_bit(self) -> &'a mut W {
286 self.bit(true)
287 }
288 #[doc = r" Clears the field bit"]
289 pub fn clear_bit(self) -> &'a mut W {
290 self.bit(false)
291 }
292 #[doc = r" Writes raw bits to the field"]
293 #[inline]
294 pub fn bit(self, value: bool) -> &'a mut W {
295 const MASK: bool = true;
296 const OFFSET: u8 = 24;
297 self.w.bits &= !((MASK as u32) << OFFSET);
298 self.w.bits |= ((value & MASK) as u32) << OFFSET;
299 self.w
300 }
301}
302#[doc = r" Proxy"]
303pub struct _BDRSTW<'a> {
304 w: &'a mut W,
305}
306impl<'a> _BDRSTW<'a> {
307 #[doc = r" Sets the field bit"]
308 pub fn set_bit(self) -> &'a mut W {
309 self.bit(true)
310 }
311 #[doc = r" Clears the field bit"]
312 pub fn clear_bit(self) -> &'a mut W {
313 self.bit(false)
314 }
315 #[doc = r" Writes raw bits to the field"]
316 #[inline]
317 pub fn bit(self, value: bool) -> &'a mut W {
318 const MASK: bool = true;
319 const OFFSET: u8 = 16;
320 self.w.bits &= !((MASK as u32) << OFFSET);
321 self.w.bits |= ((value & MASK) as u32) << OFFSET;
322 self.w
323 }
324}
325#[doc = r" Proxy"]
326pub struct _RTCENW<'a> {
327 w: &'a mut W,
328}
329impl<'a> _RTCENW<'a> {
330 #[doc = r" Sets the field bit"]
331 pub fn set_bit(self) -> &'a mut W {
332 self.bit(true)
333 }
334 #[doc = r" Clears the field bit"]
335 pub fn clear_bit(self) -> &'a mut W {
336 self.bit(false)
337 }
338 #[doc = r" Writes raw bits to the field"]
339 #[inline]
340 pub fn bit(self, value: bool) -> &'a mut W {
341 const MASK: bool = true;
342 const OFFSET: u8 = 15;
343 self.w.bits &= !((MASK as u32) << OFFSET);
344 self.w.bits |= ((value & MASK) as u32) << OFFSET;
345 self.w
346 }
347}
348#[doc = r" Proxy"]
349pub struct _RTCSELW<'a> {
350 w: &'a mut W,
351}
352impl<'a> _RTCSELW<'a> {
353 #[doc = r" Writes raw bits to the field"]
354 #[inline]
355 pub unsafe fn bits(self, value: u8) -> &'a mut W {
356 const MASK: u8 = 3;
357 const OFFSET: u8 = 8;
358 self.w.bits &= !((MASK as u32) << OFFSET);
359 self.w.bits |= ((value & MASK) as u32) << OFFSET;
360 self.w
361 }
362}
363#[doc = r" Proxy"]
364pub struct _LSECSSONW<'a> {
365 w: &'a mut W,
366}
367impl<'a> _LSECSSONW<'a> {
368 #[doc = r" Sets the field bit"]
369 pub fn set_bit(self) -> &'a mut W {
370 self.bit(true)
371 }
372 #[doc = r" Clears the field bit"]
373 pub fn clear_bit(self) -> &'a mut W {
374 self.bit(false)
375 }
376 #[doc = r" Writes raw bits to the field"]
377 #[inline]
378 pub fn bit(self, value: bool) -> &'a mut W {
379 const MASK: bool = true;
380 const OFFSET: u8 = 5;
381 self.w.bits &= !((MASK as u32) << OFFSET);
382 self.w.bits |= ((value & MASK) as u32) << OFFSET;
383 self.w
384 }
385}
386#[doc = r" Proxy"]
387pub struct _LSEDRVW<'a> {
388 w: &'a mut W,
389}
390impl<'a> _LSEDRVW<'a> {
391 #[doc = r" Writes raw bits to the field"]
392 #[inline]
393 pub unsafe fn bits(self, value: u8) -> &'a mut W {
394 const MASK: u8 = 3;
395 const OFFSET: u8 = 3;
396 self.w.bits &= !((MASK as u32) << OFFSET);
397 self.w.bits |= ((value & MASK) as u32) << OFFSET;
398 self.w
399 }
400}
401#[doc = r" Proxy"]
402pub struct _LSEBYPW<'a> {
403 w: &'a mut W,
404}
405impl<'a> _LSEBYPW<'a> {
406 #[doc = r" Sets the field bit"]
407 pub fn set_bit(self) -> &'a mut W {
408 self.bit(true)
409 }
410 #[doc = r" Clears the field bit"]
411 pub fn clear_bit(self) -> &'a mut W {
412 self.bit(false)
413 }
414 #[doc = r" Writes raw bits to the field"]
415 #[inline]
416 pub fn bit(self, value: bool) -> &'a mut W {
417 const MASK: bool = true;
418 const OFFSET: u8 = 2;
419 self.w.bits &= !((MASK as u32) << OFFSET);
420 self.w.bits |= ((value & MASK) as u32) << OFFSET;
421 self.w
422 }
423}
424#[doc = r" Proxy"]
425pub struct _LSEONW<'a> {
426 w: &'a mut W,
427}
428impl<'a> _LSEONW<'a> {
429 #[doc = r" Sets the field bit"]
430 pub fn set_bit(self) -> &'a mut W {
431 self.bit(true)
432 }
433 #[doc = r" Clears the field bit"]
434 pub fn clear_bit(self) -> &'a mut W {
435 self.bit(false)
436 }
437 #[doc = r" Writes raw bits to the field"]
438 #[inline]
439 pub fn bit(self, value: bool) -> &'a mut W {
440 const MASK: bool = true;
441 const OFFSET: u8 = 0;
442 self.w.bits &= !((MASK as u32) << OFFSET);
443 self.w.bits |= ((value & MASK) as u32) << OFFSET;
444 self.w
445 }
446}
447impl R {
448 #[doc = r" Value of the register as raw bits"]
449 #[inline]
450 pub fn bits(&self) -> u32 {
451 self.bits
452 }
453 #[doc = "Bit 25 - Low speed clock output selection"]
454 #[inline]
455 pub fn lscosel(&self) -> LSCOSELR {
456 let bits = {
457 const MASK: bool = true;
458 const OFFSET: u8 = 25;
459 ((self.bits >> OFFSET) & MASK as u32) != 0
460 };
461 LSCOSELR { bits }
462 }
463 #[doc = "Bit 24 - Low speed clock output enable"]
464 #[inline]
465 pub fn lscoen(&self) -> LSCOENR {
466 let bits = {
467 const MASK: bool = true;
468 const OFFSET: u8 = 24;
469 ((self.bits >> OFFSET) & MASK as u32) != 0
470 };
471 LSCOENR { bits }
472 }
473 #[doc = "Bit 16 - Backup domain software reset"]
474 #[inline]
475 pub fn bdrst(&self) -> BDRSTR {
476 let bits = {
477 const MASK: bool = true;
478 const OFFSET: u8 = 16;
479 ((self.bits >> OFFSET) & MASK as u32) != 0
480 };
481 BDRSTR { bits }
482 }
483 #[doc = "Bit 15 - RTC clock enable"]
484 #[inline]
485 pub fn rtcen(&self) -> RTCENR {
486 let bits = {
487 const MASK: bool = true;
488 const OFFSET: u8 = 15;
489 ((self.bits >> OFFSET) & MASK as u32) != 0
490 };
491 RTCENR { bits }
492 }
493 #[doc = "Bits 8:9 - RTC clock source selection"]
494 #[inline]
495 pub fn rtcsel(&self) -> RTCSELR {
496 let bits = {
497 const MASK: u8 = 3;
498 const OFFSET: u8 = 8;
499 ((self.bits >> OFFSET) & MASK as u32) as u8
500 };
501 RTCSELR { bits }
502 }
503 #[doc = "Bit 6 - LSECSSD"]
504 #[inline]
505 pub fn lsecssd(&self) -> LSECSSDR {
506 let bits = {
507 const MASK: bool = true;
508 const OFFSET: u8 = 6;
509 ((self.bits >> OFFSET) & MASK as u32) != 0
510 };
511 LSECSSDR { bits }
512 }
513 #[doc = "Bit 5 - LSECSSON"]
514 #[inline]
515 pub fn lsecsson(&self) -> LSECSSONR {
516 let bits = {
517 const MASK: bool = true;
518 const OFFSET: u8 = 5;
519 ((self.bits >> OFFSET) & MASK as u32) != 0
520 };
521 LSECSSONR { bits }
522 }
523 #[doc = "Bits 3:4 - SE oscillator drive capability"]
524 #[inline]
525 pub fn lsedrv(&self) -> LSEDRVR {
526 let bits = {
527 const MASK: u8 = 3;
528 const OFFSET: u8 = 3;
529 ((self.bits >> OFFSET) & MASK as u32) as u8
530 };
531 LSEDRVR { bits }
532 }
533 #[doc = "Bit 2 - LSE oscillator bypass"]
534 #[inline]
535 pub fn lsebyp(&self) -> LSEBYPR {
536 let bits = {
537 const MASK: bool = true;
538 const OFFSET: u8 = 2;
539 ((self.bits >> OFFSET) & MASK as u32) != 0
540 };
541 LSEBYPR { bits }
542 }
543 #[doc = "Bit 1 - LSE oscillator ready"]
544 #[inline]
545 pub fn lserdy(&self) -> LSERDYR {
546 let bits = {
547 const MASK: bool = true;
548 const OFFSET: u8 = 1;
549 ((self.bits >> OFFSET) & MASK as u32) != 0
550 };
551 LSERDYR { bits }
552 }
553 #[doc = "Bit 0 - LSE oscillator enable"]
554 #[inline]
555 pub fn lseon(&self) -> LSEONR {
556 let bits = {
557 const MASK: bool = true;
558 const OFFSET: u8 = 0;
559 ((self.bits >> OFFSET) & MASK as u32) != 0
560 };
561 LSEONR { bits }
562 }
563}
564impl W {
565 #[doc = r" Reset value of the register"]
566 #[inline]
567 pub fn reset_value() -> W {
568 W { bits: 0 }
569 }
570 #[doc = r" Writes raw bits to the register"]
571 #[inline]
572 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
573 self.bits = bits;
574 self
575 }
576 #[doc = "Bit 25 - Low speed clock output selection"]
577 #[inline]
578 pub fn lscosel(&mut self) -> _LSCOSELW {
579 _LSCOSELW { w: self }
580 }
581 #[doc = "Bit 24 - Low speed clock output enable"]
582 #[inline]
583 pub fn lscoen(&mut self) -> _LSCOENW {
584 _LSCOENW { w: self }
585 }
586 #[doc = "Bit 16 - Backup domain software reset"]
587 #[inline]
588 pub fn bdrst(&mut self) -> _BDRSTW {
589 _BDRSTW { w: self }
590 }
591 #[doc = "Bit 15 - RTC clock enable"]
592 #[inline]
593 pub fn rtcen(&mut self) -> _RTCENW {
594 _RTCENW { w: self }
595 }
596 #[doc = "Bits 8:9 - RTC clock source selection"]
597 #[inline]
598 pub fn rtcsel(&mut self) -> _RTCSELW {
599 _RTCSELW { w: self }
600 }
601 #[doc = "Bit 5 - LSECSSON"]
602 #[inline]
603 pub fn lsecsson(&mut self) -> _LSECSSONW {
604 _LSECSSONW { w: self }
605 }
606 #[doc = "Bits 3:4 - SE oscillator drive capability"]
607 #[inline]
608 pub fn lsedrv(&mut self) -> _LSEDRVW {
609 _LSEDRVW { w: self }
610 }
611 #[doc = "Bit 2 - LSE oscillator bypass"]
612 #[inline]
613 pub fn lsebyp(&mut self) -> _LSEBYPW {
614 _LSEBYPW { w: self }
615 }
616 #[doc = "Bit 0 - LSE oscillator enable"]
617 #[inline]
618 pub fn lseon(&mut self) -> _LSEONW {
619 _LSEONW { w: self }
620 }
621}