-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathEVs_PiLight.h
77 lines (63 loc) · 2.34 KB
/
EVs_PiLight.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
// PiLight.h
//
// This is a class for writing to PiLight, made by Openelectrons.
// See http://www.openelectrons.com/pages/19
// Initial version: 2014-03-17 by Michael Giles
// Large parts of the code is ported from the Raspberry Pi library for the device,
// written by Nitin Patil.
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef EVs_PILIGHT_H
#define EVs_PILIGHT_H
#include "EVShieldI2C.h"
// Color Registers.
#define PILIGHT_RED 0x42
#define PILIGHT_GREEN 0x43
#define PILIGHT_BLUE 0x44
/**
* \struct color
Color related data
*/
struct color
{
byte r; /*!<Color value of red generated by the PiLight */
byte g; /*!<Color value of green generated by the PiLight */
byte b; /*!<Color value of blue generated by the PiLight */
};
/**
@brief This class interfaces with PiLight sensor attached to EVShield
*/
class EVs_PiLight : public EVShieldI2C
{
public:
/** constructor for the PiLight; may supply an optional custom i2c address */
EVs_PiLight(uint8_t i2c_address = 0x30);
/**
* Get the read, green, and blue color values from the PiLight
* @param color structure
* @return parameter is returned with values */
void readPiLight(color & currcolor);
/**
* Set a time out time in seconds
* @param timeoutValue will turn off PiLight after a specified time if no communication */
void setTimeout1(uint8_t timeoutValue);
/**
* Set the color of the PiLight
* @param red set the value of the red color
* @param green set the value of the green color
* @param blue set the value of the blue color
* @return parameter is returned with values */
void createPiLight(uint8_t red, uint8_t green, uint8_t blue);
};
#endif