Add RGB color ordering a la Arduino library, FrameBuffer copy via image() #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Principal change here is the addition of different RGB byte orders, to provide compatibility with the initial batch of STEMMA QT matrices and also future-proof against possible future changes to RGB LED pinouts. All of the high-level class constructors (ISSI_EVB, Adafruit_RGBMatrixQT and LED_Glasses) accept an optional “order” argument, with a similar color order to the Arduino library:
matrix = Adafruit_RGBMatrixQT(i2c, order = adafruit_is31fl3741.IS3741_RBG)
The default order if unspecified is IS3741_BGR, compatible with ISSI eval board, currently-shipping QT matrices, and EyeLights glasses.
The initial batch of QT matrices had a different type of LED: use IS3741_RBG there.
Tested against Arduino library, all color orders work similarly, both in direct and buffered modes.
Additional change is that in CircuitPython the image() function accepts a FrameBuffer object. Since the IS31 library itself doesn’t provide any drawing primitives, one can use adafruit_framebuffer instead, then image() the result to the RGB matrix. (Haven't benchmarked, but potentially faster in some situations.) It’s primitive and doesn’t trap mismatches — the FrameBuffer and matrix need to be the same size — but it’s a start.
Additionally, the pixel-setter function may be a smidge faster now, some bounds checks weren’t necessary.