-
Notifications
You must be signed in to change notification settings - Fork 10
/
MEOLightProgram.h
45 lines (37 loc) · 1.38 KB
/
MEOLightProgram.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
/*
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 <http://github.com/sowbug>.
See README for complete attributions.
*/
#ifndef INCLUDE_G35_MEO_LIGHT_PROGRAMS_H
#define INCLUDE_G35_MEO_LIGHT_PROGRAMS_H
#include <MEOG35.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 MEOLightProgram
{
public:
MEOLightProgram(MEOG35& g35, uint8_t pattern)
: 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:
MEOG35& 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 MEOLightProgramGroup
{
public:
virtual MEOLightProgram* CreateProgram(MEOG35& lights, uint8_t program_index, uint8_t pattern) = 0;
};
#endif // INCLUDE_G35_LIGHT_PROGRAMS_H