Skip to content

Commit 3846d90

Browse files
committed
feat: add image support
1 parent 7224c33 commit 3846d90

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

rust.raw

512 Bytes
Binary file not shown.

src/main.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
use embedded_graphics::fonts::Font6x8;
2+
use embedded_graphics::image::Image;
23
use embedded_graphics::pixelcolor::BinaryColor;
34
use embedded_graphics::prelude::*;
45
use embedded_graphics::primitives::{Circle, Line, Rectangle};
56
use embedded_graphics::Drawing;
67
use linux_embedded_hal::I2cdev;
78
use machine_ip;
89
use ssd1306::{mode::GraphicsMode, Builder};
10+
use std::thread::sleep;
11+
use std::time::Duration;
912

1013
fn main() {
1114
let i2c = I2cdev::new("/dev/i2c-1").unwrap();
@@ -50,6 +53,14 @@ fn main() {
5053
.translate(Point::new(0, 56))
5154
.into_iter(),
5255
);
56+
disp.flush().unwrap();
57+
58+
sleep(Duration::from_secs(2));
59+
60+
disp.clear();
5361

62+
let im: Image<BinaryColor> =
63+
Image::new(include_bytes!("../rust.raw"), 64, 64).translate(Point::new(32, 0));
64+
disp.draw(im.into_iter());
5465
disp.flush().unwrap();
5566
}

0 commit comments

Comments
 (0)