mirror of
https://github.com/FliegendeWurst/raspi-oled.git
synced 2024-11-28 13:05:53 +00:00
add loop
This commit is contained in:
parent
3846d907cb
commit
100b40382d
81
src/main.rs
81
src/main.rs
@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user