Init commit of ili dispalay test application

This commit is contained in:
2020-05-20 07:49:23 +02:00
commit f04b969afb
4 changed files with 740 additions and 0 deletions

43
src/main.rs Normal file
View File

@@ -0,0 +1,43 @@
#[macro_use]
extern crate arrayref;
use std::error::Error;
use std::thread;
use std::time::Duration;
use rppal::gpio::Gpio;
use rppal::spi::{Bus, Mode, Segment, SlaveSelect, Spi};
use rppal::system::DeviceInfo;
use image::{
Rgb,
RgbImage
};
use imageproc::rect::Rect;
use imageproc::drawing::draw_filled_rect_mut;
mod ilidisplay;
fn main() -> Result<(), Box<dyn Error>> {
let mut img = RgbImage::new(480, 320);
let thickness = 10;
draw_filled_rect_mut(&mut img, Rect::at(0,0).of_size(240, 160), Rgb([255,0,0]));
draw_filled_rect_mut(&mut img, Rect::at(0,160).of_size(240, 160), Rgb([255,0,0]));
draw_filled_rect_mut(&mut img, Rect::at(240,0).of_size(240, 160), Rgb([0, 0, 255]));
let mut e = ilidisplay::IliDisplay::init()?;
println!("Before init, sleeping for 5s");
thread::sleep(Duration::from_millis(5000));
e.init_chip();
println!("After init, sleeping for 5s");
thread::sleep(Duration::from_millis(5000));
e.turn_on();
println!("Before image, screen has now been reset and turned on, sleeping for 5s");
thread::sleep(Duration::from_millis(5000));
e.send_image(img);
println!("You should see image now, sleeping for 5s");
thread::sleep(Duration::from_millis(5000));
e.turn_off();
Ok(())
}