h7: enable rtc test
This commit is contained in:
parent
f01609036f
commit
4075ac84e1
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user