1 #ifndef I1DISP_H
2 
3 /*
4  * Argyll Color Correction System
5  *
6  * Gretag i1Display related defines
7  *
8  * Author: Graeme W. Gill
9  * Date:   19/10/2006
10  *
11  * Copyright 2006 - 2013, Graeme W. Gill
12  * All rights reserved.
13  *
14  * This material is licenced under the GNU GENERAL PUBLIC LICENSE Version 2 or later :-
15  * see the License2.txt file for licencing details.
16  */
17 
18 /*
19    If you make use of the instrument driver code here, please note
20    that it is the author(s) of the code who take responsibility
21    for its operation. Any problems or queries regarding driving
22    instruments with the Argyll drivers, should be directed to
23    the Argyll's author(s), and not to any other party.
24 
25    If there is some instrument feature or function that you
26    would like supported here, it is recommended that you
27    contact Argyll's author(s) first, rather than attempt to
28    modify the software yourself, if you don't have firm knowledge
29    of the instrument communicate protocols. There is a chance
30    that an instrument could be damaged by an incautious command
31    sequence, and the instrument companies generally cannot and
32    will not support developers that they have not qualified
33    and agreed to support.
34  */
35 
36 #include "inst.h"
37 
38 #ifdef __cplusplus
39 	extern "C" {
40 #endif
41 
42 /* Note: update i1disp_interp_error() and i1disp_interp_code() in i1disp.c */
43 /* if anything of these #defines are added or subtracted */
44 
45 /* Fake Error codes */
46 #define I1DISP_INTERNAL_ERROR			0x61		/* Internal software error */
47 #define I1DISP_COMS_FAIL				0x62		/* Communication failure */
48 #define I1DISP_UNKNOWN_MODEL			0x63		/* Not an i1display */
49 #define I1DISP_DATA_PARSE_ERROR  		0x64		/* Read data parsing error */
50 
51 /* Real error code */
52 #define I1DISP_OK   					0x00
53 
54 /* Sub codes for device specific reasoning */
55 #define I1DISP_FLOAT_NOT_SET			0x01
56 #define I1DISP_NOT_READY 			    0x02
57 
58 #define I1DISP_BAD_SERIAL_NUMBER		0x03
59 #define I1DISP_BAD_LCD_CALIBRATION		0x04
60 #define I1DISP_BAD_CRT_CALIBRATION		0x05
61 #define I1DISP_EEPROM_WRITE_FAIL   	    0x06
62 
63 #define I1DISP_UNEXPECTED_RET_SIZE	    0x07
64 #define I1DISP_UNEXPECTED_RET_VAL	    0x08
65 
66 #define I1DISP_BAD_STATUS        	    0x09
67 #define I1DISP_UNKNOWN_VERS_ID   	    0x10
68 
69 /* Internal errors */
70 #define I1DISP_BAD_REG_ADDRESS	        0x20
71 #define I1DISP_BAD_INT_THRESH	        0x21
72 #define I1DISP_NO_COMS   		        0x22
73 #define I1DISP_NOT_INITED  		        0x23
74 #define I1DISP_CANT_BLACK_CALIB         0x24
75 #define I1DISP_CANT_MEASP_CALIB         0x25
76 #define I1DISP_WRONG_DEVICE             0x26
77 #define I1DISP_LOCKED            	    0x27
78 
79 /* Sub-type of instrument (i.e. based on vers, char code, unlock code) */
80 typedef enum {
81 	i1d2_norm       = 0,	/* Normal (i1d1, i1d2, Smile) */
82 	i1d2_lite       = 1,	/* "Lite" */
83 	i1d2_munki      = 2,	/* "Munk" */
84 	i1d2_hpdream    = 3,	/* "ObiW" */
85 	i1d1_calmanx2   = 4,	/* "CMX2" */
86 	i1d1_chroma4    = 5,	/* Chroma 4 */
87 	i1d1_chroma5    = 6,	/* Chroma 5 */
88 	i1d1_sencoreIII = 7, 	/* Sencore ColorPro III */
89 	i1d1_sencoreIV  = 8, 	/* Sencore ColorPro IV */
90 	i1d1_sencoreV   = 9 	/* Sencore ColorPro V */
91 } i1d2_dtype;
92 
93 
94 /* I1DISP communication object */
95 struct _i1disp {
96 	INST_OBJ_BASE
97 
98 	int        dtype;			/* Device type: 0 = i1D1, 1 = i1D2, 2 = Smile */
99 	i1d2_dtype stype;			/* Sub type */
100 
101 	inst_mode mode;				/* Currently selected mode */
102 
103 	inst_opt_type trig;			/* Reading trigger mode */
104 
105 	/* EEPROM registers */
106 	/* Number is the register address, and B, S, W, F indicate the type/size */
107 	int     reg0_W;				/* Serial number */
108 
109 	double  reg4_F[9];			/* LCD 3x3 calibration matrix (also known as "user") */
110 								/* Smile LED backlight */
111 	int     reg50_W;			/* Calibration time in secs from January 1, 1970, UTC */
112 	int     reg126_S;			/* LCD cal valid/state flag. For the i1disp this is 0xd, */
113 								/* perhaps meaning that it is the LCD matrix. */
114 								/* It's set to 7 after storing a user calibration. */
115 								/* A value of 0xffff or < 7 means that it's invalid */
116 								/* A value of 2 seems valid for OEM instruments */
117 								/* (Heidelberg Viewmaker & Lacie Blue Eye) */
118 
119 	double  reg54_F[9];			/* CRT 3x3 calibration matrix (also known as "factory") */
120 								/* Smile CCFL backlight */
121 	int     reg90_W;			/* CRT cal valid/time flag.  0xffffffff = invalid, */
122 								/* time in secs from January 1, 1970, UTC */
123 
124 	int     reg40_S;			/* Integration clock perod in nsec reg40S, typically 1000 */
125 	int     reg42_S;			/* Int cal. factor denominator, typically 10000 */
126 	int     reg44_S[3];			/* Int cal. factors numerator/100, typically 100 */
127 
128 	double  clk_prd;			/* Master clock period, reg94F, typically 1e-6 */
129 
130 	int     reg98_W;			/* A time value. Date of manufacture ? */
131 								/* Reg 40-44 write date ? */
132 
133 	int     reg102_B;			/* Not used ? */
134 
135 	double  reg103_F[3];		/* Dark current calibration values */
136 								/* Not valid if reg126_S < 0xd ?? */
137 
138 	int     reg115_B;			/* Unknown */
139 	int     reg121_B;			/* Device ID character */
140 
141 	char    reg122_B[5];		/* Unlock string */
142 
143 	/* Extra registers for dtype == 1 (Eye-One Display2) */
144 //	double  reg128_F[3];		/* Not used at all */
145 	double  reg144_F[3];		/* Ambient matrix adjustment values */
146 								/* ??? Default to 1.0 if not set in EEPROM */
147 
148 	/* Computed factors and state */
149 	double  iclk_freq;			/* Integration clock (from reg40_S), typically 1e6 */
150 	double  clk_freq;			/* Measurement clock (from reg94_F), typically 1e6 */
151 	double  rgbadj[3];			/* RGB adjustment values for period meas., typically 1.0 */
152 	double  amb[9];				/* Ambient measurement matrix = ref144[] * average of LCD & CRT */
153 
154 	inst_disptypesel *_dtlist;	/* Base list */
155 	inst_disptypesel *dtlist;	/* Display Type list */
156 	int     ndtlist;			/* Number of valid dtlist entries */
157 	int     icx;				/* 0 = LCD, 1 = CRT/CCFL matrix */
158 	disptech dtech;				/* Display technology enum */
159 	int     cbid;				/* current calibration base ID, 0 if not a base */
160 	int     ucbid;				/* Underlying base ID if being used for matrix, 0 othewise */
161 	double  ccmat[3][3];		/* Colorimeter correction matrix */
162 
163 	/* For dtype == 1 (Eye-One Display2) */
164 	int     nmeasprds;       	/* Number of disp refresh period measurments to average, deflt 5 */
165 	int     refrmode;			/* 0 for constant, 1 for refresh display */
166 	int     rrset;				/* Flag, nz if the refresh rate has been determined */
167 	double  refperiod;          /* if > 0.0 in refmode, target int time quantization */
168 	double  refrate;			/* Measured refresh rate in Hz */
169 	int     refrvalid;			/* nz if refrate is valid */
170 
171 	double dinttime;			/* default integration time = 1.1 seconds */
172 	double inttime;				/* current integration time = 1.0 seconds */
173 
174 	int     int_clocks;			/* Currently set integration time in clocks */
175 
176 	/* For dtype == 2 (ColorMunki Smile) */
177 	char serno[20];				/* Ascii serial number */
178 
179 	/* misc */
180 	int 	last_com_err;		/* Last icoms error code */
181 
182 }; typedef struct _i1disp i1disp;
183 
184 /* Constructor */
185 extern i1disp *new_i1disp(icoms *icom, instType itype);
186 
187 #ifdef __cplusplus
188 	}
189 #endif
190 
191 #define I1DISP_H
192 #endif /* I1DISP_H */
193