Welcome to mirror list, hosted at ThFree Co, Russian Federation.

smartmatrix_t3.h « k20 « arm « platforms « FastLED-master « Библиотеки - github.com/AlexGyver/Arduino_Ambilight.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 14c3734c6c72e460b90f4fb7ef17164f5e1d35f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef __INC_SMARTMATRIX_T3_H
#define __INC_SMARTMATRIX_T3_H

#ifdef SmartMatrix_h
#include<SmartMatrix.h>

FASTLED_NAMESPACE_BEGIN

extern SmartMatrix *pSmartMatrix;

// note - dmx simple must be included before FastSPI for this code to be enabled
class CSmartMatrixController : public CPixelLEDController<RGB_ORDER> {
  SmartMatrix matrix;

public:
  // initialize the LED controller
  virtual void init() {
      // Initialize 32x32 LED Matrix
    matrix.begin();
    matrix.setBrightness(255);
    matrix.setColorCorrection(ccNone);

    // Clear screen
    clearLeds(0);
    matrix.swapBuffers();
    pSmartMatrix = &matrix;
  }

  virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
    if(SMART_MATRIX_CAN_TRIPLE_BUFFER) {
      rgb24 *md = matrix.getRealBackBuffer();
    } else {
      rgb24 *md = matrix.backBuffer();
    }
    while(pixels.has(1)) {
      md->red = pixels.loadAndScale0();
      md->green = pixels.loadAndScale1();
      md->blue = pixels.loadAndScale2();
      md++;
      pixels.advanceData();
      pixels.stepDithering();
    }
    matrix.swapBuffers();
    if(SMART_MATRIX_CAN_TRIPLE_BUFFER && pixels.advanceBy() > 0) {
      matrix.setBackBuffer(pixels.mData);
    }
  }

};

FASTLED_NAMESPACE_END

#endif

#endif