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();
|
||||
write!(
|
||||
buf,
|
||||
" {:02}:{:02}:{:02} ",
|
||||
timestamp.hour(),
|
||||
timestamp.minute(),
|
||||
timestamp.second()
|
||||
" {:04}-{:02}-{:02} ",
|
||||
timestamp.year(),
|
||||
timestamp.month(),
|
||||
timestamp.day()
|
||||
)
|
||||
.expect("could not format text content for display");
|
||||
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();
|
||||
write!(
|
||||
buf,
|
||||
" {:04}-{:02}-{:02} ",
|
||||
timestamp.year(),
|
||||
timestamp.month(),
|
||||
timestamp.day()
|
||||
" {:02}:{:02}:{:02} ",
|
||||
timestamp.hour(),
|
||||
timestamp.minute(),
|
||||
timestamp.second()
|
||||
)
|
||||
.expect("could not format text content for display");
|
||||
|
||||
lcd.write_str(buf, delay).expect("could not write to LCD");
|
||||
}
|
||||
|
|
|
@ -84,6 +84,17 @@ fn main() -> ! {
|
|||
lcd.write_str(&buf, &mut delay)
|
||||
.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!");
|
||||
led.set_low().unwrap();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue