pub struct St7789<SPI, DC> { /* private fields */ }Expand description
ST7789 driver.
Implementations§
Source§impl<SPI: SpiDevice, DC: OutputPin> St7789<SPI, DC>
impl<SPI: SpiDevice, DC: OutputPin> St7789<SPI, DC>
Sourcepub const fn new(spi: SPI, dc: DC, panel: Panel, rotation: Rotation) -> Self
pub const fn new(spi: SPI, dc: DC, panel: Panel, rotation: Rotation) -> Self
Wraps an SPI device and the DC pin. Call init next.
Sourcepub async fn init(
&mut self,
script: &[InitStep],
delay: &mut impl DelayNs,
) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
pub async fn init( &mut self, script: &[InitStep], delay: &mut impl DelayNs, ) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
Runs script, then sets RGB565, rotation, inversion, and turns the
display on.
Sourcepub async fn set_rotation(
&mut self,
rotation: Rotation,
) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
pub async fn set_rotation( &mut self, rotation: Rotation, ) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
Changes rotation. Frame memory is not redrawn.
Sourcepub async fn command(
&mut self,
cmd: u8,
params: &[u8],
) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
pub async fn command( &mut self, cmd: u8, params: &[u8], ) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
Sends a command followed by its parameters.
Sourcepub async fn set_window(
&mut self,
x0: u16,
y0: u16,
x1: u16,
y1: u16,
) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
pub async fn set_window( &mut self, x0: u16, y0: u16, x1: u16, y1: u16, ) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
Selects the inclusive window (x0, y0)..=(x1, y1) in logical
coordinates. Coordinates beyond the visible area are the caller’s
responsibility.
Sourcepub async fn write_pixels(
&mut self,
bytes: &[u8],
) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
pub async fn write_pixels( &mut self, bytes: &[u8], ) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
Streams big-endian RGB565 bytes into the current window.
Sourcepub async fn write_rows(
&mut self,
y: u16,
bytes: &[u8],
) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
pub async fn write_rows( &mut self, y: u16, bytes: &[u8], ) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
Writes full-width rows starting at row y. bytes must hold whole
rows; it is sent as one contiguous transfer.
Sourcepub async fn set_display_on(
&mut self,
on: bool,
) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
pub async fn set_display_on( &mut self, on: bool, ) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
Display on/off. Frame memory is kept while off.
Sourcepub async fn set_sleep(
&mut self,
sleep: bool,
delay: &mut impl DelayNs,
) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
pub async fn set_sleep( &mut self, sleep: bool, delay: &mut impl DelayNs, ) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
Enters (true) or leaves sleep mode. The controller needs 120 ms
between the two; this call waits that long after the command.
Sourcepub async fn soft_reset(
&mut self,
delay: &mut impl DelayNs,
) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
pub async fn soft_reset( &mut self, delay: &mut impl DelayNs, ) -> Result<(), Error<<SPI as ErrorType>::Error, <DC as ErrorType>::Error>>
Software reset; prefer hard_reset when a reset pin is wired.