I’m trying to work with the Adafruit charlieplexed LED matrix driver as an extension, using Pimoroni Tiny 2350 and Tiny 2040 boards (the latter added to the same uLisp core sections as the Adafruit QtPy). The matrix driver board is connected to the I2C bus correctly and recognized. Initialization with .begin
works flawlessly, as does, for example, .drawPixel(...)
- all this from within uLisp, having defined commands led-matrix-begin
and led-matrix-draw-pixel
within the extension.
To sum up: Initialization and drawing a pixel works, using my extension file. I’ve defined the other GFX commands in the extension, too, for example led-matrix-draw-line
etc. Now if I try to invoke that one, for example, the microcontroller crashes/does not return from the library function.
Please assume that I invoke all extension functions in the same, the usual and correct manner with correct argument conversion from uLisp to C, I’ve checked that to and fro. I also made sure there’s definitely no crash until I invoke the library function, and the function call matches the ones provided in the examples (and header files) coming with the charlieplex library/the GFX library.
Moreover, all the examples work flawlessly, so neither the microcontroller nor the led boards/driver boards are broken in any way or connected falsely.
I get the impression that from within the uLisp extension all simple library calls work (like .clear
, .setRotation
and so on), but as soon as I try to do something more complex/fast serial I2C access, something goes wrong. Could this be an I2C issue conflicting with something uLisp sets up internally? I tried to find hints, but couldn’t. Maybe I missed some 2040/2350 port specialties?
Again: The phenomenon occurs with both the 2350 and the 2040, so I shouldn’t have made any mistake setting up the 2040 for uLisp.
Any hints are greatly appreciated! (uLisp version 4.7b)
Edit: Here’s a short code example illustrating that something seems to be wrong deeply within the mysteries of the RPi Pico:
curmatrix->matrix.drawPixel(x, y, b); // works and is shown
curmatrix->matrix.drawPixel(x+1, y+1, b); // works and is shown
curmatrix->matrix.drawPixel(x+2, y+2, b); // works and is shown
delay(500);
curmatrix->matrix.drawCircle(8,4, 2, 32); // fails - not shown
return nil; //not returning to uLisp