rcc: fix FDCAN: multiple FDCANs share the same RCC fields

the RCC fields are named either FDCAN or FDCAN12
This commit is contained in:
Torin Cooper-Bennun 2023-11-20 13:53:39 +00:00
parent f65fd694e1
commit 90ff5316eb

View File

@ -322,6 +322,11 @@ impl PeripheralToClock {
if peri_name.starts_with("ADC") && !peri_name.contains("COMMON") { if peri_name.starts_with("ADC") && !peri_name.contains("COMMON") {
return self.match_adc_peri_clock(clocks, peri_name); return self.match_adc_peri_clock(clocks, peri_name);
} }
if regex!("^FDCAN[0-9]*$").is_match(peri_name) {
return [peri_name, "FDCAN12", "FDCAN"]
.into_iter()
.find_map(|name| clocks.get(name));
}
if let Some(res) = clocks.get(peri_name) { if let Some(res) = clocks.get(peri_name) {
Some(res) Some(res)
} else if let Some(peri_name) = peri_name.strip_suffix('1') { } else if let Some(peri_name) = peri_name.strip_suffix('1') {