feat: lcd on line 2 and 4
This commit is contained in:
parent
41736b1d23
commit
93abdfb521
2 changed files with 19 additions and 9 deletions
|
@ -106,10 +106,10 @@ fn display_time(rtc: &mut Rtc, lcd: &mut Lcd, delay: &mut Delay, buf: &mut Strin
|
||||||
buf.clear();
|
buf.clear();
|
||||||
write!(
|
write!(
|
||||||
buf,
|
buf,
|
||||||
" {:02}:{:02}:{:02} ",
|
" {:04}-{:02}-{:02} ",
|
||||||
timestamp.hour(),
|
timestamp.year(),
|
||||||
timestamp.minute(),
|
timestamp.month(),
|
||||||
timestamp.second()
|
timestamp.day()
|
||||||
)
|
)
|
||||||
.expect("could not format text content for display");
|
.expect("could not format text content for display");
|
||||||
lcd.write_str(buf, delay).expect("could not write to LCD");
|
lcd.write_str(buf, delay).expect("could not write to LCD");
|
||||||
|
@ -120,12 +120,11 @@ fn display_time(rtc: &mut Rtc, lcd: &mut Lcd, delay: &mut Delay, buf: &mut Strin
|
||||||
buf.clear();
|
buf.clear();
|
||||||
write!(
|
write!(
|
||||||
buf,
|
buf,
|
||||||
" {:04}-{:02}-{:02} ",
|
" {:02}:{:02}:{:02} ",
|
||||||
timestamp.year(),
|
timestamp.hour(),
|
||||||
timestamp.month(),
|
timestamp.minute(),
|
||||||
timestamp.day()
|
timestamp.second()
|
||||||
)
|
)
|
||||||
.expect("could not format text content for display");
|
.expect("could not format text content for display");
|
||||||
|
|
||||||
lcd.write_str(buf, delay).expect("could not write to LCD");
|
lcd.write_str(buf, delay).expect("could not write to LCD");
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,17 @@ fn main() -> ! {
|
||||||
lcd.write_str(&buf, &mut delay)
|
lcd.write_str(&buf, &mut delay)
|
||||||
.expect("could not write to LCD");
|
.expect("could not write to LCD");
|
||||||
|
|
||||||
|
lcd.set_cursor_pos(60, &mut delay)
|
||||||
|
.expect("could not move cursor to start");
|
||||||
|
lcd.write_str(" Line 2 ", &mut delay)
|
||||||
|
.expect("could not write to LCD");
|
||||||
|
|
||||||
|
// line 4 is a bit strange and eats the first few spaces
|
||||||
|
lcd.set_cursor_pos(80, &mut delay)
|
||||||
|
.expect("could not move cursor to start");
|
||||||
|
lcd.write_str(" Line 4 ", &mut delay)
|
||||||
|
.expect("could not write to LCD");
|
||||||
|
|
||||||
info!("Done!");
|
info!("Done!");
|
||||||
led.set_low().unwrap();
|
led.set_low().unwrap();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue