From 4075ac84e14cbf970e773ba4a178ef4f82267c48 Mon Sep 17 00:00:00 2001 From: Matt Ickstadt Date: Fri, 6 Oct 2023 14:09:11 -0500 Subject: [PATCH] h7: enable rtc test --- tests/stm32/Cargo.toml | 2 +- tests/stm32/src/bin/rtc.rs | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index e11e585d..ef835eed 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml @@ -11,7 +11,7 @@ stm32f429zi = ["embassy-stm32/stm32f429zi", "chrono", "eth", "stop", "can", "not stm32g071rb = ["embassy-stm32/stm32g071rb", "not-gpdma", "dac-adc-pin"] # Nucleo stm32c031c6 = ["embassy-stm32/stm32c031c6", "not-gpdma"] # Nucleo stm32g491re = ["embassy-stm32/stm32g491re", "not-gpdma"] # Nucleo -stm32h755zi = ["embassy-stm32/stm32h755zi-cm7", "not-gpdma", "eth", "dac-adc-pin"] # Nucleo +stm32h755zi = ["embassy-stm32/stm32h755zi-cm7", "chrono", "not-gpdma", "eth", "dac-adc-pin"] # Nucleo stm32wb55rg = ["embassy-stm32/stm32wb55rg", "not-gpdma", "ble", "mac" ] # Nucleo stm32h563zi = ["embassy-stm32/stm32h563zi", "eth"] # Nucleo stm32u585ai = ["embassy-stm32/stm32u585ai"] # IoT board diff --git a/tests/stm32/src/bin/rtc.rs b/tests/stm32/src/bin/rtc.rs index 22be6fac..1f0d630c 100644 --- a/tests/stm32/src/bin/rtc.rs +++ b/tests/stm32/src/bin/rtc.rs @@ -12,15 +12,24 @@ use defmt::assert; use embassy_executor::Spawner; use embassy_stm32::rcc::RtcClockSource; use embassy_stm32::rtc::{Rtc, RtcConfig}; -use embassy_stm32::time::Hertz; use embassy_time::{Duration, Timer}; #[embassy_executor::main] async fn main(_spawner: Spawner) { let mut config = config(); - config.rcc.lse = Some(Hertz(32_768)); - config.rcc.rtc = Some(RtcClockSource::LSE); + #[cfg(feature = "stm32h755zi")] + { + use embassy_stm32::rcc::Lse; + config.rcc.lse = Some(Lse::Oscillator); + config.rcc.rtc_mux = Some(RtcClockSource::LSE); + } + #[cfg(not(feature = "stm32h755zi"))] + { + use embassy_stm32::time::Hertz; + config.rcc.lse = Some(Hertz(32_768)); + config.rcc.rtc = Some(RtcClockSource::LSE); + } let p = embassy_stm32::init(config); info!("Hello World!"); @@ -40,7 +49,7 @@ async fn main(_spawner: Spawner) { let then: NaiveDateTime = rtc.now().unwrap().into(); let seconds = (then - now).num_seconds(); - defmt::info!("measured = {}", seconds); + info!("measured = {}", seconds); assert!(seconds > 3 && seconds < 7);