diff options
| author | WillaWillNot <[email protected]> | 2025-11-22 17:22:55 -0500 |
|---|---|---|
| committer | WillaWillNot <[email protected]> | 2025-11-22 17:23:16 -0500 |
| commit | 2589d3539903356c524b38f04f740b1735a80207 (patch) | |
| tree | aa6439513efaf28982ae7fb3a087d00140c13d6f /embassy-stm32/build.rs | |
| parent | 764c921a573e42f510a74d61f31302b8609bbd6c (diff) | |
| parent | eb4e4100acbe03ee1d3726c948f91b6927a18125 (diff) | |
Synchronize with main branch
Diffstat (limited to 'embassy-stm32/build.rs')
| -rw-r--r-- | embassy-stm32/build.rs | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs index 6be3ada51..3d0b13fe2 100644 --- a/embassy-stm32/build.rs +++ b/embassy-stm32/build.rs | |||
| @@ -1356,6 +1356,9 @@ fn main() { | |||
| 1356 | (("tsc", "G8_IO2"), quote!(crate::tsc::G8IO2Pin)), | 1356 | (("tsc", "G8_IO2"), quote!(crate::tsc::G8IO2Pin)), |
| 1357 | (("tsc", "G8_IO3"), quote!(crate::tsc::G8IO3Pin)), | 1357 | (("tsc", "G8_IO3"), quote!(crate::tsc::G8IO3Pin)), |
| 1358 | (("tsc", "G8_IO4"), quote!(crate::tsc::G8IO4Pin)), | 1358 | (("tsc", "G8_IO4"), quote!(crate::tsc::G8IO4Pin)), |
| 1359 | (("lcd", "SEG"), quote!(crate::lcd::SegPin)), | ||
| 1360 | (("lcd", "COM"), quote!(crate::lcd::ComPin)), | ||
| 1361 | (("lcd", "VLCD"), quote!(crate::lcd::VlcdPin)), | ||
| 1359 | (("dac", "OUT1"), quote!(crate::dac::DacPin<Ch1>)), | 1362 | (("dac", "OUT1"), quote!(crate::dac::DacPin<Ch1>)), |
| 1360 | (("dac", "OUT2"), quote!(crate::dac::DacPin<Ch2>)), | 1363 | (("dac", "OUT2"), quote!(crate::dac::DacPin<Ch2>)), |
| 1361 | ].into(); | 1364 | ].into(); |
| @@ -1363,9 +1366,22 @@ fn main() { | |||
| 1363 | for p in METADATA.peripherals { | 1366 | for p in METADATA.peripherals { |
| 1364 | if let Some(regs) = &p.registers { | 1367 | if let Some(regs) = &p.registers { |
| 1365 | let mut adc_pairs: BTreeMap<u8, (Option<Ident>, Option<Ident>)> = BTreeMap::new(); | 1368 | let mut adc_pairs: BTreeMap<u8, (Option<Ident>, Option<Ident>)> = BTreeMap::new(); |
| 1369 | let mut seen_lcd_seg_pins = HashSet::new(); | ||
| 1366 | 1370 | ||
| 1367 | for pin in p.pins { | 1371 | for pin in p.pins { |
| 1368 | let key = (regs.kind, pin.signal); | 1372 | let mut key = (regs.kind, pin.signal); |
| 1373 | |||
| 1374 | // LCD is special. There are so many pins! | ||
| 1375 | if regs.kind == "lcd" { | ||
| 1376 | key.1 = pin.signal.trim_end_matches(char::is_numeric); | ||
| 1377 | |||
| 1378 | if key.1 == "SEG" && !seen_lcd_seg_pins.insert(pin.pin) { | ||
| 1379 | // LCD has SEG pins multiplexed in the peripheral | ||
| 1380 | // This means we can see them twice. We need to skip those so we're not impl'ing the trait twice | ||
| 1381 | continue; | ||
| 1382 | } | ||
| 1383 | } | ||
| 1384 | |||
| 1369 | if let Some(tr) = signals.get(&key) { | 1385 | if let Some(tr) = signals.get(&key) { |
| 1370 | let mut peri = format_ident!("{}", p.name); | 1386 | let mut peri = format_ident!("{}", p.name); |
| 1371 | 1387 | ||
| @@ -1951,6 +1967,19 @@ fn main() { | |||
| 1951 | continue; | 1967 | continue; |
| 1952 | } | 1968 | } |
| 1953 | 1969 | ||
| 1970 | let stop_mode = METADATA | ||
| 1971 | .peripherals | ||
| 1972 | .iter() | ||
| 1973 | .find(|p| p.name == ch.dma) | ||
| 1974 | .map(|p| p.rcc.as_ref().map(|rcc| rcc.stop_mode.clone()).unwrap_or_default()) | ||
| 1975 | .unwrap_or_default(); | ||
| 1976 | |||
| 1977 | let stop_mode = match stop_mode { | ||
| 1978 | StopMode::Standby => quote! { Standby }, | ||
| 1979 | StopMode::Stop2 => quote! { Stop2 }, | ||
| 1980 | StopMode::Stop1 => quote! { Stop1 }, | ||
| 1981 | }; | ||
| 1982 | |||
| 1954 | let name = format_ident!("{}", ch.name); | 1983 | let name = format_ident!("{}", ch.name); |
| 1955 | let idx = ch_idx as u8; | 1984 | let idx = ch_idx as u8; |
| 1956 | #[cfg(feature = "_dual-core")] | 1985 | #[cfg(feature = "_dual-core")] |
| @@ -1963,7 +1992,7 @@ fn main() { | |||
| 1963 | quote!(crate::pac::Interrupt::#irq_name) | 1992 | quote!(crate::pac::Interrupt::#irq_name) |
| 1964 | }; | 1993 | }; |
| 1965 | 1994 | ||
| 1966 | g.extend(quote!(dma_channel_impl!(#name, #idx);)); | 1995 | g.extend(quote!(dma_channel_impl!(#name, #idx, #stop_mode);)); |
| 1967 | 1996 | ||
| 1968 | let dma = format_ident!("{}", ch.dma); | 1997 | let dma = format_ident!("{}", ch.dma); |
| 1969 | let ch_num = ch.channel as usize; | 1998 | let ch_num = ch.channel as usize; |
