fourwire
– Connects to a BusDisplay over a four wire bus
Available on these boards
- class fourwire.FourWire(spi_bus: busio.SPI, *, command: microcontroller.Pin | None, chip_select: microcontroller.Pin | None, reset: microcontroller.Pin | None = None, baudrate: int = 24000000, polarity: int = 0, phase: int = 0)
Manage updating a display over SPI four wire protocol in the background while Python code runs. It doesn’t handle display initialization.
Create a FourWire object associated with the given pins.
The SPI bus and pins are then in use by the display until
displayio.release_displays()
is called even after a reload. (It does this so CircuitPython can use the display after your code is done.) So, the first time you initialize a display bus in code.py you should calldisplayio.release_displays()
first, otherwise it will error after the first code.py run.If the
command
pin is not specified, a 9-bit SPI mode will be simulated by adding a data/command bit to every bit being transmitted, and splitting the resulting data back into 8-bit bytes for transmission. The extra bits that this creates at the end are ignored by the receiving device.- Parameters:
spi_bus (busio.SPI) – The SPI bus that make up the clock and data lines
command (microcontroller.Pin) – Data or command pin. When None, 9-bit SPI is simulated.
chip_select (microcontroller.Pin) – Chip select pin
reset (microcontroller.Pin) – Reset pin. When None only software reset can be used
baudrate (int) – Maximum baudrate in Hz for the display on the bus
polarity (int) – the base state of the clock line (0 or 1)
phase (int) – the edge of the clock that data is captured. First (0) or second (1). Rising or falling depends on clock polarity.
- reset() None
Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin is available.
- 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
send
may or may not be reset once the code is done.