1284: Fix APB clock calculation for several STM32 families r=Dirbaio a=ericyanush

This PR fixes #1283

Co-authored-by: Eric Yanush <eric@yanu.sh>
This commit is contained in:
bors[bot] 2023-03-17 07:49:09 +00:00 committed by GitHub
commit f9c0c53e12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 8 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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