qspibus – QSPI bus protocol for quad-SPI displays
The qspibus module provides a low-level QSPI bus interface for displays
that use four data lines. It is analogous to fourwire for standard SPI.
Use qspibus.QSPIBus to create a bus instance.
Example usage:
import board
import qspibus
import displayio
displayio.release_displays()
bus = qspibus.QSPIBus(
clock=board.LCD_CLK,
data0=board.LCD_D0,
data1=board.LCD_D1,
data2=board.LCD_D2,
data3=board.LCD_D3,
cs=board.LCD_CS,
reset=board.LCD_RESET,
frequency=80_000_000,
)
Available on these boards
- class qspibus.QSPIBus(*, clock: microcontroller.Pin, data0: microcontroller.Pin, data1: microcontroller.Pin, data2: microcontroller.Pin, data3: microcontroller.Pin, cs: microcontroller.Pin, dcx: microcontroller.Pin | None = None, reset: microcontroller.Pin | None = None, frequency: int = 80000000)
QSPI bus for quad-SPI displays.
Create a QSPIBus object for quad-SPI display communication.
- Parameters:
clock (Pin) – QSPI clock pin
data0 (Pin) – QSPI data line 0
data1 (Pin) – QSPI data line 1
data2 (Pin) – QSPI data line 2
data3 (Pin) – QSPI data line 3
cs (Pin) – Chip select pin
dcx (Pin) – Optional data/command select pin. Reserved for future hardware paths. Current ESP32-S3 implementation uses encoded QSPI command words and does not require explicit DCX.
reset (Pin) – Optional reset pin
frequency (int) – Bus frequency in Hz (1-80MHz)
- reset() None
Perform a hardware reset using the reset pin.
- Raises:
RuntimeError – if no reset pin was provided at construction.
- send(command: int, data: circuitpython_typing.ReadableBuffer, *, toggle_every_byte: bool = False) None
Sends the given command value followed by the full set of data. Display state, such as vertical scroll, set via
sendmay or may not be reset once the code is done.
- write_command(command: int) None
Stage a command byte for subsequent
write_data().If a previously staged command had no data, it is sent as a command-only transaction before staging the new one.
- write_data(data: circuitpython_typing.ReadableBuffer) None
Send payload bytes for the most recently staged command.