-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLightBinding.h
More file actions
41 lines (33 loc) · 1.13 KB
/
LightBinding.h
File metadata and controls
41 lines (33 loc) · 1.13 KB
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
#ifndef _LIGHT_BINDING_H_
#define _LIGHT_BINDING_H_
#include "Color.h"
#include "LightControl.h"
#ifdef __cplusplus
extern "C"
{
#endif
// callback for some analog read, takes a user data pointer and returns some value from 0 to 1
// a value of 0 will output all colorLow and a value of 1 will output all colorHigh
typedef float(*AnalogReadCallback)(void*);
/*!
* \brief Binds a light to an analog input
*/
struct LightBinding
{
AnalogReadCallback analogReadCallback; //! \brief callback to determine how much to mix colorLow and colorHigh
void* pAnalogReadUserData; //!< \brief user data to pass into analogReadCallback
struct Color colorLow; //!< \brief color for when pin is low
struct Color colorHigh; //!< \brief color for when pin is high
};
void LightBinding_setup(struct LightBinding* pLightBinding);
struct Color LightBinding_update(struct LightBinding* pLightBinding); // return the color from the analog pin
// structure to pass into readAnalogPin as user data, indicates which pin to read
struct ReadAnalogPinData
{
int analogPin;
};
float readAnalogPin(void* pUserData);
#ifdef __cplusplus
}
#endif
#endif//_LIGHT_BINDING_H_