From: Tilman Sauerbeck Date: Mon, 30 Dec 2019 17:18:08 +0000 (+0100) Subject: common: Tweak bit order of screen data. X-Git-Url: http://git.code-monkey.de/?a=commitdiff_plain;h=9a546fcb6aaae061f51546dd538883a99c419fce;p=gps-watch.git common: Tweak bit order of screen data. The left-most pixel is now defined by the most significant bit. This is a more intuitive representation than what we had before. --- diff --git a/src/common/display.rs b/src/common/display.rs index 04f6c35..38eeaa9 100644 --- a/src/common/display.rs +++ b/src/common/display.rs @@ -157,10 +157,10 @@ impl Display { } pub fn draw(&mut self, screen: &screen::Screen) { - let mut mask : u8 = 0x80; + let mut mask : u8 = 0x01; for col in 0..screen::WIDTH_PX { - mask = mask.rotate_left(1); + mask = mask.rotate_right(1); // Rotate by 90 degrees. // diff --git a/src/common/screen.rs b/src/common/screen.rs index 71425c4..3b890a1 100644 --- a/src/common/screen.rs +++ b/src/common/screen.rs @@ -29,6 +29,8 @@ pub const WIDTH_BYTES: usize = (WIDTH_PX as usize + 7) / 8; pub const SIZE_BYTES: usize = HEIGHT_PX as usize * WIDTH_BYTES; pub struct Screen { + // Each byte corresponds to 8 pixels, with the MSB referring + // to the left-most pixel. pixels: [u8; SIZE_BYTES], }