forked from sowbug/G35Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LightProgram.h
43 lines (35 loc) · 1.29 KB
/
LightProgram.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
/*
G35: An Arduino library for GE Color Effects G-35 holiday lights.
Copyright © 2011 The G35 Authors. Use, modification, and distribution are
subject to the BSD license as described in the accompanying LICENSE file.
By Mike Tsao <https://github.com/sowbug>.
See README for complete attributions.
*/
#ifndef INCLUDE_G35_LIGHT_PROGRAMS_H
#define INCLUDE_G35_LIGHT_PROGRAMS_H
#include <G35.h>
// Interface for light programs.
//
// A "light program" is what GE means when they say their lights include 14
// programs. An example is "Chasing Red, White, and Blue."
class LightProgram {
public:
LightProgram(G35& g35)
: g35_(g35), light_count_(g35.get_light_count()),
bulb_frame_(g35.get_bulb_frame()) {}
// Do a single slice of work. Returns the number of milliseconds before
// this function should be called again.
virtual uint32_t Do() = 0;
protected:
G35& g35_;
uint8_t light_count_;
uint8_t bulb_frame_;
};
// A collection of LightProgram classes. Putting them here makes it much
// easier on app developers because they don't have to create a switch
// statement for every set of programs they're interested in including.
class LightProgramGroup {
public:
virtual LightProgram* CreateProgram(G35& lights, uint8_t program_index) = 0;
};
#endif // INCLUDE_G35_LIGHT_PROGRAMS_H