-
Notifications
You must be signed in to change notification settings - Fork 1
/
FastFader.h
73 lines (61 loc) · 1.94 KB
/
FastFader.h
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
/*
||
|| @file FastFader.h
|| @version 1.0
|| @author Danne Stayskal
|| @contact [email protected]
||
|| @description
|| | Provides a fast, cross-fading pixelbuffer to the FastLED library
|| #
||
|| @changelog
|| | 1.0 2014-05-29 - Danne Stayskal : Initial Release
|| #
||
|| @license
|| | This library 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; version
|| | 2.1 of the License.
|| |
|| | This library 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 this library; if not, write to the Free Software
|| | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|| #
==========================================
*/
#ifndef FASTFADER_H
#define FASTFADER_H
#include "../FastLED/FastLED.h"
#include <math.h>
#define NO_DECAY (-1)
#define LINEAR_DECAY (0)
#define LOGARITHMIC_DECAY (1)
class FastFader {
public:
FastFader();
FastFader& bind(int (*pixel_buffer)[3], CRGB *leds, int num_leds, CFastLED& fast_led);
FastFader& clear();
FastFader& set_pixel(int pos, int value, int channel);
FastFader& set_pixel(int pos, int value[3]);
FastFader& set_pixel(int pos, int value);
FastFader& set_pixel(int pos);
int* get_pixel(int pos);
FastFader& set_frame(int (*frame)[3]);
FastFader& push(int fader_delay, int fader_steps, int decay_type);
FastFader& push(int fader_delay, int fader_steps);
FastFader& push(int fader_delay);
FastFader& push();
private:
int NumLEDs;
int (*PixelBuffer)[3];
CRGB *LEDs;
CFastLED FLED;
};
#endif