stm32: avoid creating many tiny critical sections in init.
Saves 292 bytes on stm32f0 bilnky with max optimizations (from 3132 to 2840).
This commit is contained in:
@ -229,10 +229,19 @@ pub mod low_level {
|
||||
}
|
||||
|
||||
pub(crate) mod sealed {
|
||||
use critical_section::CriticalSection;
|
||||
|
||||
pub trait RccPeripheral {
|
||||
fn frequency() -> crate::time::Hertz;
|
||||
fn enable_and_reset();
|
||||
fn disable();
|
||||
fn enable_and_reset_with_cs(cs: CriticalSection);
|
||||
fn disable_with_cs(cs: CriticalSection);
|
||||
|
||||
fn enable_and_reset() {
|
||||
critical_section::with(|cs| Self::enable_and_reset_with_cs(cs))
|
||||
}
|
||||
fn disable() {
|
||||
critical_section::with(|cs| Self::disable_with_cs(cs))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user