-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutputg35.h
105 lines (89 loc) · 3.12 KB
/
outputg35.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef __INC_AA_OUTPUT_G35
#define __INC_AA_OUTPUT_G35
#include <stdint.h>
// This aspect of the program makes use of the G35 Arduino library.
// --------
/*
* 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.
*
* See README for complete attributions.
*/
#include <G35String.h>
// NOTE: A modified version is available with reduced timing delays in
// G35String.cpp, which will increase performance by reducing tolerance for
// error.
// This program also takes inspiration from earlier G35 efforts:
// --------
// GE Color Effects Arduino Interface
// by Tom Lee <thomas.j.lee at gmail.com>
// Based on code ported by Scott Harris <[email protected]>
// scottrharris.blogspot.com
// which was in turn based on :
/*! Christmas Light Control
** By Robert Quattlebaum <[email protected]>
** Released November 27th, 2010
**
** For more information,
** see <http://www.deepdarc.com/2010/11/27/hacking-christmas-lights/>.
**
** Originally intended for the ATTiny13, but should
** be easily portable to other microcontrollers.
*/
#include "color.h"
#include "outputabstract.h"
/**
* GE ColorEffects G-35 output
*
* NOTE: This is a third-party project, unaffiliated with GE.
*
* See https://github.com/sowbug/G35Arduino
*/
class OutputG35 : public OutputAbstract
{
public:
/**
* Constructs a new GE ColorEffects G-35 output at the given pin
*
* @param numLEDs Number of LEDs (usually 50, 48, or 36)
* @param outputPin Data pin for the LED lights
*/
OutputG35(int numLEDs, int outputPin);
/**
* Destroys the GE ColorEffects G-35 output
*/
~OutputG35();
virtual bool isSoftwareBrightness() override
{
// We've got real honest-to-goodness hardware support!
return false;
}
virtual void initialize() override;
virtual void show() override;
virtual void setBrightness(int index, uint8_t brightness) override;
virtual void setColor(int index, sCRGB color) override;
virtual void setColor(int index, sCRGB color, uint8_t brightness) override;
virtual void setHue(int index, sCRGB color) override;
private:
typedef uint16_t raw_hue_t; ///< Color data type
typedef uint8_t raw_intensity_t; ///< Brightness data type
/**
* Converts a sCRGB color to a packed G35 color
*
* @param sCRGB sCRGB color value
* @return G35 packed color
*/
color_t convertToG35Color(sCRGB color);
/**
* Sequentially sends the hue and intensity arrays to the G-35 light string
*
* @param bulb_hue_array Array of G35 colors
* @param bulb_intensity_array Array of brightness values
*/
void showInternal(raw_hue_t bulb_hue_array[], raw_intensity_t bulb_intensity_array[]);
G35String _lights; ///< Internal G35 string
raw_hue_t *_light_hue_array; ///< Software color tracking
raw_intensity_t *_light_intensity_array; ///< Software brightness tracking
};
#endif