stm32/spi: check that the RCC enable bit is disabled on drop.

This commit is contained in:
Dario Nieuwenhuis 2024-05-20 23:41:02 +02:00
parent ca2eef5387
commit 2b09f9efd7

View File

@ -58,6 +58,14 @@ async fn main(_spawner: Spawner) {
spi.blocking_read::<u8>(&mut []).unwrap(); spi.blocking_read::<u8>(&mut []).unwrap();
spi.blocking_write::<u8>(&[]).unwrap(); spi.blocking_write::<u8>(&[]).unwrap();
// Assert the RCC bit gets disabled on drop.
#[cfg(feature = "stm32f429zi")]
{
defmt::assert!(embassy_stm32::pac::RCC.apb2enr().read().spi1en());
drop(spi);
defmt::assert!(!embassy_stm32::pac::RCC.apb2enr().read().spi1en());
}
info!("Test OK"); info!("Test OK");
cortex_m::asm::bkpt(); cortex_m::asm::bkpt();
} }