pub struct Display<DI, MODEL, RST>{ /* private fields */ }
Expand description
Display driver to connect to TFT displays.
Implementations§
Source§impl<DI, M, RST> Display<DI, M, RST>
impl<DI, M, RST> Display<DI, M, RST>
Sourcepub fn orientation(&self) -> Orientation
pub fn orientation(&self) -> Orientation
Returns currently set options::Orientation
Sourcepub async fn set_orientation(
&mut self,
orientation: Orientation,
) -> Result<(), DI::Error>
pub async fn set_orientation( &mut self, orientation: Orientation, ) -> Result<(), DI::Error>
Sets display options::Orientation with mirror image parameter
§Examples
use lcd_async::options::{Orientation, Rotation};
display.set_orientation(Orientation::default().rotate(Rotation::Deg180)).await.unwrap();
Sourcepub async fn show_raw_data<DW>(
&mut self,
x: u16,
y: u16,
width: u16,
height: u16,
pixel_data: &[DW],
) -> Result<(), DI::Error>
pub async fn show_raw_data<DW>( &mut self, x: u16, y: u16, width: u16, height: u16, pixel_data: &[DW], ) -> Result<(), DI::Error>
Sends a raw pixel data slice to the specified rectangular region of the display.
Sourcepub async fn set_vertical_scroll_region(
&mut self,
top_fixed_area: u16,
bottom_fixed_area: u16,
) -> Result<(), DI::Error>
pub async fn set_vertical_scroll_region( &mut self, top_fixed_area: u16, bottom_fixed_area: u16, ) -> Result<(), DI::Error>
Sets the vertical scroll region.
The top_fixed_area
and bottom_fixed_area
arguments can be used to
define an area on the top and/or bottom of the display which won’t be
affected by scrolling.
Note that this method is not affected by the current display orientation and will always scroll vertically relative to the default display orientation.
The combined height of the fixed area must not larger than the height of the framebuffer height in the default orientation.
After the scrolling region is defined the set_vertical_scroll_offset
can be
used to scroll the display.
Sourcepub async fn set_vertical_scroll_offset(
&mut self,
offset: u16,
) -> Result<(), DI::Error>
pub async fn set_vertical_scroll_offset( &mut self, offset: u16, ) -> Result<(), DI::Error>
Sets the vertical scroll offset.
Setting the vertical scroll offset shifts the vertical scroll region
upwards by offset
pixels.
Use set_vertical_scroll_region
to setup the scroll region, before
using this method.
Sourcepub fn release(self) -> (DI, M, Option<RST>)
pub fn release(self) -> (DI, M, Option<RST>)
Release resources allocated to this driver back. This returns the display interface, reset pin and and the model deconstructing the driver.
Sourcepub async fn set_tearing_effect(
&mut self,
tearing_effect: TearingEffect,
) -> Result<(), DI::Error>
pub async fn set_tearing_effect( &mut self, tearing_effect: TearingEffect, ) -> Result<(), DI::Error>
Configures the tearing effect output.
Sourcepub fn is_sleeping(&self) -> bool
pub fn is_sleeping(&self) -> bool
Returns true
if display is currently set to sleep.
Sourcepub async fn sleep<D: DelayNs>(
&mut self,
delay: &mut D,
) -> Result<(), DI::Error>
pub async fn sleep<D: DelayNs>( &mut self, delay: &mut D, ) -> Result<(), DI::Error>
Puts the display to sleep, reducing power consumption. Need to call Self::wake before issuing other commands
Sourcepub async fn wake<D: DelayNs>(&mut self, delay: &mut D) -> Result<(), DI::Error>
pub async fn wake<D: DelayNs>(&mut self, delay: &mut D) -> Result<(), DI::Error>
Wakes the display after it’s been set to sleep via Self::sleep
Sourcepub unsafe fn dcs(&mut self) -> &mut DI
pub unsafe fn dcs(&mut self) -> &mut DI
Returns the DCS interface for sending raw commands.
§Safety
Sending raw commands to the controller can lead to undefined behaviour, because the rest of the code isn’t aware of any state changes that were caused by sending raw commands. The user must ensure that the state of the controller isn’t altered in a way that interferes with the normal operation of this crate.