Workaround for L4

This commit is contained in:
Ulf Lilleengen 2021-06-08 10:57:52 +02:00
parent ee47a3e802
commit 459049d604

View File

@ -219,17 +219,22 @@ fn main() {
} }
"spi" => { "spi" => {
if let Some(clock) = &p.clock { if let Some(clock) = &p.clock {
// Workaround for APB1 register being split on some chip families // Workaround for APB1 register being split on some chip families. Assume
let reg = if chip.family == "STM32H7" && clock == "APB1" { // first register until we can find a way to hint which register is used
format!("{}l", clock.to_ascii_lowercase()) let reg = clock.to_ascii_lowercase();
let (enable_reg, reset_reg) = if chip.family == "STM32H7" && clock == "APB1"
{
(format!("{}lenr", reg), format!("{}lrstr", reg))
} else if chip.family == "STM32L4" && clock == "APB1" {
(format!("{}enr1", reg), format!("{}rstr1", reg))
} else { } else {
clock.to_ascii_lowercase() (format!("{}enr", reg), format!("{}rstr", reg))
}; };
let field = name.to_ascii_lowercase(); let field = name.to_ascii_lowercase();
peripheral_rcc_table.push(vec![ peripheral_rcc_table.push(vec![
name.clone(), name.clone(),
format!("{}enr", reg), enable_reg,
format!("{}rstr", reg), reset_reg,
format!("set_{}en", field), format!("set_{}en", field),
format!("set_{}rst", field), format!("set_{}rst", field),
]); ]);