docs: comment rtc-log

This commit is contained in:
cscherr 2025-05-14 17:40:08 +02:00
parent 0b1c72e345
commit b56c8709d7
Signed by: cscherrNT
GPG key ID: 8E2B45BC51A27EA7

View file

@ -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!(