pub struct ST7789<DI, RST, BL> where
DI: WriteOnlyDataCommand,
RST: OutputPin,
BL: OutputPin, { /* private fields */ }
Expand description
ST7789 driver to connect to TFT displays.
Implementations
sourceimpl<DI, RST, BL, PinE> ST7789<DI, RST, BL> where
DI: WriteOnlyDataCommand,
RST: OutputPin<Error = PinE>,
BL: OutputPin<Error = PinE>,
impl<DI, RST, BL, PinE> ST7789<DI, RST, BL> where
DI: WriteOnlyDataCommand,
RST: OutputPin<Error = PinE>,
BL: OutputPin<Error = PinE>,
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
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
sourceimpl<DI, RST, BL, PinE> DrawTarget for ST7789<DI, RST, BL> where
DI: WriteOnlyDataCommand,
RST: OutputPin<Error = PinE>,
BL: OutputPin<Error = PinE>,
impl<DI, RST, BL, PinE> DrawTarget for ST7789<DI, RST, BL> where
DI: WriteOnlyDataCommand,
RST: OutputPin<Error = PinE>,
BL: OutputPin<Error = PinE>,
sourcefn draw_iter<T>(&mut self, item: T) -> Result<(), Self::Error> where
T: IntoIterator<Item = Pixel<Rgb565>>,
fn draw_iter<T>(&mut self, item: T) -> Result<(), Self::Error> where
T: IntoIterator<Item = Pixel<Rgb565>>,
Draw individual pixels to the display without a defined order. Read more
sourcefn 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
sourceimpl<DI, RST, BL, PinE> OriginDimensions for ST7789<DI, RST, BL> where
DI: WriteOnlyDataCommand,
RST: OutputPin<Error = PinE>,
BL: OutputPin<Error = PinE>,
impl<DI, RST, BL, PinE> OriginDimensions for ST7789<DI, RST, BL> where
DI: WriteOnlyDataCommand,
RST: OutputPin<Error = PinE>,
BL: OutputPin<Error = PinE>,
Auto Trait Implementations
impl<DI, RST, BL> RefUnwindSafe for ST7789<DI, RST, BL> where
BL: RefUnwindSafe,
DI: RefUnwindSafe,
RST: RefUnwindSafe,
impl<DI, RST, BL> Send for ST7789<DI, RST, BL> where
BL: Send,
DI: Send,
RST: Send,
impl<DI, RST, BL> Sync for ST7789<DI, RST, BL> where
BL: Sync,
DI: Sync,
RST: Sync,
impl<DI, RST, BL> Unpin for ST7789<DI, RST, BL> where
BL: Unpin,
DI: Unpin,
RST: Unpin,
impl<DI, RST, BL> UnwindSafe for ST7789<DI, RST, BL> where
BL: UnwindSafe,
DI: UnwindSafe,
RST: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedAs for T
impl<T> CheckedAs for T
sourcefn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
sourcefn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
sourceimpl<T> Dimensions for T where
T: OriginDimensions,
impl<T> Dimensions for T where
T: OriginDimensions,
sourcefn bounding_box(&self) -> Rectangle
fn bounding_box(&self) -> Rectangle
Returns the bounding box.
sourceimpl<T> OverflowingAs for T
impl<T> OverflowingAs for T
sourcefn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
sourcefn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
sourceimpl<T> SaturatingAs for T
impl<T> SaturatingAs for T
sourcefn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
sourcefn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
sourcefn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
sourcefn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<T> WrappingAs for T
impl<T> WrappingAs for T
sourcefn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
sourcefn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.