Pretty print commands and parameters in the same format as the datasheet

This commit is contained in:
Corey Vixie 2020-03-29 12:54:35 -07:00
parent f46a5a5c2d
commit 5807c7a81c
2 changed files with 4 additions and 3 deletions

View File

@ -21,7 +21,7 @@ use crate::panel::Mode;
/// transferred by the D/CX pin. If D/CX is “low”, the transmission byte is
/// interpreted as a command byte. If D/CX is “high”, the transmission byte
/// is command register as parameter.
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Command {
pub address: u8,
pub parameters: Vec<u8>,

View File

@ -34,12 +34,13 @@ impl ST7701S {
Ok(c) => {
let address = &c.serialize_address();
self.spi.write(&c.serialize_address());
println!("address {}", c.address);
println!("Address: {:#04X}", c.address);
for parameter in c.parameters {
self.spi.write(&Command::serialize_parameter(parameter));
println!("parameter {}", parameter);
println!("Parameter: {:08b}", parameter);
}
println!("--------------------");
}
Err(e) => println!("{}", e),
}