aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-stm32/build.rs11
-rw-r--r--embassy-stm32/src/pwr/f4.rs (renamed from embassy-stm32/src/pwr/none.rs)0
-rw-r--r--embassy-stm32/src/pwr/mod.rs2
-rw-r--r--embassy-stm32/src/rcc/f4/max.rs259
4 files changed, 17 insertions, 255 deletions
diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs
index df8af660b..a6434a7e8 100644
--- a/embassy-stm32/build.rs
+++ b/embassy-stm32/build.rs
@@ -9,7 +9,7 @@ fn main() {
9 .expect("No stm32xx Cargo feature enabled") 9 .expect("No stm32xx Cargo feature enabled")
10 .strip_prefix("CARGO_FEATURE_") 10 .strip_prefix("CARGO_FEATURE_")
11 .unwrap() 11 .unwrap()
12 .to_ascii_uppercase(); 12 .to_ascii_lowercase();
13 13
14 let out_dir = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); 14 let out_dir = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
15 let out_file = out_dir.join("generated.rs").to_string_lossy().to_string(); 15 let out_file = out_dir.join("generated.rs").to_string_lossy().to_string();
@@ -30,6 +30,15 @@ fn main() {
30 }; 30 };
31 ); 31 );
32 32
33 let mut chip_and_core = chip_name.split('_');
34 let chip = chip_and_core.next().expect("Unexpected stm32xx feature");
35
36 if let Some(core) = chip_and_core.next() {
37 println!("cargo:rustc-cfg={}_{}", &chip[..(chip.len() - 2)], core);
38 } else {
39 println!("cargo:rustc-cfg={}", &chip[..(chip.len() - 2)]);
40 }
41
33 println!("cargo:rerun-if-changed=build.rs"); 42 println!("cargo:rerun-if-changed=build.rs");
34 println!("cargo:rerun-if-changed=gen.py"); 43 println!("cargo:rerun-if-changed=gen.py");
35} 44}
diff --git a/embassy-stm32/src/pwr/none.rs b/embassy-stm32/src/pwr/f4.rs
index 8b1378917..8b1378917 100644
--- a/embassy-stm32/src/pwr/none.rs
+++ b/embassy-stm32/src/pwr/f4.rs
diff --git a/embassy-stm32/src/pwr/mod.rs b/embassy-stm32/src/pwr/mod.rs
index f0d47ca89..1bb104bd3 100644
--- a/embassy-stm32/src/pwr/mod.rs
+++ b/embassy-stm32/src/pwr/mod.rs
@@ -1,5 +1,5 @@
1#[cfg_attr(any(pwr_h7, pwr_h7smps), path = "h7.rs")] 1#[cfg_attr(any(pwr_h7, pwr_h7smps), path = "h7.rs")]
2#[cfg_attr(not(any(pwr_h7, pwr_h7smps)), path = "none.rs")] 2#[cfg_attr(pwr_f4, path = "f4.rs")]
3mod _version; 3mod _version;
4 4
5pub use _version::*; 5pub use _version::*;
diff --git a/embassy-stm32/src/rcc/f4/max.rs b/embassy-stm32/src/rcc/f4/max.rs
index 03e1e9833..dd8de3da9 100644
--- a/embassy-stm32/src/rcc/f4/max.rs
+++ b/embassy-stm32/src/rcc/f4/max.rs
@@ -1,268 +1,21 @@
1#[cfg(any( 1#[cfg(stm32f401)]
2 feature = "stm32f401cb",
3 feature = "stm32f401cc",
4 feature = "stm32f401cd",
5 feature = "stm32f401ce",
6 feature = "stm32f401rb",
7 feature = "stm32f401rc",
8 feature = "stm32f401rd",
9 feature = "stm32f401re",
10 feature = "stm32f401vb",
11 feature = "stm32f401vc",
12 feature = "stm32f401vd",
13 feature = "stm32f401ve",
14))]
15pub(crate) const SYSCLK_MAX: u32 = 84_000_000; 2pub(crate) const SYSCLK_MAX: u32 = 84_000_000;
16 3
17#[cfg(any( 4#[cfg(any(stm32f405, stm32f407, stm32f415, stm32f417,))]
18 feature = "stm32f405oe",
19 feature = "stm32f405og",
20 feature = "stm32f405rg",
21 feature = "stm32f405vg",
22 feature = "stm32f405zg",
23 feature = "stm32f407ie",
24 feature = "stm32f407ig",
25 feature = "stm32f407ve",
26 feature = "stm32f407vg",
27 feature = "stm32f407ze",
28 feature = "stm32f407zg",
29 feature = "stm32f415og",
30 feature = "stm32f415rg",
31 feature = "stm32f415vg",
32 feature = "stm32f415zg",
33 feature = "stm32f417ie",
34 feature = "stm32f417ig",
35 feature = "stm32f417ve",
36 feature = "stm32f417vg",
37 feature = "stm32f417ze",
38 feature = "stm32f417zg",
39))]
40pub(crate) const SYSCLK_MAX: u32 = 168_000_000; 5pub(crate) const SYSCLK_MAX: u32 = 168_000_000;
41 6
42#[cfg(any( 7#[cfg(any(stm32f410, stm32f411, stm32f412, stm32f413, stm32f423,))]
43 feature = "stm32f410c8",
44 feature = "stm32f410cb",
45 feature = "stm32f410r8",
46 feature = "stm32f410rb",
47 feature = "stm32f410t8",
48 feature = "stm32f410tb",
49 feature = "stm32f411cc",
50 feature = "stm32f411ce",
51 feature = "stm32f411rc",
52 feature = "stm32f411re",
53 feature = "stm32f411vc",
54 feature = "stm32f411ve",
55 feature = "stm32f412ce",
56 feature = "stm32f412cg",
57 feature = "stm32f412re",
58 feature = "stm32f412rg",
59 feature = "stm32f412ve",
60 feature = "stm32f412vg",
61 feature = "stm32f412ze",
62 feature = "stm32f412zg",
63 feature = "stm32f413cg",
64 feature = "stm32f413ch",
65 feature = "stm32f413mg",
66 feature = "stm32f413mh",
67 feature = "stm32f413rg",
68 feature = "stm32f413rh",
69 feature = "stm32f413vg",
70 feature = "stm32f413vh",
71 feature = "stm32f413zg",
72 feature = "stm32f413zh",
73 feature = "stm32f423ch",
74 feature = "stm32f423mh",
75 feature = "stm32f423rh",
76 feature = "stm32f423vh",
77 feature = "stm32f423zh",
78))]
79pub(crate) const SYSCLK_MAX: u32 = 100_000_000; 8pub(crate) const SYSCLK_MAX: u32 = 100_000_000;
80 9
81#[cfg(any( 10#[cfg(any(
82 feature = "stm32f427ag", 11 stm32f427, stm32f429, stm32f437, stm32f439, stm32f446, stm32f469, stm32f479,
83 feature = "stm32f427ai",
84 feature = "stm32f427ig",
85 feature = "stm32f427ii",
86 feature = "stm32f427vg",
87 feature = "stm32f427vi",
88 feature = "stm32f427zg",
89 feature = "stm32f427zi",
90 feature = "stm32f429ag",
91 feature = "stm32f429ai",
92 feature = "stm32f429be",
93 feature = "stm32f429bg",
94 feature = "stm32f429bi",
95 feature = "stm32f429ie",
96 feature = "stm32f429ig",
97 feature = "stm32f429ii",
98 feature = "stm32f429ne",
99 feature = "stm32f429ng",
100 feature = "stm32f429ni",
101 feature = "stm32f429ve",
102 feature = "stm32f429vg",
103 feature = "stm32f429vi",
104 feature = "stm32f429ze",
105 feature = "stm32f429zg",
106 feature = "stm32f429zi",
107 feature = "stm32f437ai",
108 feature = "stm32f437ig",
109 feature = "stm32f437ii",
110 feature = "stm32f437vg",
111 feature = "stm32f437vi",
112 feature = "stm32f437zg",
113 feature = "stm32f437zi",
114 feature = "stm32f439ai",
115 feature = "stm32f439bg",
116 feature = "stm32f439bi",
117 feature = "stm32f439ig",
118 feature = "stm32f439ii",
119 feature = "stm32f439ng",
120 feature = "stm32f439ni",
121 feature = "stm32f439vg",
122 feature = "stm32f439vi",
123 feature = "stm32f439zg",
124 feature = "stm32f439zi",
125 feature = "stm32f446mc",
126 feature = "stm32f446me",
127 feature = "stm32f446rc",
128 feature = "stm32f446re",
129 feature = "stm32f446vc",
130 feature = "stm32f446ve",
131 feature = "stm32f446zc",
132 feature = "stm32f446ze",
133 feature = "stm32f469ae",
134 feature = "stm32f469ag",
135 feature = "stm32f469ai",
136 feature = "stm32f469be",
137 feature = "stm32f469bg",
138 feature = "stm32f469bi",
139 feature = "stm32f469ie",
140 feature = "stm32f469ig",
141 feature = "stm32f469ii",
142 feature = "stm32f469ne",
143 feature = "stm32f469ng",
144 feature = "stm32f469ni",
145 feature = "stm32f469ve",
146 feature = "stm32f469vg",
147 feature = "stm32f469vi",
148 feature = "stm32f469ze",
149 feature = "stm32f469zg",
150 feature = "stm32f469zi",
151 feature = "stm32f479ag",
152 feature = "stm32f479ai",
153 feature = "stm32f479bg",
154 feature = "stm32f479bi",
155 feature = "stm32f479ig",
156 feature = "stm32f479ii",
157 feature = "stm32f479ng",
158 feature = "stm32f479ni",
159 feature = "stm32f479vg",
160 feature = "stm32f479vi",
161 feature = "stm32f479zg",
162 feature = "stm32f479zi",
163))] 12))]
164pub(crate) const SYSCLK_MAX: u32 = 180_000_000; 13pub(crate) const SYSCLK_MAX: u32 = 180_000_000;
165 14
166#[cfg(any( 15#[cfg(any(stm32f401, stm32f410, stm32f411, stm32f412, stm32f413, stm32f423,))]
167 feature = "stm32f401cb",
168 feature = "stm32f401cc",
169 feature = "stm32f401cd",
170 feature = "stm32f401ce",
171 feature = "stm32f401rb",
172 feature = "stm32f401rc",
173 feature = "stm32f401rd",
174 feature = "stm32f401re",
175 feature = "stm32f401vb",
176 feature = "stm32f401vc",
177 feature = "stm32f401vd",
178 feature = "stm32f401ve",
179 feature = "stm32f410c8",
180 feature = "stm32f410cb",
181 feature = "stm32f410r8",
182 feature = "stm32f410rb",
183 feature = "stm32f410t8",
184 feature = "stm32f410tb",
185 feature = "stm32f411cc",
186 feature = "stm32f411ce",
187 feature = "stm32f411rc",
188 feature = "stm32f411re",
189 feature = "stm32f411vc",
190 feature = "stm32f411ve",
191 feature = "stm32f412ce",
192 feature = "stm32f412cg",
193 feature = "stm32f412re",
194 feature = "stm32f412rg",
195 feature = "stm32f412ve",
196 feature = "stm32f412vg",
197 feature = "stm32f412ze",
198 feature = "stm32f412zg",
199 feature = "stm32f413cg",
200 feature = "stm32f413ch",
201 feature = "stm32f413mg",
202 feature = "stm32f413mh",
203 feature = "stm32f413rg",
204 feature = "stm32f413rh",
205 feature = "stm32f413vg",
206 feature = "stm32f413vh",
207 feature = "stm32f413zg",
208 feature = "stm32f413zh",
209 feature = "stm32f423ch",
210 feature = "stm32f423mh",
211 feature = "stm32f423rh",
212 feature = "stm32f423vh",
213 feature = "stm32f423zh",
214))]
215pub(crate) const PCLK2_MAX: u32 = SYSCLK_MAX; 16pub(crate) const PCLK2_MAX: u32 = SYSCLK_MAX;
216 17
217#[cfg(not(any( 18#[cfg(not(any(stm32f401, stm32f410, stm32f411, stm32f412, stm32f413, stm32f423,)))]
218 feature = "stm32f401cb",
219 feature = "stm32f401cc",
220 feature = "stm32f401cd",
221 feature = "stm32f401ce",
222 feature = "stm32f401rb",
223 feature = "stm32f401rc",
224 feature = "stm32f401rd",
225 feature = "stm32f401re",
226 feature = "stm32f401vb",
227 feature = "stm32f401vc",
228 feature = "stm32f401vd",
229 feature = "stm32f401ve",
230 feature = "stm32f410c8",
231 feature = "stm32f410cb",
232 feature = "stm32f410r8",
233 feature = "stm32f410rb",
234 feature = "stm32f410t8",
235 feature = "stm32f410tb",
236 feature = "stm32f411cc",
237 feature = "stm32f411ce",
238 feature = "stm32f411rc",
239 feature = "stm32f411re",
240 feature = "stm32f411vc",
241 feature = "stm32f411ve",
242 feature = "stm32f412ce",
243 feature = "stm32f412cg",
244 feature = "stm32f412re",
245 feature = "stm32f412rg",
246 feature = "stm32f412ve",
247 feature = "stm32f412vg",
248 feature = "stm32f412ze",
249 feature = "stm32f412zg",
250 feature = "stm32f413cg",
251 feature = "stm32f413ch",
252 feature = "stm32f413mg",
253 feature = "stm32f413mh",
254 feature = "stm32f413rg",
255 feature = "stm32f413rh",
256 feature = "stm32f413vg",
257 feature = "stm32f413vh",
258 feature = "stm32f413zg",
259 feature = "stm32f413zh",
260 feature = "stm32f423ch",
261 feature = "stm32f423mh",
262 feature = "stm32f423rh",
263 feature = "stm32f423vh",
264 feature = "stm32f423zh",
265)))]
266pub(crate) const PCLK2_MAX: u32 = SYSCLK_MAX / 2; 19pub(crate) const PCLK2_MAX: u32 = SYSCLK_MAX / 2;
267 20
268pub(crate) const PCLK1_MAX: u32 = PCLK2_MAX / 2; 21pub(crate) const PCLK1_MAX: u32 = PCLK2_MAX / 2;