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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#![no_std]
#![allow(non_camel_case_types)]
#![deny(macro_use_extern_crate)]
#[cfg(all(feature = "direct-call-deprecated", not(feature = "device-selected")))]
compile_error!(
"The feature you selected is deprecated, because it was split up into sub-devices.
Example: The STM32F3Discovery board has a STM32F303VCT6 chip.
You probably used to use `--features stm32f303` but now functionalities for the sub-device were added.
In this case replace it with `--features stm32f303xc` to make your code build again.
Please select one of the chip features stated above."
);
#[cfg(all(
not(feature = "direct-call-deprecated"),
not(feature = "device-selected")
))]
compile_error!(
"This crate requires you to specify your target chip as a feature.
Please select one of the following
(Note: `x` denotes any character in [a-z])
* stm32f301
* stm32f318
* stm32f302xb
* stm32f302xc
* stm32f302xd
* stm32f302xe
* stm32f302x6
* stm32f302x8
* stm32f303xb
* stm32f303xc
* stm32f303xd
* stm32f303xe
* stm32f303x6
* stm32f303x8
* stm32f373
* stm32f378
* stm32f334
* stm32f328
* stm32f358
* stm32f398
Example: The STM32F3Discovery board has a STM32F303VCT6 chip.
So you want to expand your call to `cargo` with `--features stm32f303xc`.
For more information, see README -> Selecting the right chip.
"
);
pub use embedded_hal as hal;
pub use nb;
pub use nb::block;
#[cfg(feature = "defmt")]
pub(crate) use defmt::{assert, panic, unreachable, unwrap};
#[cfg(feature = "defmt")]
mod macros {
#[macro_export]
macro_rules! expect {
($l:expr, $s:tt) => {
defmt::unwrap!($l, $s)
};
}
}
#[cfg(not(feature = "defmt"))]
pub(crate) use core::{assert, panic, unreachable};
#[cfg(not(feature = "defmt"))]
mod macros {
#[macro_export]
macro_rules! unwrap {
($l:expr) => {
$l.unwrap()
};
}
#[macro_export]
macro_rules! expect {
($l:expr, $s:tt) => {
$l.expect($s)
};
}
}
#[cfg(any(feature = "stm32f301", feature = "stm32f318"))]
pub use stm32f3::stm32f301 as pac;
#[cfg(feature = "stm32f302")]
pub use stm32f3::stm32f302 as pac;
#[cfg(feature = "stm32f303")]
pub use stm32f3::stm32f303 as pac;
#[cfg(any(feature = "stm32f373", feature = "stm32f378"))]
pub use stm32f3::stm32f373 as pac;
#[cfg(feature = "stm32f334")]
pub use stm32f3::stm32f3x4 as pac;
#[cfg(any(feature = "stm32f328", feature = "stm32f358", feature = "stm32f398"))]
pub use stm32f3::stm32f3x8 as pac;
#[cfg(feature = "device-selected")]
#[deprecated(since = "0.5.0", note = "please use `pac` instead")]
pub use crate::pac as stm32;
#[cfg(feature = "rt")]
pub use crate::pac::interrupt;
cfg_if::cfg_if! {
if #[cfg(feature = "device-selected")] {
pub mod delay;
pub mod flash;
pub mod gpio;
pub mod i2c;
pub mod prelude;
pub mod pwm;
pub mod rcc;
pub mod rtc;
pub mod serial;
pub mod spi;
pub mod time;
pub mod timer;
}
}
cfg_if::cfg_if! {
if #[cfg(feature = "stm32f303")] {
pub mod adc;
pub mod dac;
pub mod clocks;
pub mod low_power;
}
}
#[cfg(all(feature = "stm32f303", feature = "rt"))]
pub mod exti;
#[cfg(any(feature = "stm32f302", feature = "stm32f303"))]
pub mod dma;
#[cfg(all(
feature = "stm32-usbd",
any(
feature = "stm32f303xb",
feature = "stm32f303xc",
feature = "stm32f303xd",
feature = "stm32f303xe",
)
))]
pub mod usb;
#[cfg(feature = "device-selected")]
pub mod watchdog;
#[cfg(all(feature = "device-selected", feature = "can"))]
pub mod can;