From 75991b4316ec25e8bc40a5046bbc373c9b9241e4 Mon Sep 17 00:00:00 2001 From: Yuri Iozzelli Date: Sun, 4 Mar 2018 17:49:06 +0100 Subject: [PATCH] Use constants for width and height, but not public --- src/lib.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b86f49d..bf47c8d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,8 +15,8 @@ pub const MODE: Mode = Mode { phase: Phase::CaptureOnFirstTransition, }; -pub const WIDTH: u16 = 240; -pub const HEIGHT: u16 = 320; +const WIDTH: usize = 240; +const HEIGHT: usize = 320; #[derive(Debug)] pub enum Error { @@ -52,8 +52,8 @@ where cs, dc, reset, - width: 240, - height: 320, + width: WIDTH, + height: HEIGHT, }; ili9341.hard_reset(delay); @@ -178,23 +178,23 @@ where pub fn set_orientation(&mut self, mode: Orientation) -> Result<(), Error> { match mode { Orientation::Portrait => { - self.width = 240; - self.height = 320; + self.width = WIDTH; + self.height = HEIGHT; self.command(Command::MemoryAccessControl, &[0x40|0x08]) }, Orientation::Landscape => { - self.width = 320; - self.height = 240; + self.width = HEIGHT; + self.height = WIDTH; self.command(Command::MemoryAccessControl, &[0x20|0x08]) }, Orientation::PortraitFlipped => { - self.width = 240; - self.height = 320; + self.width = WIDTH; + self.height = HEIGHT; self.command(Command::MemoryAccessControl, &[0x80|0x08]) }, Orientation::LandscapeFlipped => { - self.width = 320; - self.height = 240; + self.width = HEIGHT; + self.height = WIDTH; self.command(Command::MemoryAccessControl, &[0x40|0x80|0x20|0x08]) }, }