[−][src]Struct st7789::ST7789
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]
SPI: Write<u8>,
DC: OutputPin,
RST: OutputPin,
DELAY: DelayUs<u32>,
pub fn new(
spi: SPI,
dc: DC,
rst: RST,
size_x: u16,
size_y: u16,
delay: DELAY
) -> Self
[src]
spi: SPI,
dc: DC,
rst: RST,
size_x: u16,
size_y: u16,
delay: DELAY
) -> Self
Creates a new ST7789 driver instance
Arguments
spi
- an SPI interface to use for talking to the displaydc
- data/clock pin switchrst
- display hard reset pinsize_x
- x axis resolution of the display in pixelssize_y
- y axis resolution of the display in pixelsdelay
- 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]
&mut self
) -> Result<(), Error<SPI::Error, DC::Error, RST::Error>>
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]
&mut self,
orientation: &Orientation
) -> Result<(), Error<SPI::Error, DC::Error, RST::Error>>
Sets display orientation
pub fn set_pixel(
&mut self,
x: u16,
y: u16,
color: u16
) -> Result<(), Error<SPI::Error, DC::Error, RST::Error>>
[src]
&mut self,
x: u16,
y: u16,
color: u16
) -> Result<(), Error<SPI::Error, DC::Error, RST::Error>>
Sets a pixel color at the given coords.
Arguments
x
- x coordinatey
- y coordinatecolor
- 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]
&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>,
Sets pixel colors in given rectangle bounds.
Arguments
sx
- x coordinate startsy
- y coordinate startex
- x coordinate endey
- y coordinate endcolors
- anything that can provideIntoIterator<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]
SPI: Write<u8>,
DC: OutputPin,
RST: OutputPin,
DELAY: DelayUs<u32>,
type Error = Error<SPI::Error, DC::Error, RST::Error>
Error type to return when a drawing operation fails. Read more
fn draw_pixel(&mut self, pixel: Pixel<Rgb565>) -> Result<(), Self::Error>
[src]
fn draw_iter<T>(&mut self, item: T) -> Result<(), Self::Error> where
T: IntoIterator<Item = Pixel<Rgb565>>,
[src]
T: IntoIterator<Item = Pixel<Rgb565>>,
fn draw_rectangle(
&mut self,
item: &Styled<Rectangle, PrimitiveStyle<Rgb565>>
) -> Result<(), Self::Error>
[src]
&mut self,
item: &Styled<Rectangle, PrimitiveStyle<Rgb565>>
) -> Result<(), Self::Error>
fn draw_image<'a, 'b, I>(
&mut self,
item: &'a Image<'b, I, Rgb565>
) -> Result<(), Self::Error> where
&'b I: IntoPixelIter<Rgb565>,
I: ImageDimensions,
[src]
&mut self,
item: &'a Image<'b, I, Rgb565>
) -> Result<(), Self::Error> where
&'b I: IntoPixelIter<Rgb565>,
I: ImageDimensions,
fn size(&self) -> Size
[src]
fn clear(&mut self, color: C) -> Result<(), Self::Error>
[src]
fn draw_line(
&mut self,
item: &Styled<Line, PrimitiveStyle<C>>
) -> Result<(), Self::Error>
[src]
&mut self,
item: &Styled<Line, PrimitiveStyle<C>>
) -> Result<(), Self::Error>
fn draw_triangle(
&mut self,
item: &Styled<Triangle, PrimitiveStyle<C>>
) -> Result<(), Self::Error>
[src]
&mut self,
item: &Styled<Triangle, PrimitiveStyle<C>>
) -> Result<(), Self::Error>
fn draw_circle(
&mut self,
item: &Styled<Circle, PrimitiveStyle<C>>
) -> Result<(), Self::Error>
[src]
&mut self,
item: &Styled<Circle, PrimitiveStyle<C>>
) -> Result<(), Self::Error>
Auto Trait Implementations
impl<SPI, DC, RST, DELAY> Send for ST7789<SPI, DC, RST, DELAY> where
DC: Send,
DELAY: Send,
RST: Send,
SPI: Send,
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,
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,
DC: Unpin,
DELAY: Unpin,
RST: Unpin,
SPI: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
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> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,