-
Notifications
You must be signed in to change notification settings - Fork 50
/
FastLED_NeoMatrix.cpp
75 lines (62 loc) · 2.71 KB
/
FastLED_NeoMatrix.cpp
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*-------------------------------------------------------------------------
Arduino library based on Adafruit_Neomatrix but modified to work with FastLED
by Marc MERLIN <[email protected]>
Original notice and license from Adafruit_Neomatrix:
------------------------------------------------------------------------
Arduino library to control single and tiled matrices of WS2811- and
WS2812-based RGB LED devices such as the Adafruit NeoPixel Shield or
displays assembled from NeoPixel strips, making them compatible with
the Adafruit_GFX graphics library. Requires both the FastLED_NeoPixel
and Adafruit_GFX libraries.
Written by Phil Burgess / Paint Your Dragon for Adafruit Industries.
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing products
from Adafruit!
-------------------------------------------------------------------------
This file is part of the Adafruit NeoMatrix library.
NeoMatrix is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
NeoMatrix is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with NeoMatrix. If not, see
<http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------*/
#include <Adafruit_GFX.h>
#include <FastLED_NeoMatrix.h>
// Constructor for single matrix:
FastLED_NeoMatrix::FastLED_NeoMatrix(CRGB *leds, uint16_t w, uint16_t h, uint8_t matrixType):
Framebuffer_GFX(leds, w, h, NULL) {
type = matrixType;
tilesX = 0;
tilesY = 0;
}
// Constructor for tiled matrices:
FastLED_NeoMatrix::FastLED_NeoMatrix(CRGB *leds, uint16_t mW, uint16_t mH,
uint8_t tX, uint8_t tY, uint8_t matrixType) :
Framebuffer_GFX(leds, mW * tX, mH * tY, NULL) {
matrixWidth = mW;
matrixHeight = mH;
type = matrixType;
tilesX = tX;
tilesY = tY;
}
void FastLED_NeoMatrix::show() {
Framebuffer_GFX::showfps();
if (_show) { _show(); return; };
#ifdef ESP8266
// Disable watchdog interrupt so that it does not trigger in the middle of
// updates. and break timing of pixels, causing random corruption on interval
// https://github.com/esp8266/Arduino/issues/34
ESP.wdtDisable();
#endif
FastLED.show();
#ifdef ESP8266
ESP.wdtEnable(1000);
#endif
}
// vim:sts=2:sw=2