pub struct ST7789<DI, RST, BL>{ /* private fields */ }Expand description
ST7789 driver to connect to TFT displays.
Implementations§
Source§impl<DI, RST, BL, PinE> ST7789<DI, RST, BL>
impl<DI, RST, BL, PinE> ST7789<DI, RST, BL>
Sourcepub fn new(
di: DI,
rst: Option<RST>,
bl: Option<BL>,
size_x: u16,
size_y: u16,
) -> Self
pub fn new( di: DI, rst: Option<RST>, bl: Option<BL>, size_x: u16, size_y: u16, ) -> Self
Creates a new ST7789 driver instance
§Arguments
di- a display interface for talking with the displayrst- display hard reset pinbl- backlight pinsize_x- x axis resolution of the display in pixelssize_y- y axis resolution of the display in pixels
pub fn set_offset(&mut self, offset_x: u16, offset_y: u16)
Sourcepub fn init(
&mut self,
delay_source: &mut impl DelayUs<u32>,
) -> Result<(), Error<PinE>>
pub fn init( &mut self, delay_source: &mut impl DelayUs<u32>, ) -> Result<(), Error<PinE>>
Runs commands to initialize the display
§Arguments
delay_source- mutable reference to a delay provider
Sourcepub fn hard_reset(
&mut self,
delay_source: &mut impl DelayUs<u32>,
) -> Result<(), Error<PinE>>
pub fn hard_reset( &mut self, delay_source: &mut impl DelayUs<u32>, ) -> Result<(), Error<PinE>>
Performs a hard reset using the RST pin sequence
§Arguments
delay_source- mutable reference to a delay provider
pub fn set_backlight( &mut self, state: BacklightState, delay_source: &mut impl DelayUs<u32>, ) -> Result<(), Error<PinE>>
Sourcepub fn orientation(&self) -> Orientation
pub fn orientation(&self) -> Orientation
Returns currently set orientation
Sourcepub fn set_orientation(
&mut self,
orientation: Orientation,
) -> Result<(), Error<PinE>>
pub fn set_orientation( &mut self, orientation: Orientation, ) -> Result<(), Error<PinE>>
Sets display orientation
Sourcepub fn set_pixel(
&mut self,
x: u16,
y: u16,
color: u16,
) -> Result<(), Error<PinE>>
pub fn set_pixel( &mut self, x: u16, y: u16, color: u16, ) -> Result<(), Error<PinE>>
Sets a pixel color at the given coords.
§Arguments
x- x coordinatey- y coordinatecolor- the Rgb565 color value
Sourcepub fn set_pixels<T>(
&mut self,
sx: u16,
sy: u16,
ex: u16,
ey: u16,
colors: T,
) -> Result<(), Error<PinE>>where
T: IntoIterator<Item = u16>,
pub fn set_pixels<T>(
&mut self,
sx: u16,
sy: u16,
ex: u16,
ey: u16,
colors: T,
) -> Result<(), Error<PinE>>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
Sourcepub fn release(self) -> (DI, Option<RST>, Option<BL>)
pub fn release(self) -> (DI, Option<RST>, Option<BL>)
Release resources allocated to this driver back. This returns the display interface and the RST pin deconstructing the driver.
Sourcepub fn set_tearing_effect(
&mut self,
tearing_effect: TearingEffect,
) -> Result<(), Error<PinE>>
pub fn set_tearing_effect( &mut self, tearing_effect: TearingEffect, ) -> Result<(), Error<PinE>>
Configures the tearing effect output.
Trait Implementations§
Source§impl<DI, RST, BL, PinE> DrawTarget for ST7789<DI, RST, BL>
impl<DI, RST, BL, PinE> DrawTarget for ST7789<DI, RST, BL>
Source§fn draw_iter<T>(&mut self, item: T) -> Result<(), Self::Error>
fn draw_iter<T>(&mut self, item: T) -> Result<(), Self::Error>
Draw individual pixels to the display without a defined order. Read more
Source§fn fill_contiguous<I>(
&mut self,
area: &Rectangle,
colors: I,
) -> Result<(), Self::Error>where
I: IntoIterator<Item = Self::Color>,
fn fill_contiguous<I>(
&mut self,
area: &Rectangle,
colors: I,
) -> Result<(), Self::Error>where
I: IntoIterator<Item = Self::Color>,
Fill a given area with an iterator providing a contiguous stream of pixel colors. Read more
Auto Trait Implementations§
impl<DI, RST, BL> Freeze for ST7789<DI, RST, BL>
impl<DI, RST, BL> RefUnwindSafe for ST7789<DI, RST, BL>
impl<DI, RST, BL> Send for ST7789<DI, RST, BL>
impl<DI, RST, BL> Sync for ST7789<DI, RST, BL>
impl<DI, RST, BL> Unpin for ST7789<DI, RST, BL>
impl<DI, RST, BL> UnwindSafe for ST7789<DI, RST, BL>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> Dimensions for Twhere
T: OriginDimensions,
impl<T> Dimensions for Twhere
T: OriginDimensions,
Source§fn bounding_box(&self) -> Rectangle
fn bounding_box(&self) -> Rectangle
Returns the bounding box.
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.