skip _C pins for pin impls if split_feature not enabled.

This commit is contained in:
JuliDi 2023-09-30 10:10:06 +02:00
parent 5c83179071
commit 5cb58754d4
No known key found for this signature in database
GPG Key ID: E1E90AE563D09D63

View File

@ -732,17 +732,14 @@ fn main() {
let key = (regs.kind, pin.signal); let key = (regs.kind, pin.signal);
if let Some(tr) = signals.get(&key) { if let Some(tr) = signals.get(&key) {
let mut peri = format_ident!("{}", p.name); let mut peri = format_ident!("{}", p.name);
let pin_name = { let pin_name = {
// If we encounter a "_C" pin, we remove the suffix // If we encounter a _C pin but the split_feature for this pin is not enabled, skip it
let mut pin_name = pin.pin.strip_suffix("_C").unwrap_or(pin.pin).to_string(); if pin.pin.ends_with("_C") && !split_features.iter().any(|x| x.pin_name_with_c == pin.pin) {
// However, if the corresponding split_feature is enabled, we actually do want the pin name including "_C" continue;
for split_feature in &split_features {
if pin.pin == split_feature.pin_name_with_c {
pin_name = split_feature.pin_name_with_c.clone();
}
} }
format_ident!("{}", pin_name) format_ident!("{}", pin.pin)
}; };
let af = pin.af.unwrap_or(0); let af = pin.af.unwrap_or(0);
@ -782,16 +779,11 @@ fn main() {
let peri = format_ident!("{}", p.name); let peri = format_ident!("{}", p.name);
let pin_name = { let pin_name = {
// If we encounter a "_C" pin, we remove the suffix // If we encounter a _C pin but the split_feature for this pin is not enabled, skip it
let mut pin_name = pin.pin.strip_suffix("_C").unwrap_or(pin.pin).to_string(); if pin.pin.ends_with("_C") && !split_features.iter().any(|x| x.pin_name_with_c == pin.pin) {
// However, if the corresponding split_feature is enabled, we actually do want the pin name including "_C" continue;
for split_feature in &split_features {
if pin.pin == split_feature.pin_name_with_c {
pin_name = split_feature.pin_name_with_c.clone();
}
} }
format_ident!("{}", pin.pin)
format_ident!("{}", pin_name)
}; };
// H7 has differential voltage measurements // H7 has differential voltage measurements