adafruit/Adafruit_Protomatter

Address problem on RGB Matrix Shield (singleAddrPort)

jepler opened this issue · 3 comments

User "molecularist" on Discord reported a problem with the Adafruit RGB Matrix Shield and CircuitPython, which I reproduced.

Some of the address bits end up inverted. This seems to be a bug in the address pin setting code when the "invert" function is used. The problem goes away when forcing the slow method always in _PM_begin:

diff --git a/core.c b/core.c
index 7d81e70..86fda98 100644
--- a/core.c
+++ b/core.c
@@ -323,6 +323,7 @@ ProtomatterStatus _PM_begin(Protomatter_core *core) {
         }
 #endif
     }
+    core->singleAddrPort = 0;
 
     // Get pointers to bit set and clear registers (and toggle, if present)
     core->setReg    = (uint8_t *)_PM_portSetRegister(core->clockPin);

Molecularist confirmed via discord that a custom circuitpython build with the above change fixed the original problem.

I suspect that this was fixed when the code was reorganized, because now each address pin is given a defined state at start. I pinged discord user Molecularist to find out whether the problem was resolved for them as well.

They confirmed this was fixed. Thank you!