Use default source and gate voltages (fixes red)

This commit is contained in:
Wesley Moore 2018-11-16 22:58:55 +11:00
parent bc01c19c86
commit cf4bf8ce76
No known key found for this signature in database
GPG key ID: BF67766C0BC2D0EE
2 changed files with 22 additions and 14 deletions

View file

@ -14,7 +14,7 @@ extern crate embedded_graphics;
use embedded_graphics::coord::Coord; use embedded_graphics::coord::Coord;
use embedded_graphics::fonts::{Font12x16, Font6x8}; use embedded_graphics::fonts::{Font12x16, Font6x8};
use embedded_graphics::prelude::*; use embedded_graphics::prelude::*;
use embedded_graphics::primitives::{Circle, Line}; use embedded_graphics::primitives::{Circle, Line, Rect};
use embedded_graphics::Drawing; use embedded_graphics::Drawing;
// HAL (Traits) // HAL (Traits)
@ -84,14 +84,11 @@ fn main() -> Result<(), std::io::Error> {
Font12x16::render_str("Hello Rust") Font12x16::render_str("Hello Rust")
.with_stroke(Some(Color::Red)) .with_stroke(Some(Color::Red))
.with_fill(Some(Color::White)) .with_fill(Some(Color::White))
.translate(Coord::new(5, 10)) .translate(Coord::new(5, 88))
.into_iter(), .into_iter(),
); );
println!("draw"); println!("draw");
display.update(&mut delay).expect("error updating display");
println!("update...");
// display.set_rotation(DisplayRotation::Rotate90); // display.set_rotation(DisplayRotation::Rotate90);
// display.draw( // display.draw(
// Font::render_str("Rotate 90!") // 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:"); // println!("Now test new graphics with default rotation and some special stuff:");
// display.clear_buffer(Color::White); // 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( // 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(Some(Color::Black))
// .with_stroke_width(2)
// .into_iter(), // .into_iter(),
// ); // );
// display.draw( // display.draw(
// Line::new(Coord::new(64, 64), Coord::new(0, 64)) // Line::new(Coord::new(32, 32), Coord::new(40, 40))
// .with_stroke(Some(Color::Black))
// .into_iter(),
// );
// display.draw(
// Line::new(Coord::new(64, 64), Coord::new(80, 80))
// .with_stroke(Some(Color::Black)) // .with_stroke(Some(Color::Black))
// .with_stroke_width(2)
// .into_iter(), // .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 // // draw white on black background
// display.draw( // display.draw(
@ -194,6 +199,8 @@ fn main() -> Result<(), std::io::Error> {
// delay.delay_ms(1_000u16); // delay.delay_ms(1_000u16);
// } // }
display.update(&mut delay).expect("error updating display");
println!("update...");
println!("Finished - going to sleep"); println!("Finished - going to sleep");
display.deep_sleep() display.deep_sleep()

View file

@ -64,7 +64,8 @@ impl<I> Display<I> where I: DisplayInterface {
Command::DummyLinePeriod(0x07).execute(&mut self.interface)?; Command::DummyLinePeriod(0x07).execute(&mut self.interface)?;
Command::GateLineWidth(0x04).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)?; Command::WriteVCOM(0x3C).execute(&mut self.interface)?;
// POR is HiZ. Need pull from config // POR is HiZ. Need pull from config