Is SmartMatrix blocking or non-blocking?



I’m working on a project that will use two 64x32 panels for a 128 (W) x 32 (H) display. I’m using the Teensy 3.6 for the processor.

My project though also needs to respond to button inputs in the <10 ms range. Are there any parts of the SmartMatrix library that would be blocking for large amounts of time? From the little I understand, the screen refreshes are handled by DMA channels in the background.

I plan to read bitmaps from the SD card, from what I understand the library does not support this, but could I draw it out pixel by pixel? Or would this be incredibly slow and take a whole lot of time?



Hi, SmartMatrix Library uses a low priority non-blocking interrupt for doing all the number crunching in the background to prepare the data to shift out to the panels. This means that about roughly half the time your sketch is blocked, but only for about a millisecond at a time. That might be fast enough for you to look for a GPIO inside loop() and respond to it, but I’m not sure.

Higher priority ISRs aren’t blocked by the SmartMatrix Library, so if you can get the button press events from an ISR, that would be even better.

I plan to read bitmaps from the SD card

You can try to modify the Bitmaps example sketch to read and decode bitmaps from the SD card, and write them to the backgroundLayer just like the example is doing. Or do a Google search and see if someone else has already made a sketch, like this one (this may need to be brought up to date with SmartMatrix Library 3, see MIGRATION in the SmartMatrix Library folder: