mirror of
https://github.com/yuri91/ili9341-rs.git
synced 2024-11-21 22:30:59 +00:00
Use constants for width and height, but not public
This commit is contained in:
parent
bfb6433370
commit
75991b4316
1 changed files with 12 additions and 12 deletions
24
src/lib.rs
24
src/lib.rs
|
@ -15,8 +15,8 @@ pub const MODE: Mode = Mode {
|
||||||
phase: Phase::CaptureOnFirstTransition,
|
phase: Phase::CaptureOnFirstTransition,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const WIDTH: u16 = 240;
|
const WIDTH: usize = 240;
|
||||||
pub const HEIGHT: u16 = 320;
|
const HEIGHT: usize = 320;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error<E> {
|
pub enum Error<E> {
|
||||||
|
@ -52,8 +52,8 @@ where
|
||||||
cs,
|
cs,
|
||||||
dc,
|
dc,
|
||||||
reset,
|
reset,
|
||||||
width: 240,
|
width: WIDTH,
|
||||||
height: 320,
|
height: HEIGHT,
|
||||||
};
|
};
|
||||||
|
|
||||||
ili9341.hard_reset(delay);
|
ili9341.hard_reset(delay);
|
||||||
|
@ -178,23 +178,23 @@ where
|
||||||
pub fn set_orientation(&mut self, mode: Orientation) -> Result<(), Error<E>> {
|
pub fn set_orientation(&mut self, mode: Orientation) -> Result<(), Error<E>> {
|
||||||
match mode {
|
match mode {
|
||||||
Orientation::Portrait => {
|
Orientation::Portrait => {
|
||||||
self.width = 240;
|
self.width = WIDTH;
|
||||||
self.height = 320;
|
self.height = HEIGHT;
|
||||||
self.command(Command::MemoryAccessControl, &[0x40|0x08])
|
self.command(Command::MemoryAccessControl, &[0x40|0x08])
|
||||||
},
|
},
|
||||||
Orientation::Landscape => {
|
Orientation::Landscape => {
|
||||||
self.width = 320;
|
self.width = HEIGHT;
|
||||||
self.height = 240;
|
self.height = WIDTH;
|
||||||
self.command(Command::MemoryAccessControl, &[0x20|0x08])
|
self.command(Command::MemoryAccessControl, &[0x20|0x08])
|
||||||
},
|
},
|
||||||
Orientation::PortraitFlipped => {
|
Orientation::PortraitFlipped => {
|
||||||
self.width = 240;
|
self.width = WIDTH;
|
||||||
self.height = 320;
|
self.height = HEIGHT;
|
||||||
self.command(Command::MemoryAccessControl, &[0x80|0x08])
|
self.command(Command::MemoryAccessControl, &[0x80|0x08])
|
||||||
},
|
},
|
||||||
Orientation::LandscapeFlipped => {
|
Orientation::LandscapeFlipped => {
|
||||||
self.width = 320;
|
self.width = HEIGHT;
|
||||||
self.height = 240;
|
self.height = WIDTH;
|
||||||
self.command(Command::MemoryAccessControl, &[0x40|0x80|0x20|0x08])
|
self.command(Command::MemoryAccessControl, &[0x40|0x80|0x20|0x08])
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue