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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
#ifndef __CPHIDGETLED
#define __CPHIDGETLED
#include "cphidget.h"
/** \defgroup phidled Phidget LED
* \ingroup phidgets
* These calls are specific to the Phidget LED object. See your device's User Guide for more specific API details, technical information, and revision details. The User Guide, along with other resources, can be found on the product page for your device.
* @{
*/
DPHANDLE(LED)
CHDRSTANDARD(LED)
/**
* The Phidget LED supports these current limits
*/
typedef enum {
PHIDGET_LED_CURRENT_LIMIT_20mA = 1, /**< 20mA */
PHIDGET_LED_CURRENT_LIMIT_40mA, /**< 40mA */
PHIDGET_LED_CURRENT_LIMIT_60mA, /**< 60mA */
PHIDGET_LED_CURRENT_LIMIT_80mA /**< 80mA */
} CPhidgetLED_CurrentLimit;
/**
* The Phidget LED supports these voltages
*/
typedef enum {
PHIDGET_LED_VOLTAGE_1_7V = 1, /**< 1.7V */
PHIDGET_LED_VOLTAGE_2_75V, /**< 2.75V */
PHIDGET_LED_VOLTAGE_3_9V, /**< 3.9V */
PHIDGET_LED_VOLTAGE_5_0V /**< 5.0V */
} CPhidgetLED_Voltage;
/**
* Gets the number of LEDs supported by this board.
* @param phid An attached phidget LED handle.
* @param count The led count.
*/
CHDRGET(LED,LEDCount,int *count)
/**
* Gets the brightness of an LED.
* @param phid An attached phidget LED handle.
* @param index The LED index.
* @param brightness The LED brightness (0-100).
*/
CHDRGETINDEX(LED,DiscreteLED,int *brightness)
/**
* Sets the brightness of an LED.
* @param phid An attached phidget LED handle.
* @param index The LED index.
* @param brightness The LED brightness (0-100).
*/
CHDRSETINDEX(LED,DiscreteLED,int brightness)
/**
* Gets the current limit. This is for all ouputs.
* @param phid An attached phidget LED handle.
* @param currentLimit The Current Limit.
*/
CHDRGET(LED,CurrentLimit,CPhidgetLED_CurrentLimit *currentLimit)
/**
* Sets the current limit. This is for all ouputs.
* @param phid An attached phidget LED handle.
* @param currentLimit The Current Limit.
*/
CHDRSET(LED,CurrentLimit,CPhidgetLED_CurrentLimit currentLimit)
/**
* Gets the output voltate. This is for all ouputs.
* @param phid An attached phidget LED handle.
* @param voltage The Output Voltage.
*/
CHDRGET(LED,Voltage,CPhidgetLED_Voltage *voltage)
/**
* Sets the output voltage. This is for all ouputs.
* @param phid An attached phidget LED handle.
* @param voltage The Output Voltage.
*/
CHDRSET(LED,Voltage,CPhidgetLED_Voltage voltage)
//Only exposed in debug library for now
#if !defined(EXTERNALPROTO) || defined(DEBUG)
CHDRGETINDEX(LED,Brightness,double *brightness)
CHDRSETINDEX(LED,Brightness,double brightness)
CHDRGETINDEX(LED,CurrentLimitIndexed,double *limit)
CHDRSETINDEX(LED,CurrentLimitIndexed,double limit)
#endif
#ifndef REMOVE_DEPRECATED
DEP_CHDRGET("Deprecated - use CPhidgetLED_getLEDCount",LED,NumLEDs,int *)
#endif
#ifndef EXTERNALPROTO
#define LED_MAXLEDS 64
//OUT Packet Types
#define LED64_NORMAL_PACKET 0x00
#define LED64_CONTROL_PACKET 0x40
#define LED64_OUTLOW_PACKET 0x80
#define LED64_OUTHIGH_PACKET 0xc0
#define LED64_M3_OUT_LOW_PACKET 0x00
#define LED64_M3_OUT_HIGH_PACKET 0x20
#define LED64_M3_CONTROL_PACKET 0x40
//IN Packet Types
#define LED64_IN_LOW_PACKET 0x00
#define LED64_IN_HIGH_PACKET 0x80
#define LED64_M3_IN_LOW_PACKET 0x00
#define LED64_M3_IN_HIGH_PACKET 0x40
//Flags
#define LED64_PGOOD_FLAG 0x01
#define LED64_CURSELA_FLAG 0x02
#define LED64_CURSELB_FLAG 0x04
#define LED64_PWRSELA_FLAG 0x08
#define LED64_PWRSELB_FLAG 0x10
#define LED64_FAULT_FLAG 0x20
#define LED64_OE_FLAG 0x40
//M3 LED64
#define LED64_M3_CURRENTLIMIT 80 //80 mA fixed TODO: make sure this is right!
struct _CPhidgetLED
{
CPhidget phid;
double LED_Power[LED_MAXLEDS];
double LED_CurrentLimit[LED_MAXLEDS];
CPhidgetLED_Voltage voltage;
CPhidgetLED_CurrentLimit currentLimit;
double nextLED_Power[LED_MAXLEDS];
double lastLED_Power[LED_MAXLEDS];
unsigned char changedLED_Power[LED_MAXLEDS];
unsigned char changeRequests;
double LED_PowerEcho[LED_MAXLEDS];
unsigned char outputEnabledEcho[LED_MAXLEDS];
unsigned char ledOpenDetectEcho[LED_MAXLEDS];
unsigned char powerGoodEcho;
unsigned char outputEnableEcho;
unsigned char faultEcho;
CPhidgetLED_Voltage voltageEcho;
CPhidgetLED_CurrentLimit currentLimitEcho;
unsigned char TSDCount, TSDClearCount, PGoodErrState;
unsigned char controlPacketWaiting;
unsigned char lastOutputPacket;
} typedef CPhidgetLEDInfo;
#endif
/** @} */
#endif
|