This commit is contained in:
chux0519 2019-11-15 22:01:23 +08:00
parent 3846d907cb
commit 100b40382d

View File

@ -18,49 +18,54 @@ fn main() {
disp.init().unwrap(); disp.init().unwrap();
disp.flush().unwrap(); disp.flush().unwrap();
disp.draw( loop {
Line::new(Point::new(8, 16 + 16), Point::new(8 + 16, 16 + 16)) disp.draw(
.stroke(Some(BinaryColor::On)) Line::new(Point::new(8, 16 + 16), Point::new(8 + 16, 16 + 16))
.into_iter(), .stroke(Some(BinaryColor::On))
); .into_iter(),
disp.draw( );
Line::new(Point::new(8, 16 + 16), Point::new(8 + 8, 16)) disp.draw(
.stroke(Some(BinaryColor::On)) Line::new(Point::new(8, 16 + 16), Point::new(8 + 8, 16))
.into_iter(), .stroke(Some(BinaryColor::On))
); .into_iter(),
disp.draw( );
Line::new(Point::new(8 + 16, 16 + 16), Point::new(8 + 8, 16)) disp.draw(
.stroke(Some(BinaryColor::On)) Line::new(Point::new(8 + 16, 16 + 16), Point::new(8 + 8, 16))
.into_iter(), .stroke(Some(BinaryColor::On))
); .into_iter(),
);
disp.draw( disp.draw(
Rectangle::new(Point::new(48, 16), Point::new(48 + 16, 16 + 16)) Rectangle::new(Point::new(48, 16), Point::new(48 + 16, 16 + 16))
.stroke(Some(BinaryColor::On)) .stroke(Some(BinaryColor::On))
.into_iter(), .into_iter(),
); );
disp.draw( disp.draw(
Circle::new(Point::new(96, 16 + 8), 8) Circle::new(Point::new(96, 16 + 8), 8)
.stroke(Some(BinaryColor::On)) .stroke(Some(BinaryColor::On))
.into_iter(), .into_iter(),
); );
let local_addr = machine_ip::get().unwrap(); let local_addr = machine_ip::get().unwrap();
disp.draw( disp.draw(
Font6x8::render_str(&format!("IP: {}", local_addr.to_string())) Font6x8::render_str(&format!("IP: {}", local_addr.to_string()))
.translate(Point::new(0, 56)) .translate(Point::new(0, 56))
.into_iter(), .into_iter(),
); );
disp.flush().unwrap(); disp.flush().unwrap();
sleep(Duration::from_secs(2)); sleep(Duration::from_secs(2));
disp.clear(); disp.clear();
let im: Image<BinaryColor> = let im: Image<BinaryColor> =
Image::new(include_bytes!("../rust.raw"), 64, 64).translate(Point::new(32, 0)); Image::new(include_bytes!("../rust.raw"), 64, 64).translate(Point::new(32, 0));
disp.draw(im.into_iter()); disp.draw(im.into_iter());
disp.flush().unwrap(); disp.flush().unwrap();
sleep(Duration::from_secs(2));
disp.clear();
}
} }