From b56c8709d735191e18a0b4540983e25f3f436b2b Mon Sep 17 00:00:00 2001 From: cscherr Date: Wed, 14 May 2025 17:40:08 +0200 Subject: [PATCH] docs: comment rtc-log --- examples/rtc-log.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/examples/rtc-log.rs b/examples/rtc-log.rs index 34177ea..856efd9 100755 --- a/examples/rtc-log.rs +++ b/examples/rtc-log.rs @@ -25,20 +25,24 @@ fn main() -> ! { let mut delay = cp.SYST.delay(rcc.clocks); - let mut rtc = Rtc::new(dp.RTC, &mut rcc, &pwr, None).unwrap(); // starts at time 0 + // Setup the Real-Time-Clock of the Controller. + // starts at 0 (2001-01-01 00:00:00) and resets + // when the Controller is no longer powered. + let mut rtc = Rtc::new(dp.RTC, &mut rcc, &pwr, None).unwrap(); - #[allow(clippy::never_loop)] loop { - led.set_high().unwrap(); - delay.delay_ms(500_u16); + led.set_high().unwrap(); // light on + delay.delay_ms(500_u16); // wait - led.set_low().unwrap(); - delay.delay_ms(500_u16); + led.set_low().unwrap(); // light off + delay.delay_ms(500_u16); // wait + // print the current time from the RTC ptime(&mut rtc); } } +/// prints the time to the "host" computer via RTT fn ptime(rtc: &mut Rtc) { let time: NaiveDateTime = rtc.now(); info!(