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 fn set_orientation(&mut self, orientation: Orientation) -> Result<(), Error>
pub fn set_orientation(&mut self, orientation: Orientation) -> Result<(), Error>
Sets display options::Orientation with mirror image parameter
§Examples
use mipidsi::options::{Orientation, Rotation};
display.set_orientation(Orientation::default().rotate(Rotation::Deg180)).unwrap();
sourcepub fn set_pixels<T>(
&mut self,
sx: u16,
sy: u16,
ex: u16,
ey: u16,
colors: T
) -> Result<(), Error>where
T: IntoIterator<Item = M::ColorFormat>,
pub fn set_pixels<T>(
&mut self,
sx: u16,
sy: u16,
ex: u16,
ey: u16,
colors: T
) -> Result<(), Error>where
T: IntoIterator<Item = M::ColorFormat>,
Sets pixel colors in a rectangular region.
The color values from the colors
iterator will be drawn to the given region starting
at the top left corner and continuing, row first, to the bottom right corner. No bounds
checking is performed on the colors
iterator and drawing will wrap around if the
iterator returns more color values than the number of pixels in the given region.
This is a low level function, which isn’t intended to be used in regular user code.
Consider using the fill_contiguous
function from the embedded-graphics
crate as an alternative instead.
§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 set_vertical_scroll_region(
&mut self,
top_fixed_area: u16,
bottom_fixed_area: u16
) -> Result<(), Error>
pub fn set_vertical_scroll_region( &mut self, top_fixed_area: u16, bottom_fixed_area: u16 ) -> Result<(), 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 fn set_vertical_scroll_offset(&mut self, offset: u16) -> Result<(), Error>
pub fn set_vertical_scroll_offset(&mut self, offset: u16) -> Result<(), 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 fn set_tearing_effect(
&mut self,
tearing_effect: TearingEffect
) -> Result<(), Error>
pub fn set_tearing_effect( &mut self, tearing_effect: TearingEffect ) -> Result<(), 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 fn sleep<D: DelayNs>(&mut self, delay: &mut D) -> Result<(), Error>
pub fn sleep<D: DelayNs>(&mut self, delay: &mut D) -> Result<(), Error>
Puts the display to sleep, reducing power consumption. Need to call Self::wake before issuing other commands
sourcepub fn wake<D: DelayNs>(&mut self, delay: &mut D) -> Result<(), Error>
pub fn wake<D: DelayNs>(&mut self, delay: &mut D) -> Result<(), Error>
Wakes the display after it’s been set to sleep via Self::sleep
sourcepub unsafe fn dcs(&mut self) -> &mut Dcs<DI>
pub unsafe fn dcs(&mut self) -> &mut Dcs<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.