2 INDI driver
for SBIG CCD
3 Copyright (C
) 2005 Chris
Curran (ccurran AT planetcurran DOT com
)
5 Based on Apogee PPI driver by Jasem
Mutlaq (mutlaqja AT ikarustech DOT com
)
7 This library is free software
; you can redistribute it
and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation
; either
10 version
2.1 of the License
, or (at your option
) any later version
.
12 This library is distributed in the hope that it will be useful
,
13 but WITHOUT ANY WARRANTY
; without even the implied warranty of
14 MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE
. See the GNU
15 Lesser General Public License
for more details
.
17 You should have received a copy of the GNU Lesser General Public
18 License along with
this library
; if not, write to the Free Software
19 Foundation
, Inc
., 59 Temple Place
, Suite
330, Boston
, MA
02111-1307 USA
37 #include "indidevapi.h"
38 #include "eventloop.h"
41 #define mydev "SBIG CCD"
43 #define COMM_GROUP "Communication"
44 #define EXPOSE_GROUP "Expose"
45 #define IMAGE_GROUP "Image Settings"
47 #define POLLMS 1000 /* Polling time (ms) */
48 #define TEMP_THRESHOLD .25 /* Differential temperature threshold (C)*/
50 #define MAX_PIXELS 4096
53 #define MIN_CCD_TEMP -60
54 #define MAX_CCD_TEMP 40
56 #define getBigEndian(p) ( ((p & 0xff) << 8) | (p >> 8))
65 /* INDI Functions that must be called from indidrivermain */
66 void ISGetProperties (const char *dev
);
67 void ISNewSwitch (const char *dev
, const char *name
, ISState
*states
, char *names
[], int n
);
68 void ISNewText (const char *dev
, const char *name
, char *texts
[], char *names
[], int n
);
69 void ISNewNumber (const char *dev
, const char *name
, double values
[], char *names
[], int n
);
85 enum { LIGHT_FRAME
, BIAS_FRAME
, DARK_FRAME
, FLAT_FRAME
};
89 ISwitch FrameTypeS
[4];
94 INumber ExposeTimeN
[1];
95 INumber TemperatureN
[1];
101 ISwitchVectorProperty PowerSP
; /* Connection switch */
102 ISwitchVectorProperty FrameTypeSP
; /* Frame type */
105 INumberVectorProperty FrameNP
; /* Frame specs */
106 INumberVectorProperty BinningNP
; /* Binning */
107 INumberVectorProperty ExposeTimeNP
; /* Exposure */
108 INumberVectorProperty TemperatureNP
; /* Temperature control */
112 IBLOBVectorProperty imageBP
; /* Data stream */
115 double targetTemp
; /* Target temperature */
120 void initProperties();
124 void getBasicData(void);
125 void handleExposure(void *);
126 void connectCCD(void);
127 void uploadFile(char * filename
);
128 int writeFITS(char *filename
, char errmsg
[]);
129 void grabImage(void);
130 int isCCDConnected(void);
133 int checkPowerS(ISwitchVectorProperty
*sp
);
134 int checkPowerN(INumberVectorProperty
*np
);
135 int checkPowerT(ITextVectorProperty
*tp
);
137 /* Helper functions */
138 int manageDefaults(char errmsg
[]);
139 int getOnSwitch(ISwitchVectorProperty
*sp
);
140 FITS_HDU_LIST
* create_fits_header (FITS_FILE
*ofp
, uint width
, uint height
, uint bpp
);
141 static void ISStaticPoll(void *);