aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuliDi <[email protected]>2023-09-30 10:10:06 +0200
committerJuliDi <[email protected]>2023-10-01 12:32:47 +0200
commit5cb58754d49642fb0789625efe48ab3c37ae9fee (patch)
tree658dc56961570623860f2f78409fe5972e581e4b
parent5c831790714c3b358046cf1be81ac530032dc688 (diff)
skip _C pins for pin impls if split_feature not enabled.
-rw-r--r--embassy-stm32/build.rs26
1 files changed, 9 insertions, 17 deletions
diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs
index 005ec5280..2c349e55e 100644
--- a/embassy-stm32/build.rs
+++ b/embassy-stm32/build.rs
@@ -732,17 +732,14 @@ fn main() {
732 let key = (regs.kind, pin.signal); 732 let key = (regs.kind, pin.signal);
733 if let Some(tr) = signals.get(&key) { 733 if let Some(tr) = signals.get(&key) {
734 let mut peri = format_ident!("{}", p.name); 734 let mut peri = format_ident!("{}", p.name);
735
735 let pin_name = { 736 let pin_name = {
736 // If we encounter a "_C" pin, we remove the suffix 737 // If we encounter a _C pin but the split_feature for this pin is not enabled, skip it
737 let mut pin_name = pin.pin.strip_suffix("_C").unwrap_or(pin.pin).to_string(); 738 if pin.pin.ends_with("_C") && !split_features.iter().any(|x| x.pin_name_with_c == pin.pin) {
738 // However, if the corresponding split_feature is enabled, we actually do want the pin name including "_C" 739 continue;
739 for split_feature in &split_features {
740 if pin.pin == split_feature.pin_name_with_c {
741 pin_name = split_feature.pin_name_with_c.clone();
742 }
743 } 740 }
744 741
745 format_ident!("{}", pin_name) 742 format_ident!("{}", pin.pin)
746 }; 743 };
747 744
748 let af = pin.af.unwrap_or(0); 745 let af = pin.af.unwrap_or(0);
@@ -782,16 +779,11 @@ fn main() {
782 779
783 let peri = format_ident!("{}", p.name); 780 let peri = format_ident!("{}", p.name);
784 let pin_name = { 781 let pin_name = {
785 // If we encounter a "_C" pin, we remove the suffix 782 // If we encounter a _C pin but the split_feature for this pin is not enabled, skip it
786 let mut pin_name = pin.pin.strip_suffix("_C").unwrap_or(pin.pin).to_string(); 783 if pin.pin.ends_with("_C") && !split_features.iter().any(|x| x.pin_name_with_c == pin.pin) {
787 // However, if the corresponding split_feature is enabled, we actually do want the pin name including "_C" 784 continue;
788 for split_feature in &split_features {
789 if pin.pin == split_feature.pin_name_with_c {
790 pin_name = split_feature.pin_name_with_c.clone();
791 }
792 } 785 }
793 786 format_ident!("{}", pin.pin)
794 format_ident!("{}", pin_name)
795 }; 787 };
796 788
797 // H7 has differential voltage measurements 789 // H7 has differential voltage measurements