docs: comment rtc-log
This commit is contained in:
parent
0b1c72e345
commit
b56c8709d7
1 changed files with 10 additions and 6 deletions
|
@ -25,20 +25,24 @@ fn main() -> ! {
|
||||||
|
|
||||||
let mut delay = cp.SYST.delay(rcc.clocks);
|
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 {
|
loop {
|
||||||
led.set_high().unwrap();
|
led.set_high().unwrap(); // light on
|
||||||
delay.delay_ms(500_u16);
|
delay.delay_ms(500_u16); // wait
|
||||||
|
|
||||||
led.set_low().unwrap();
|
led.set_low().unwrap(); // light off
|
||||||
delay.delay_ms(500_u16);
|
delay.delay_ms(500_u16); // wait
|
||||||
|
|
||||||
|
// print the current time from the RTC
|
||||||
ptime(&mut rtc);
|
ptime(&mut rtc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// prints the time to the "host" computer via RTT
|
||||||
fn ptime(rtc: &mut Rtc) {
|
fn ptime(rtc: &mut Rtc) {
|
||||||
let time: NaiveDateTime = rtc.now();
|
let time: NaiveDateTime = rtc.now();
|
||||||
info!(
|
info!(
|
||||||
|
|
Loading…
Add table
Reference in a new issue