1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
use crate::rcc::{Enable, APB1R1};
use crate::stm32::{pwr, PWR};
pub struct Pwr {
pub cr1: CR1,
pub cr2: CR2,
pub cr3: CR3,
pub cr4: CR4,
}
pub trait PwrExt {
fn constrain(self, _: &mut APB1R1) -> Pwr;
}
impl PwrExt for PWR {
fn constrain(self, apb1r1: &mut APB1R1) -> Pwr {
PWR::enable(apb1r1);
Pwr {
cr1: CR1 { _0: () },
cr2: CR2 { _0: () },
cr3: CR3 { _0: () },
cr4: CR4 { _0: () },
}
}
}
pub struct CR1 {
_0: (),
}
impl CR1 {
#[allow(dead_code)]
pub(crate) fn reg(&mut self) -> &pwr::CR1 {
unsafe { &(*PWR::ptr()).cr1 }
}
}
pub struct CR2 {
_0: (),
}
impl CR2 {
#[allow(dead_code)]
pub(crate) fn reg(&mut self) -> &pwr::CR2 {
unsafe { &(*PWR::ptr()).cr2 }
}
}
pub struct CR3 {
_0: (),
}
impl CR3 {
#[allow(dead_code)]
pub(crate) fn reg(&mut self) -> &pwr::CR3 {
unsafe { &(*PWR::ptr()).cr3 }
}
}
pub struct CR4 {
_0: (),
}
impl CR4 {
#[allow(dead_code)]
pub(crate) fn reg(&mut self) -> &pwr::CR4 {
unsafe { &(*PWR::ptr()).cr4 }
}
}