Fix APB clock calculation for several STM32 families

This commit is contained in:
Eric Yanush 2023-03-16 21:21:39 -06:00
parent 2c9f289f40
commit 13f0c64a8c
7 changed files with 8 additions and 8 deletions

View File

@ -313,7 +313,7 @@ pub(crate) unsafe fn init(config: Config) {
pre => {
let pre: Ppre = pre.into();
let pre: u8 = 1 << (pre.0 - 3);
let freq = ahb_freq / (1 << (pre as u8 - 3));
let freq = ahb_freq / pre as u32;
(freq, freq * 2)
}
};

View File

@ -314,7 +314,7 @@ pub(crate) unsafe fn init(config: Config) {
pre => {
let pre: Ppre = pre.into();
let pre: u8 = 1 << (pre.0 - 3);
let freq = ahb_freq / (1 << (pre as u8 - 3));
let freq = ahb_freq / pre as u32;
(freq, freq * 2)
}
};

View File

@ -483,7 +483,7 @@ pub(crate) unsafe fn init(config: Config) {
pre => {
let pre: Ppre = pre.into();
let pre: u8 = 1 << (pre.0 - 3);
let freq = ahb_freq / (1 << (pre as u8 - 3));
let freq = ahb_freq / pre as u32;
(freq, freq * 2)
}
};

View File

@ -481,7 +481,7 @@ pub(crate) unsafe fn init(config: Config) {
pre => {
let pre: Ppre = pre.into();
let pre: u8 = 1 << (pre.0 - 3);
let freq = ahb_freq / (1 << (pre as u8 - 3));
let freq = ahb_freq / pre as u32;
(freq, freq * 2)
}
};

View File

@ -481,7 +481,7 @@ pub(crate) unsafe fn init(config: Config) {
pre => {
let pre: u8 = pre.into();
let pre: u8 = 1 << (pre - 3);
let freq = ahb_freq / (1 << (pre as u8 - 3));
let freq = ahb_freq / pre as u32;
(freq, freq * 2)
}
};
@ -491,7 +491,7 @@ pub(crate) unsafe fn init(config: Config) {
pre => {
let pre: u8 = pre.into();
let pre: u8 = 1 << (pre - 3);
let freq = ahb_freq / (1 << (pre as u8 - 3));
let freq = ahb_freq / pre as u32;
(freq, freq * 2)
}
};

View File

@ -151,7 +151,7 @@ pub(crate) unsafe fn init(config: Config) {
pre => {
let pre: u8 = pre.into();
let pre: u8 = 1 << (pre - 3);
let freq = ahb_freq / (1 << (pre as u8 - 3));
let freq = ahb_freq / pre as u32;
(freq, freq * 2)
}
};

View File

@ -240,7 +240,7 @@ pub(crate) unsafe fn init(config: Config) {
pre => {
let pre: u8 = pre.into();
let pre: u8 = 1 << (pre - 3);
let freq = ahb_freq / (1 << (pre as u8 - 3));
let freq = ahb_freq / pre as u32;
(freq, freq * 2)
}
};