File: spydX.h

package info (click to toggle)
argyll 2.3.1%2Brepack-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 40,432 kB
  • sloc: ansic: 399,505; javascript: 36,570; xml: 1,551; sh: 674; makefile: 604
file content (145 lines) | stat: -rwxr-xr-x 4,885 bytes parent folder | download
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
#ifndef SPYDX_H

/* 
 * Argyll Color Management System
 *
 * ColorVision Spyder X related software.
 *
 * Author: Graeme W. Gill
 * Date:   20/3/2019
 *
 * Copyright 2006 - 2019, Graeme W. Gill
 * All rights reserved.
 *
 * (Based on spydX.h)
 *
 * This material is licenced under the GNU GENERAL PUBLIC LICENSE Version 2 or later :-
 * see the License2.txt file for licencing details.
 */

/* 
   If you make use of the instrument driver code here, please note
   that it is the author(s) of the code who are responsibility
   for its operation. Any problems or queries regarding driving
   instruments with the Argyll drivers, should be directed to
   the Argyll's author(s), and not to any other party.

   If there is some instrument feature or function that you
   would like supported here, it is recommended that you
   contact Argyll's author(s) first, rather than attempt to
   modify the software yourself, if you don't have firm knowledge
   of the instrument communicate protocols. There is a chance
   that an instrument could be damaged by an incautious command
   sequence, and the instrument companies generally cannot and
   will not support developers that they have not qualified
   and agreed to support.
 */

#include "inst.h"

#ifdef __cplusplus
	extern "C" {
#endif

/* Note: update spydX_interp_error() and spydX_interp_code() in spydX.c */
/* if anything of these #defines are added or subtracted */

typedef int spydX_code;

#define SPYDX_OK   					0x00

/* Fake Error codes */
#define SPYDX_INTERNAL_ERROR		0x61		/* Internal software error */
#define SPYDX_COMS_FAIL				0x62		/* Communication failure */
#define SPYDX_UNKNOWN_MODEL			0x63		/* Not an spydXlay */
#define SPYDX_DATA_PARSE_ERROR  	0x64		/* Read data parsing error */


#define SPYDX_NO_COMS				0x80		/* No communications when it's needed */
#define SPYDX_CIX_MISMATCH			0x81		/* Got different calibration than asked for */

/* Most 8 bit instrument error codes are unknown */
#define SPYDX_BAD_PARAM				0x01		/* Parameter out of range ? */


/* Internal error codes */
#define SPYDX_INT_CAL_SAVE           0xE009		/* Saving calibration to file failed */
#define SPYDX_INT_CAL_RESTORE        0xE00A		/* Restoring calibration to file failed */
#define SPYDX_INT_CAL_TOUCH          0xE00B		/* Touching calibration to file failed */
 
/* Extra native calibration info */
typedef struct {
	int ix;					/* Native index */

	int v1;					/* Magic 8bit value from get_mtx and supplied to get_setup cmd */
							/* Seems to be gain setting (2 bits), but there are no */
							/* setup entries for gains other than 3 (== 64x) */
							/* This is the same for all 4 calibrations and doesn't vary */
							/* with light level. */

	int v2;					/* Magic 16bit value from get_mtx and supplied to measure cmd */
							/* This is the integration time in msec. Actual time = */
							/* 2.8 * floor(v2/2.8), maximum value = 719. Default = 714 */
							/* This is the same for all 4 calibrations and doesn't vary */
							/* with light level. */

	int v3;					/* Magic value returned and not used ? */

	int s1;					/* 8 bit value from get_setup (same as v1, sets gain) */
	int s2[4];				/* Magic values from get_setup and supplied to measure cmd */  
							/* Some sort of trim ?? */
							/* Doesn't seem to vary */
	int s3[4];				/* Black subtraction values from get_setup */

	double mat[3][3];		/* Native calibration matrix */

} calinfo;

#define SPYDX_NOCALIBS 4

/* SPYDX communication object */
struct _spydX {
	INST_OBJ_BASE

	inst_mode mode;				/* Currently selected mode (emis/ambient/etc.) */

	inst_opt_type trig;			/* Reading trigger mode */

	unsigned int hwvn[2];		/* Harware major, Minor version numbers */

								/* Initial SpyderX = 2.07 */


	char    serno[9];			/* 8:8xB  Serial number as zero terminated string */

	/* Computed factors and state */
	inst_disptypesel *dtlist;	/* Display Type list */
	int ndtlist;				/* Number of valid dtlist entries */

	calinfo cinfo[SPYDX_NOCALIBS];	/* cal & meas setup info indexed by native ix */
	
	int ix;						/* current native cal index */
	int cbid;					/* current calibration base ID, 0 if not a base */
	int ucbid;					/* Underlying base ID if being used for matrix, 0 othewise */
	disptech dtech;				/* Display technology enum */

	double ccmat[3][3];			/* Current colorimeter correction matrix, unity if none */

	int bcal_done;				/* Black offset calibration is valid */
	int bcal[3];				/* Black offset calibration values */
	time_t bdate;				/* Date/time of last black calibration */

	int noinitcalib;		 	/* Don't do initial calibrate, or we've done initial calib.  */
	int lo_secs;				/* Seconds since last opened (from calibration file mod time) */ 

}; typedef struct _spydX spydX;

/* Constructor */
extern spydX *new_spydX(icoms *icom, instType itype);

#ifdef __cplusplus
	}
#endif

#define SPYDX_H
#endif /* SPYDX_H */