Skip to main content

Crate st77916

Crate st77916 

Source
Expand description

§ST77916 Driver Crate

An embedded-graphics compatible driver for the Sitronix ST77916 TFT-LCD display controller (360x390, 262K color).

The driver is generic over the communication interface and reset pin, allowing it to work with SPI or any other bus by implementing ControllerInterface and ResetInterface.

§Buffering modes

The builder defaults to an unbuffered instance. Three additional modes are available when the embedded-graphics feature is enabled (default):

ModeTypeRAMDrawTargetFlush
Unbuffered (default)St77916<I, R>0Nosend_pixels()
Unbuffered DrawTargetSt77916<I, R, Unbuffered<C>>0Yes (fallible)Each draw -> HW
Single-bufferedSt77916<I, R, Buffered<C>>1x FBYes (infallible)flush() (dirty-aware)
Double-bufferedSt77916<I, R, DoubleBuffered<C>>2x FBYes (infallible)swap_buffers() + flush_front()

§Single-buffered with dirty tracking

The recommended mode for most applications. All DrawTarget operations automatically track which rows were modified. flush() sends only the dirty band — a single contiguous slice with no allocation. If nothing changed, flush() is a no-op.

let mut display = St77916::builder(iface, reset, size)
    .with_init_commands(&PANEL_INIT)
    .buffered::<Rgb565>(Framebuffer::heap::<FB_SIZE>())
    .build(ColorMode::Rgb565, &mut delay)?;

Circle::new(Point::new(100, 100), 50)
    .into_styled(PrimitiveStyle::with_fill(Rgb565::RED))
    .draw(&mut display)?;
display.flush()?;  // sends only the affected rows

§Platform access

interface_mut() exposes the underlying ControllerInterface for platform-specific operations (e.g. non-blocking DMA flush) that go beyond the trait’s synchronous API.

See commands for the full register set from the datasheet.

Modules§

commands

Structs§

Buffered
Single-buffered mode with dirty-band tracking.
DisplaySize
Display dimensions in pixels.
DoubleBuffered
Double-buffered mode for DMA overlap.
St77916
Driver for the ST77916 TFT-LCD display controller.
St77916Builder
Builder for St77916.
Unbuffered
Unbuffered DrawTarget — each draw sends pixels directly to the display.

Enums§

ColorMode
Pixel color format for the controller’s COLMOD register.
DriverError
Driver errors, generic over interface and reset error types.
Framebuffer
Holds either a static or heap-allocated framebuffer.

Traits§

ControllerInterface
Communication interface for the ST77916 (SPI, parallel, etc.).
ResetInterface
Hardware reset control for the ST77916.
St77916Color
Pixel color encoding for the ST77916 framebuffer.

Functions§

framebuffer_size
Compute framebuffer size in bytes for a given display and color mode.

Type Aliases§

DriverResult
Convenience alias for results from driver operations.