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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#![no_std]
#![allow(unused_unsafe)]
#[cfg(not(any(
feature = "f301",
feature = "f302",
feature = "f303",
feature = "f373",
feature = "f3x4",
feature = "l4x1",
feature = "l4x2",
feature = "l4x3",
feature = "l4x5",
feature = "l4x6",
feature = "l552",
feature = "l562",
feature = "h743",
feature = "h743v",
feature = "h747cm4",
feature = "h747cm7",
feature = "h753",
feature = "h753v",
feature = "h7b3",
)))]
compile_error!("This crate requires an MCU-specifying feature to be enabled. eg `l552`.");
#[cfg(feature = "f301")]
pub use stm32f3::stm32f301 as pac;
#[cfg(feature = "f302")]
pub use stm32f3::stm32f302 as pac;
#[cfg(feature = "f303")]
pub use stm32f3::stm32f303 as pac;
#[cfg(feature = "f373")]
pub use stm32f3::stm32f373 as pac;
#[cfg(feature = "f3x4")]
pub use stm32f3::stm32f3x4 as pac;
#[cfg(feature = "l4x1")]
pub use stm32l4::stm32l4x1 as pac;
#[cfg(feature = "l4x2")]
pub use stm32l4::stm32l4x2 as pac;
#[cfg(feature = "l4x3")]
pub use stm32l4::stm32l4x3 as pac;
#[cfg(feature = "l4x5")]
pub use stm32l4::stm32l4x5 as pac;
#[cfg(feature = "l4x6")]
pub use stm32l4::stm32l4x6 as pac;
#[cfg(feature = "l552")]
pub use stm32l5::stm32l552 as pac;
#[cfg(feature = "l562")]
pub use stm32l5::stm32l562 as pac;
#[cfg(feature = "h743")]
pub use stm32h7::stm32h743 as pac;
#[cfg(feature = "h743v")]
pub use stm32h7::stm32h743v as pac;
#[cfg(feature = "h747cm4")]
pub use stm32h7::stm32h747cm4 as pac;
#[cfg(feature = "h747cm7")]
pub use stm32h7::stm32h747cm7 as pac;
#[cfg(feature = "h753")]
pub use stm32h7::stm32h753 as pac;
#[cfg(feature = "h753v")]
pub use stm32h7::stm32h753v as pac;
#[cfg(feature = "h7b3")]
pub use stm32h7::stm32h7b3 as pac;
pub mod traits;
pub mod prelude {
pub use embedded_hal::{
blocking::delay::{DelayMs, DelayUs},
digital::v2::{InputPin, OutputPin, ToggleableOutputPin},
};
}
#[cfg(not(any(feature = "l5", feature = "h7")))]
pub mod adc;
pub mod clocks;
pub mod dac;
pub mod delay;
#[cfg(any(feature = "l4"))]
pub mod dma;
#[cfg(not(any(feature = "l5", feature = "h7")))]
pub mod flash;
pub mod gpio;
pub mod i2c;
pub mod low_power;
pub mod rtc;
#[cfg(any(feature = "l4"))]
pub mod serial;
pub mod spi;
pub mod timer;
cfg_if::cfg_if! {
if #[cfg(all(
feature = "usb",
not(any(feature = "l4x1", feature = "l4x5", feature = "l4x6", feature = "h7"))
))] {
pub mod usb;
} else if #[cfg(all(feature ="h7", feature = "usb"))] {
pub mod usb_h7 as usb;
}
}
#[macro_export]
macro_rules! access_global {
($NAME_GLOBAL:ident, $name_local:ident, $cs:expr) => {
let mut part1 = $NAME_GLOBAL.borrow($cs).borrow_mut();
let $name_local = part1.as_mut().unwrap();
};
}