[][src]Struct st7789::ST7789

pub struct ST7789<SPI, DC, RST, DELAY> where
    SPI: Write<u8>,
    DC: OutputPin,
    RST: OutputPin,
    DELAY: DelayUs<u32>, 
{ /* fields omitted */ }

ST7789 driver to connect to TFT displays.

Methods

impl<SPI, DC, RST, DELAY> ST7789<SPI, DC, RST, DELAY> where
    SPI: Write<u8>,
    DC: OutputPin,
    RST: OutputPin,
    DELAY: DelayUs<u32>, 
[src]

pub fn new(
    spi: SPI,
    dc: DC,
    rst: RST,
    size_x: u16,
    size_y: u16,
    delay: DELAY
) -> Self
[src]

Creates a new ST7789 driver instance

Arguments

  • spi - an SPI interface to use for talking to the display
  • dc - data/clock pin switch
  • rst - display hard reset pin
  • size_x - x axis resolution of the display in pixels
  • size_y - y axis resolution of the display in pixels
  • delay - delay provider, required for proper RST and DC timings

pub fn init(&mut self) -> Result<(), Error<SPI::Error, DC::Error, RST::Error>>[src]

Runs commands to initialize the display

pub fn hard_reset(
    &mut self
) -> Result<(), Error<SPI::Error, DC::Error, RST::Error>>
[src]

Performs a hard reset using the RST pin sequence

pub fn set_orientation(
    &mut self,
    orientation: &Orientation
) -> Result<(), Error<SPI::Error, DC::Error, RST::Error>>
[src]

Sets display orientation

pub fn set_pixel(
    &mut self,
    x: u16,
    y: u16,
    color: u16
) -> Result<(), Error<SPI::Error, DC::Error, RST::Error>>
[src]

Sets a pixel color at the given coords.

Arguments

  • x - x coordinate
  • y - y coordinate
  • color - the Rgb565 color value

pub fn set_pixels<T>(
    &mut self,
    sx: u16,
    sy: u16,
    ex: u16,
    ey: u16,
    colors: T
) -> Result<(), Error<SPI::Error, DC::Error, RST::Error>> where
    T: IntoIterator<Item = u16>, 
[src]

Sets pixel colors in given rectangle bounds.

Arguments

  • sx - x coordinate start
  • sy - y coordinate start
  • ex - x coordinate end
  • ey - y coordinate end
  • colors - anything that can provide IntoIterator<Item = u16> to iterate over pixel data

Trait Implementations

impl<SPI, DC, RST, DELAY> DrawTarget<Rgb565> for ST7789<SPI, DC, RST, DELAY> where
    SPI: Write<u8>,
    DC: OutputPin,
    RST: OutputPin,
    DELAY: DelayUs<u32>, 
[src]

type Error = Error<SPI::Error, DC::Error, RST::Error>

Error type to return when a drawing operation fails. Read more

Auto Trait Implementations

impl<SPI, DC, RST, DELAY> Send for ST7789<SPI, DC, RST, DELAY> where
    DC: Send,
    DELAY: Send,
    RST: Send,
    SPI: Send

impl<SPI, DC, RST, DELAY> Sync for ST7789<SPI, DC, RST, DELAY> where
    DC: Sync,
    DELAY: Sync,
    RST: Sync,
    SPI: Sync

impl<SPI, DC, RST, DELAY> Unpin for ST7789<SPI, DC, RST, DELAY> where
    DC: Unpin,
    DELAY: Unpin,
    RST: Unpin,
    SPI: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.