PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

smartmatrix_t3.h 1.2KB

3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef __INC_SMARTMATRIX_T3_H
  2. #define __INC_SMARTMATRIX_T3_H
  3. #ifdef SmartMatrix_h
  4. #include <SmartMatrix.h>
  5. FASTLED_NAMESPACE_BEGIN
  6. extern SmartMatrix *pSmartMatrix;
  7. // note - dmx simple must be included before FastSPI for this code to be enabled
  8. class CSmartMatrixController : public CPixelLEDController<RGB_ORDER> {
  9. SmartMatrix matrix;
  10. public:
  11. // initialize the LED controller
  12. virtual void init() {
  13. // Initialize 32x32 LED Matrix
  14. matrix.begin();
  15. matrix.setBrightness(255);
  16. matrix.setColorCorrection(ccNone);
  17. // Clear screen
  18. clearLeds(0);
  19. matrix.swapBuffers();
  20. pSmartMatrix = &matrix;
  21. }
  22. virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
  23. if(SMART_MATRIX_CAN_TRIPLE_BUFFER) {
  24. rgb24 *md = matrix.getRealBackBuffer();
  25. } else {
  26. rgb24 *md = matrix.backBuffer();
  27. }
  28. while(pixels.has(1)) {
  29. md->red = pixels.loadAndScale0();
  30. md->green = pixels.loadAndScale1();
  31. md->blue = pixels.loadAndScale2();
  32. md++;
  33. pixels.advanceData();
  34. pixels.stepDithering();
  35. }
  36. matrix.swapBuffers();
  37. if(SMART_MATRIX_CAN_TRIPLE_BUFFER && pixels.advanceBy() > 0) {
  38. matrix.setBackBuffer(pixels.mData);
  39. }
  40. }
  41. };
  42. FASTLED_NAMESPACE_END
  43. #endif
  44. #endif