mirror of
https://github.com/yuri91/ili9341-rs.git
synced 2024-11-25 08:00:59 +00:00
Fix formatting
This commit is contained in:
parent
d9ab0601b7
commit
6056b3db22
1 changed files with 9 additions and 0 deletions
|
@ -165,18 +165,22 @@ impl<SpiE, PinE, IFACE, RESET> Ili9341<IFACE, RESET>
|
||||||
delay.delay_ms(200);
|
delay.delay_ms(200);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn command(&mut self, cmd: Command, args: &[u8]) -> Result<(), Error<SpiE, PinE>> {
|
fn command(&mut self, cmd: Command, args: &[u8]) -> Result<(), Error<SpiE, PinE>> {
|
||||||
self.interface.write(cmd as u8, args)
|
self.interface.write(cmd as u8, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_iter<I: IntoIterator<Item = u16>>(
|
fn write_iter<I: IntoIterator<Item = u16>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
data: I,
|
data: I,
|
||||||
) -> Result<(), Error<SpiE, PinE>> {
|
) -> Result<(), Error<SpiE, PinE>> {
|
||||||
self.interface.write_iter(Command::MemoryWrite as u8, data)
|
self.interface.write_iter(Command::MemoryWrite as u8, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_raw(&mut self, data: &[u8]) -> Result<(), Error<SpiE, PinE>> {
|
fn write_raw(&mut self, data: &[u8]) -> Result<(), Error<SpiE, PinE>> {
|
||||||
self.interface.write(Command::MemoryWrite as u8, data)
|
self.interface.write(Command::MemoryWrite as u8, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_window(&mut self, x0: u16, y0: u16, x1: u16, y1: u16) -> Result<(), Error<SpiE, PinE>> {
|
fn set_window(&mut self, x0: u16, y0: u16, x1: u16, y1: u16) -> Result<(), Error<SpiE, PinE>> {
|
||||||
self.command(
|
self.command(
|
||||||
Command::ColumnAddressSet,
|
Command::ColumnAddressSet,
|
||||||
|
@ -198,6 +202,7 @@ impl<SpiE, PinE, IFACE, RESET> Ili9341<IFACE, RESET>
|
||||||
)?;
|
)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw a rectangle on the screen, represented by top-left corner (x0, y0)
|
/// Draw a rectangle on the screen, represented by top-left corner (x0, y0)
|
||||||
/// and bottom-right corner (x1, y1).
|
/// and bottom-right corner (x1, y1).
|
||||||
///
|
///
|
||||||
|
@ -218,6 +223,7 @@ impl<SpiE, PinE, IFACE, RESET> Ili9341<IFACE, RESET>
|
||||||
self.set_window(x0, y0, x1, y1)?;
|
self.set_window(x0, y0, x1, y1)?;
|
||||||
self.write_iter(data)
|
self.write_iter(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw a rectangle on the screen, represented by top-left corner (x0, y0)
|
/// Draw a rectangle on the screen, represented by top-left corner (x0, y0)
|
||||||
/// and bottom-right corner (x1, y1).
|
/// and bottom-right corner (x1, y1).
|
||||||
///
|
///
|
||||||
|
@ -239,6 +245,7 @@ impl<SpiE, PinE, IFACE, RESET> Ili9341<IFACE, RESET>
|
||||||
self.set_window(x0, y0, x1, y1)?;
|
self.set_window(x0, y0, x1, y1)?;
|
||||||
self.write_raw(data)
|
self.write_raw(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Change the orientation of the screen
|
/// Change the orientation of the screen
|
||||||
pub fn set_orientation(&mut self, mode: Orientation) -> Result<(), Error<SpiE, PinE>> {
|
pub fn set_orientation(&mut self, mode: Orientation) -> Result<(), Error<SpiE, PinE>> {
|
||||||
match mode {
|
match mode {
|
||||||
|
@ -264,10 +271,12 @@ impl<SpiE, PinE, IFACE, RESET> Ili9341<IFACE, RESET>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the current screen width. It can change based on the current orientation
|
/// Get the current screen width. It can change based on the current orientation
|
||||||
pub fn width(&self) -> usize {
|
pub fn width(&self) -> usize {
|
||||||
self.width
|
self.width
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the current screen heighth. It can change based on the current orientation
|
/// Get the current screen heighth. It can change based on the current orientation
|
||||||
pub fn height(&self) -> usize {
|
pub fn height(&self) -> usize {
|
||||||
self.height
|
self.height
|
||||||
|
|
Loading…
Reference in a new issue