1 #ifndef I1D3_H 2 3 /* 4 * Argyll Color Correction System 5 * 6 * X-Rite i1d3 related defines 7 * 8 * Author: Graeme W. Gill 9 * Date: 7/10/2007 10 * 11 * Copyright 2006 - 2013, Graeme W. Gill 12 * All rights reserved. 13 * 14 * (Based on huey.h) 15 * 16 * This material is licenced under the GNU GENERAL PUBLIC LICENSE Version 2 or later :- 17 * see the License2.txt file for licencing details. 18 */ 19 20 /* 21 If you make use of the instrument driver code here, please note 22 that it is the author(s) of the code who take responsibility 23 for its operation. Any problems or queries regarding driving 24 instruments with the Argyll drivers, should be directed to 25 the Argyll's author(s), and not to any other party. 26 27 If there is some instrument feature or function that you 28 would like supported here, it is recommended that you 29 contact Argyll's author(s) first, rather than attempt to 30 modify the software yourself, if you don't have firm knowledge 31 of the instrument communicate protocols. There is a chance 32 that an instrument could be damaged by an incautious command 33 sequence, and the instrument companies generally cannot and 34 will not support developers that they have not qualified 35 and agreed to support. 36 */ 37 38 #include "inst.h" 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 /* Note: update huey_interp_error() and huey_interp_code() in huey.c */ 45 /* if anything of these #defines are added or subtracted */ 46 47 /* Fake Error codes */ 48 #define I1D3_INTERNAL_ERROR 0x61 /* Internal software error */ 49 #define I1D3_COMS_FAIL 0x62 /* Communication failure */ 50 #define I1D3_UNKNOWN_MODEL 0x63 /* Not an i1d3 */ 51 #define I1D3_DATA_PARSE_ERROR 0x64 /* Read data parsing error */ 52 53 /* Real error code */ 54 #define I1D3_OK 0x00 55 56 #define I1D3_UNKNOWN_UNLOCK 0x01 57 #define I1D3_UNLOCK_FAIL 0x02 58 #define I1D3_BAD_EX_CHSUM 0x03 59 60 #define I1D3_SPOS_EMIS 0x05 /* Needs to be in emsissive configuration */ 61 #define I1D3_SPOS_AMB 0x06 /* Needs to be in ambient configuration */ 62 63 #define I1D3_TOO_FEW_CALIBSAMP 0x10 64 65 #define I1D3_BAD_WR_LENGTH 0x11 66 #define I1D3_BAD_RD_LENGTH 0x12 67 #define I1D3_BAD_RET_STAT 0x13 68 #define I1D3_BAD_RET_CMD 0x14 69 #define I1D3_NOT_INITED 0x15 70 #define I1D3_TOOBRIGHT 0x16 71 72 /* Internal errors */ 73 #define I1D3_BAD_MEM_ADDRESS 0x20 74 #define I1D3_BAD_MEM_LENGTH 0x21 75 #define I1D3_INT_CIECONVFAIL 0x22 76 #define I1D3_INT_MATINV_FAIL 0x23 77 #define I1D3_BAD_LED_MODE 0x24 78 #define I1D3_NO_COMS 0x25 79 #define I1D3_BAD_STATUS 0x26 80 #define I1D3_INT_THREADFAILED 0x27 81 82 /* Sub-type of instrument */ 83 typedef enum { 84 i1d3_disppro = 0, /* i1 DisplayPro */ 85 i1d3_munkdisp = 1, /* ColorMunki Display */ 86 i1d3_oem = 2, /* Generic OEM */ 87 i1d3_nec_ssp = 3, /* NEC SpectraSensor Pro */ 88 i1d3_quato_sh3 = 4, /* Quato Silver Haze 3 */ 89 i1d3_hp_dreamc = 5, /* HP DreameColor */ 90 i1d3_sc_c6 = 6 /* SpectraCal C6 */ 91 } i1d3_dtype; 92 93 /* Measurement mode */ 94 typedef enum { 95 i1d3_adaptive = 0, /* Frequency over fixed period then adaptive period measurement (def) */ 96 i1d3_frequency = 1, /* Frequency over fixed period measurement */ 97 i1d3_period = 2 /* Adaptive period measurement */ 98 } i1d3_mmode; 99 100 /* I1D3 communication object */ 101 struct _i1d3 { 102 INST_OBJ_BASE 103 104 amutex lock; /* Command lock */ 105 106 /* Modes */ 107 inst_mode mode; /* Currently selected mode */ 108 inst_opt_type trig; /* Reading trigger mode */ 109 110 /* Information and EEPROM values */ 111 i1d3_dtype dtype; /* Base type of instrument, ie i1d3_disppro or i1d3_munkdisp */ 112 i1d3_dtype stype; /* Sub type of instrument, ie. any of i1d3_dtype. */ 113 /* (Only accurate if it needed unlocking). */ 114 int status; /* 0 if status is ok (not sure what this is) */ 115 char serial_no[21]; /* "I1-11.A-01.100999.02" or "CM-11.A-01.100999.02" */ 116 char vers_no[11]; /* "A-01", "A-02" */ 117 char prod_name[32]; /* "i1Display3 " or "ColorMunki Display" */ 118 int prod_type; /* 16 bit product type number. i1d3_disppro = 0x0001, */ 119 /* i1d3_munkdisp = 0x0002 */ 120 char firm_ver[32]; /* Firmwar version string. ie. "v1.0 " */ 121 char firm_date[32]; /* Firmwar date string. ie. "11Jan11" */ 122 123 /* Calibration information */ 124 ORD64 cal_date; /* Calibration date */ 125 xspect sens[3]; /* RGB Sensor spectral sensitivities in Hz per mW/nm */ 126 xspect ambi[3]; /* RGB Sensor with ambient filter spectral sensitivities */ 127 128 double black[3]; /* Black level to subtract */ 129 double emis_cal[3][3]; /* Current emssion calibration matrix */ 130 double ambi_cal[3][3]; /* Current ambient calibration matrix */ 131 132 inst_disptypesel *dtlist; /* Display Type list */ 133 int ndtlist; /* Number of valid dtlist entries */ 134 int icx; /* Internal calibration matrix index, 11 = Raw */ 135 disptech dtech; /* Display technology enum */ 136 int cbid; /* current calibration base ID, 0 if not a base */ 137 int ucbid; /* Underlying base ID if being used for matrix, 0 othewise */ 138 int refrmode; /* nz if in refresh display mode/double int. time */ 139 icxObserverType obType; /* ccss observer to use */ 140 xspect custObserver[3]; /* Custom ccss observer to use */ 141 double ccmat[3][3]; /* Optional colorimeter correction matrix, unity if none. */ 142 xspect *samples; /* Copy of current calibration spectral samples, NULL if none */ 143 int nsamp; /* Number of samples, 0 if none */ 144 145 /* Computed factors and state */ 146 int rrset; /* Flag, nz if the refresh rate has been determined */ 147 double refperiod; /* if > 0.0 in refmode, target int time quantization */ 148 double refrate; /* Measured refresh rate in Hz */ 149 int refrvalid; /* nz if refrate is valid */ 150 double clk_freq; /* Clock frequency (12Mhz) */ 151 double omininttime; /* Override minimum integration time = 0.0 = none */ 152 double dinttime; /* default integration time = 0.2 seconds */ 153 double mininttime; /* current minimum integration time (doubled for refresh) */ 154 double inttime; /* current (quantized, doubled) integration time = 0.2 seconds */ 155 156 double transblend; /* Blend between fixed and adaptive integration */ 157 /* at low light levels */ 158 159 /* Other state */ 160 int led_state; /* : Current LED on/off state */ 161 double led_period, led_on_time_prop, led_trans_time_prop; /* Pulse state */ 162 163 athread *th; /* Diffuser position monitoring thread */ 164 volatile int th_en; /* Enable updating diffuser possition */ 165 volatile int th_term; /* nz to terminate thread */ 166 volatile int th_termed; /* nz when thread terminated */ 167 int dpos; /* Diffuser position, 0 = display, 1 = ambient */ 168 169 volatile double whitestamp; /* meas_delay() white timestamp */ 170 171 }; typedef struct _i1d3 i1d3; 172 173 /* Constructor */ 174 extern i1d3 *new_i1d3(icoms *icom, instType itype); 175 176 #ifdef __cplusplus 177 } 178 #endif 179 180 #define I1D3_H 181 #endif /* I1D3_H */ 182