[−][src]Struct st7735::ST7734
ST7735 driver to connect to TFT displays. The driver allows to draw simple shapes, and reset the display.
Currently, there is support for using hardware SPI as well as software SPI to communicate to the display. Note that using hardware SPI is much faster and recommended to be used if supported by the connecting device.
Examples
let mut display = ST7734::new_with_spi("/dev/spidev0.0", 25); display.set_orientation(&Orientation::Portrait); display.draw_rect(30, 30, 60, 70, &Color::from_default(DefaultColor::Blue));
Methods
impl ST7734
[src]
pub fn new_with_spi(spi: &str, dc: u64) -> ST7734
[src]
Creates a new driver instance that uses hardware SPI.
Example
let mut display = ST7734::new_with_spi("/dev/spidev0.0", 25);
pub fn new(rst: Option<u64>, clk: u64, dc: u64, mosi: u64) -> ST7734
[src]
Creates a new driver instance that uses software SPI using the provided pins.
Example
let display = ST7734::new(None, 24, 25, 23);
pub fn hard_reset(&self)
[src]
Resets the display using the rst pin.
Example
let display = ST7734::new(21, 24, 25, 23); display.hard_reset();
pub fn set_orientation(&mut self, orientation: &Orientation)
[src]
Changes the display orientation.
Example
let display = ST7734::new(None, 24, 25, 23); display.set_orientation(&Orientation::Portrait);
pub fn draw_pixel(&mut self, x: u16, y: u16, color: &Color)
[src]
Draws a single pixel with the specified color
at the defined coordinates on the display.
Example
let display = ST7734::new(None, 24, 25, 23); display.draw_pixel(50, 50, 0xFF0000);
pub fn draw_filled_rect(
&mut self,
x0: u16,
y0: u16,
x1: u16,
y1: u16,
color: &Color
)
[src]
&mut self,
x0: u16,
y0: u16,
x1: u16,
y1: u16,
color: &Color
)
Draws a filled rectangle with the specified color
on the display.
Example
let display = ST7734::new(None, 24, 25, 23); display.draw_filled_rect(50, 20, 80, 40, 0xFF0000);
pub fn draw_rect(&mut self, x0: u16, y0: u16, x1: u16, y1: u16, color: &Color)
[src]
Draws a rectangle with the specified color
as border color on the display.
Example
let display = ST7734::new(None, 24, 25, 23); display.draw_rect(50, 20, 80, 40, 0xFF0000);
pub fn draw_horizontal_line(&mut self, x0: u16, x1: u16, y: u16, color: &Color)
[src]
Draws a horizontal with the specified color
between the provided coordinates on the display.
Example
let display = ST7734::new(None, 24, 25, 23); display.draw_horizontal_line(50, 20, 80, 0xFF0000);
pub fn draw_vertical_line(&mut self, x: u16, y0: u16, y1: u16, color: &Color)
[src]
Draws a vertical with the specified color
between the provided coordinates on the display.
Example
let display = ST7734::new(None, 24, 25, 23); display.draw_vertical_line(50, 20, 80, 0xFF0000);
pub fn draw_line(&mut self, x0: u16, y0: u16, x1: u16, y1: u16, color: &Color)
[src]
Draws a line with the specified color
between the provided coordinates on the display.
Example
let display = ST7734::new(None, 24, 25, 23); display.draw_line(50, 20, 80, 80, 0xFF0000);
pub fn draw_circle(
&mut self,
x_pos: u16,
y_pos: u16,
radius: u16,
color: &Color
)
[src]
&mut self,
x_pos: u16,
y_pos: u16,
radius: u16,
color: &Color
)
Draws a circle whose border has the specified color
around the provided coordinates on the display.
Example
let display = ST7734::new(None, 24, 25, 23); display.draw_circle(50, 20, 10, 0xFF0000);
pub fn draw_filled_circle(
&mut self,
x_pos: u16,
y_pos: u16,
radius: u16,
color: &Color
)
[src]
&mut self,
x_pos: u16,
y_pos: u16,
radius: u16,
color: &Color
)
Draws a circle filled with the specified color
around the provided coordinates on the display.
Example
let display = ST7734::new(None, 24, 25, 23); display.draw_filled_circle(50, 20, 10, 0xFF0000);
pub fn draw_character<F: Font>(
&mut self,
c: char,
x: u16,
y: u16,
color: &Color,
_font: F
)
[src]
&mut self,
c: char,
x: u16,
y: u16,
color: &Color,
_font: F
)
Draws a character filled with the specified color
and the defined font on the display.
Example
let display = ST7734::new(None, 24, 25, 23); display.draw_character(50, 20, 10, 0xFF0000, &Font57);
pub fn fill_screen(&mut self, color: &Color)
[src]
Fills the entire screen with the specified color
.
Example
let display = ST7734::new(None, 24, 25, 23); display.fill_screen(0xFF0000);
pub fn clear_screen(&mut self)
[src]
Fills the entire screen black.
Example
let display = ST7734::new(None, 24, 25, 23); display.clear_screen();
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,