aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/build.rs
diff options
context:
space:
mode:
authorFabian Wolter <[email protected]>2024-12-15 20:15:11 +0100
committerFabian Wolter <[email protected]>2025-07-17 21:17:27 +0200
commitc279063c426b57f22d8bdeb7356b3c541b16bb08 (patch)
treebaf7e4e13be7b72442f5ca005eba02ac9f622664 /embassy-stm32/build.rs
parentbe312850c851d1e18452d9b79860b4d56ceea8e1 (diff)
STM32F0/F3 Remap DMA channels
Fixes #3643
Diffstat (limited to 'embassy-stm32/build.rs')
-rw-r--r--embassy-stm32/build.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs
index 753f241c7..068dadf4b 100644
--- a/embassy-stm32/build.rs
+++ b/embassy-stm32/build.rs
@@ -1551,9 +1551,26 @@ fn main() {
1551 quote!(()) 1551 quote!(())
1552 }; 1552 };
1553 1553
1554 let mut remap = quote!();
1555 for remap_info in ch.remap {
1556 let peripheral = format_ident!("{}", remap_info.peripheral);
1557 let register = format_ident!("{}", remap_info.register.to_lowercase());
1558 let setter = format_ident!("set_{}", remap_info.field.to_lowercase());
1559
1560 let value = if remap_info.value.contains("true") || remap_info.value.contains("false") {
1561 let value = format_ident!("{}", remap_info.value);
1562 quote!(#value)
1563 } else {
1564 let value = remap_info.value.parse::<u8>().unwrap();
1565 quote!(#value.into())
1566 };
1567
1568 remap.extend(quote!(crate::pac::#peripheral.#register().modify(|w| w.#setter(#value));));
1569 }
1570
1554 let channel = format_ident!("{}", channel); 1571 let channel = format_ident!("{}", channel);
1555 g.extend(quote! { 1572 g.extend(quote! {
1556 dma_trait_impl!(#tr, #peri, #channel, #request); 1573 dma_trait_impl!(#tr, #peri, #channel, #request, {#remap});
1557 }); 1574 });
1558 } 1575 }
1559 } 1576 }