[−][src]Struct ili9341::Ili9341
There are two method for drawing to the screen: draw_raw and draw_iter.
In both cases the expected pixel format is rgb565.
The hardware makes it efficient to draw rectangles on the screen.
What happens is the following:
- A drawing window is prepared (with the 2 opposite corner coordinates)
- The starting point for drawint is the top left corner of this window
- Every pair of bytes received is intepreted as a pixel value in rgb565
- As soon as a pixel is received, an internal counter is incremented, and the next word will fill the next pixel (the adjacent on the right, or the first of the next row if the row ended)
Methods
impl<E, SPI, CS, DC, RESET> Ili9341<SPI, CS, DC, RESET> where
SPI: Transfer<u8, Error = E> + Write<u8, Error = E>,
CS: OutputPin,
DC: OutputPin,
RESET: OutputPin,
[src]
SPI: Transfer<u8, Error = E> + Write<u8, Error = E>,
CS: OutputPin,
DC: OutputPin,
RESET: OutputPin,
pub fn new<DELAY: DelayMs<u16>>(
spi: SPI,
cs: CS,
dc: DC,
reset: RESET,
delay: &mut DELAY
) -> Result<Self, Error<E>>
[src]
spi: SPI,
cs: CS,
dc: DC,
reset: RESET,
delay: &mut DELAY
) -> Result<Self, Error<E>>
pub fn draw_iter<I: IntoIterator<Item = u16>>(
&mut self,
x0: u16,
y0: u16,
x1: u16,
y1: u16,
data: I
) -> Result<(), Error<E>>
[src]
&mut self,
x0: u16,
y0: u16,
x1: u16,
y1: u16,
data: I
) -> Result<(), Error<E>>
Draw a rectangle on the screen, represented by top-left corner (x0, y0) and bottom-right corner (x1, y1).
The border is included.
This method accepts an iterator of rgb565 pixel values.
The iterator is useful to avoid wasting memory by holding a buffer for the whole screen when it is not necessary.
pub fn draw_raw(
&mut self,
x0: u16,
y0: u16,
x1: u16,
y1: u16,
data: &[u8]
) -> Result<(), Error<E>>
[src]
&mut self,
x0: u16,
y0: u16,
x1: u16,
y1: u16,
data: &[u8]
) -> Result<(), Error<E>>
Draw a rectangle on the screen, represented by top-left corner (x0, y0) and bottom-right corner (x1, y1).
The border is included.
This method accepts a raw buffer of bytes that will be copied to the screen video memory.
The expected format is rgb565, and the two bytes for a pixel are in big endian order.
pub fn set_orientation(&mut self, mode: Orientation) -> Result<(), Error<E>>
[src]
Change the orientation of the screen
pub fn width(&self) -> usize
[src]
Get the current screen width. It can change based on the current orientation
pub fn height(&self) -> usize
[src]
Get the current screen heighth. It can change based on the current orientation
Trait Implementations
impl<E, SPI, CS, DC, RESET> Drawing<PixelColorU16> for Ili9341<SPI, CS, DC, RESET> where
SPI: Transfer<u8, Error = E> + Write<u8, Error = E>,
CS: OutputPin,
DC: OutputPin,
RESET: OutputPin,
E: Debug,
[src]
SPI: Transfer<u8, Error = E> + Write<u8, Error = E>,
CS: OutputPin,
DC: OutputPin,
RESET: OutputPin,
E: Debug,
fn draw<T>(&mut self, item_pixels: T) where
T: Iterator<Item = Pixel<PixelColorU16>>,
[src]
T: Iterator<Item = Pixel<PixelColorU16>>,
Auto Trait Implementations
impl<SPI, CS, DC, RESET> Send for Ili9341<SPI, CS, DC, RESET> where
CS: Send,
DC: Send,
RESET: Send,
SPI: Send,
CS: Send,
DC: Send,
RESET: Send,
SPI: Send,
impl<SPI, CS, DC, RESET> Sync for Ili9341<SPI, CS, DC, RESET> where
CS: Sync,
DC: Sync,
RESET: Sync,
SPI: Sync,
CS: Sync,
DC: Sync,
RESET: Sync,
SPI: Sync,
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,