The common_hal routines common_hal_displayio_fourwire_begin_transaction() and common_hal_displayio_parallelbus_begin_transaction() return true or false depending on whether they've successfully started a display transaction. However, their return value is never checked: the callers assume that once called, the transaction has begun, even though the start-transaction has failed.
For ParallelBus, it doesn't matter, because there's no contention, and the routine always returns true. But for FourWire, the routine does a common_hal_busio_spi_try_lock(), which might fail and return false if someone else is holding the lock.
So either the return values should be checked, and the calling code should busy-wait or fail nicely, or the xxx_begin_transaction() routine should itself busy-wait.
If we do MICROPY_VM_HOOK_LOOP during the busy-wait, we have to avoid calling ourselves recursively, so a flag should be set that can be checked to avoid doing any displayio background operations while waiting.
These routines are either called directly in FourWire.send() and ParallelBus.send(), or via self->begin_transaction() in various Display methods.
The common_hal routines
common_hal_displayio_fourwire_begin_transaction()andcommon_hal_displayio_parallelbus_begin_transaction()returntrueorfalsedepending on whether they've successfully started a display transaction. However, their return value is never checked: the callers assume that once called, the transaction has begun, even though the start-transaction has failed.For
ParallelBus, it doesn't matter, because there's no contention, and the routine always returnstrue. But forFourWire, the routine does acommon_hal_busio_spi_try_lock(), which might fail and returnfalseif someone else is holding the lock.So either the return values should be checked, and the calling code should busy-wait or fail nicely, or the
xxx_begin_transaction()routine should itself busy-wait.If we do
MICROPY_VM_HOOK_LOOPduring the busy-wait, we have to avoid calling ourselves recursively, so a flag should be set that can be checked to avoid doing any displayio background operations while waiting.These routines are either called directly in
FourWire.send()andParallelBus.send(), or viaself->begin_transaction()in variousDisplaymethods.