turing_smart_screen/
lib.rs

1pub mod screen;
2pub mod errors;
3
4#[cfg(test)]
5mod tests {
6	use super::*;
7
8	#[test]
9	fn test_screen() {
10		let port = screen::Screen::find_port().expect("No port found");
11		let mut screen = screen::Screen::new(port).expect("Failed to open port");
12
13		screen.orientation(screen::Orientation::Portrait).expect("Failed to set orientation");
14		screen.clear().expect("Failed to clear screen");
15
16		let img = image::ImageReader::open("meme.png").unwrap().decode().unwrap();
17		screen.draw(img.into()).expect("Failed to draw image");
18
19		screen.brightness(10).expect("Failed to set brightness");
20		screen.screen_off().expect("Failed to turn screen off");
21		std::thread::sleep(core::time::Duration::from_secs(1));
22		screen.screen_on().expect("Failed to turn screen on");
23		screen.brightness(255)	.expect("Failed to set brightness");
24		screen.to_black().expect("Failed to turn screen black");
25	}
26}