You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 text was updated successfully, but these errors were encountered:
The common_hal routines
common_hal_displayio_fourwire_begin_transaction()
andcommon_hal_displayio_parallelbus_begin_transaction()
returntrue
orfalse
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 returnstrue
. But forFourWire
, the routine does acommon_hal_busio_spi_try_lock()
, which might fail and returnfalse
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()
andParallelBus.send()
, or viaself->begin_transaction()
in variousDisplay
methods.The text was updated successfully, but these errors were encountered: