-
Notifications
You must be signed in to change notification settings - Fork 0
/
animation.h
52 lines (40 loc) · 880 Bytes
/
animation.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
//
// Animation.h
//
//
// Created by Yves BAZIN on 20/02/2019.
//
#ifndef Animation_h
#define Animation_h
#include "FastLED.h"
class Animation
{
public:
Animation( CRGB *ext_leds,int start_led,int end_led)
{
this->ext_leds=ext_leds;
this->start_led=start_led;
this->end_led=end_led;
this->num_leds=end_led-start_led+1;
this->ledsa= (CRGB*)malloc((end_led-start_led+1)*sizeof(CRGB));
memset(ledsa,0,num_leds*3);
}
virtual void animation(){};
void loop()
{
animation();
pushleds();
}
protected:
//void (*animation)();
CRGB *ledsa;
int num_leds;
CRGB *ext_leds;
int start_led;
int end_led;
void pushleds()
{
memcpy(ext_leds+start_led,ledsa,num_leds*3);
}
};
#endif /* Animation_h */