forked from CoolNeon/arduino-tcl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TCL.h
58 lines (51 loc) · 1.4 KB
/
TCL.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
/*****************************************************************************
* TCL.h
*
* Copyright 2011-2012 Christpher De Vries
* This program is distributed under the Artistic License 2.0, a copy of which
* is included in the file LICENSE.txt
****************************************************************************/
// Choose between bit bang (any 2 dio pins) and SPI modes
#define TCL_DIO
//#define TCL_SPI
#ifndef TCL_h
#define TCL_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#ifdef TCL_SPI
#include "SPI.h"
#endif
#define TCL_POT1 A0
#define TCL_POT2 A1
#define TCL_POT3 A2
#define TCL_POT4 A3
#define TCL_MOMENTARY1 4
#define TCL_MOMENTARY2 5
#define TCL_SWITCH1 6
#define TCL_SWITCH2 7
#ifdef TCL_DIO
#define TCL_CLOCKPIN 0
#define TCL_DATAPIN 1
#endif
class TclClass {
public:
static void begin();
static void setupDeveloperShield();
static void end();
static void sendFrame(byte flag, byte red, byte green, byte blue);
static void sendColor(byte red, byte green, byte blue);
static void sendEmptyFrame();
static byte makeFlag(byte red, byte green, byte blue);
static void setAll(int num_leds, byte red, byte green, byte blue);
private:
#ifdef TCL_DIO
static byte datapinmask, clkpinmask;
static volatile byte *dataport, *clkport;
static void dioWrite(uint8_t c);
#endif
};
extern TclClass TCL;
#endif