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):
| Mode | Type | RAM | DrawTarget | Flush |
|---|---|---|---|---|
| Unbuffered (default) | St77916<I, R> | 0 | No | send_pixels() |
| Unbuffered DrawTarget | St77916<I, R, Unbuffered<C>> | 0 | Yes (fallible) | Each draw -> HW |
| Single-buffered | St77916<I, R, Buffered<C>> | 1x FB | Yes (infallible) | flush() (dirty-aware) |
| Double-buffered | St77916<I, R, DoubleBuffered<C>> | 2x FB | Yes (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§
Structs§
- Buffered
- Single-buffered mode with dirty-band tracking.
- Display
Size - Display dimensions in pixels.
- Double
Buffered - Double-buffered mode for DMA overlap.
- St77916
- Driver for the ST77916 TFT-LCD display controller.
- St77916
Builder - Builder for
St77916. - Unbuffered
- Unbuffered
DrawTarget— each draw sends pixels directly to the display.
Enums§
- Color
Mode - Pixel color format for the controller’s COLMOD register.
- Driver
Error - Driver errors, generic over interface and reset error types.
- Framebuffer
- Holds either a static or heap-allocated framebuffer.
Traits§
- Controller
Interface - Communication interface for the ST77916 (SPI, parallel, etc.).
- Reset
Interface - Hardware reset control for the ST77916.
- St77916
Color - Pixel color encoding for the ST77916 framebuffer.
Functions§
- framebuffer_
size - Compute framebuffer size in bytes for a given display and color mode.
Type Aliases§
- Driver
Result - Convenience alias for results from driver operations.