From cf4bf8ce76502a1a4a4df2f60d3571419420d55d Mon Sep 17 00:00:00 2001 From: Wesley Moore Date: Fri, 16 Nov 2018 22:58:55 +1100 Subject: [PATCH] Use default source and gate voltages (fixes red) --- examples/raspberry_pi_inky_phat.rs | 33 ++++++++++++++++++------------ src/display.rs | 3 ++- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/examples/raspberry_pi_inky_phat.rs b/examples/raspberry_pi_inky_phat.rs index 8bfd0b7..7b82f03 100644 --- a/examples/raspberry_pi_inky_phat.rs +++ b/examples/raspberry_pi_inky_phat.rs @@ -14,7 +14,7 @@ extern crate embedded_graphics; use embedded_graphics::coord::Coord; use embedded_graphics::fonts::{Font12x16, Font6x8}; use embedded_graphics::prelude::*; -use embedded_graphics::primitives::{Circle, Line}; +use embedded_graphics::primitives::{Circle, Line, Rect}; use embedded_graphics::Drawing; // HAL (Traits) @@ -84,14 +84,11 @@ fn main() -> Result<(), std::io::Error> { Font12x16::render_str("Hello Rust") .with_stroke(Some(Color::Red)) .with_fill(Some(Color::White)) - .translate(Coord::new(5, 10)) + .translate(Coord::new(5, 88)) .into_iter(), ); println!("draw"); - display.update(&mut delay).expect("error updating display"); - println!("update..."); - // display.set_rotation(DisplayRotation::Rotate90); // display.draw( // Font::render_str("Rotate 90!") @@ -128,22 +125,30 @@ fn main() -> Result<(), std::io::Error> { // println!("Now test new graphics with default rotation and some special stuff:"); // display.clear_buffer(Color::White); - // // draw a analog clock + // draw a analog clock + display.draw( + Circle::new(Coord::new(32, 32), 30) + .with_stroke(Some(Color::Black)) + .with_stroke_width(2) + .into_iter(), + ); // display.draw( - // Circle::new(Coord::new(64, 64), 64) + // Line::new(Coord::new(32, 32), Coord::new(0, 32)) // .with_stroke(Some(Color::Black)) + // .with_stroke_width(2) // .into_iter(), // ); // display.draw( - // Line::new(Coord::new(64, 64), Coord::new(0, 64)) - // .with_stroke(Some(Color::Black)) - // .into_iter(), - // ); - // display.draw( - // Line::new(Coord::new(64, 64), Coord::new(80, 80)) + // Line::new(Coord::new(32, 32), Coord::new(40, 40)) // .with_stroke(Some(Color::Black)) + // .with_stroke_width(2) // .into_iter(), // ); + display.draw( + Rect::new(Coord::new(32, 32), Coord::new(64, 64)) + .with_fill(Some(Color::Black)) + .into_iter(), + ); // // draw white on black background // display.draw( @@ -194,6 +199,8 @@ fn main() -> Result<(), std::io::Error> { // delay.delay_ms(1_000u16); // } + display.update(&mut delay).expect("error updating display"); + println!("update..."); println!("Finished - going to sleep"); display.deep_sleep() diff --git a/src/display.rs b/src/display.rs index 1aacc2a..949fd20 100644 --- a/src/display.rs +++ b/src/display.rs @@ -64,7 +64,8 @@ impl Display where I: DisplayInterface { Command::DummyLinePeriod(0x07).execute(&mut self.interface)?; Command::GateLineWidth(0x04).execute(&mut self.interface)?; - Command::SourceDrivingVoltage(0x2D, 0xB2, 0x22).execute(&mut self.interface)?; + // Command::GateDrivingVoltage(0b10000 | 0b0001); + // Command::SourceDrivingVoltage(0x2D, 0xB2, 0x22).execute(&mut self.interface)?; Command::WriteVCOM(0x3C).execute(&mut self.interface)?; // POR is HiZ. Need pull from config