00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 function send347($register_address,$d0=0) {
00037 $i2c = fopen('/dev/xi2c16', 'w');
00038 fseek ($i2c, 0x2000+2*$register_address) ;
00039 fwrite($i2c, chr (floor($d0/256)).chr ($d0-256*floor($d0/256)));
00040 fclose($i2c);
00041 }
00042
00043 $good=TRUE;
00044 $data= 0;
00045 $timeout=$_GET['timeout'];
00047 if ($timeout != "") {
00048 if (($timeout=="off") || ($timeout=="off")) $timeout=0;
00049 if (!is_numeric($timeout)) $good=FALSE;
00050 else {
00051 $timeout=intval(1000*$timeout);
00052 if ( ($timeout==0) || ($timeout >= 65535)) $timeout = 65535;
00053 send347(0x80,$timeout);
00054 }
00055 }
00057 switch ($_GET['pwr']) {
00058 case "":break;
00059 case "dis":
00060 case "off":
00061 $data|=0x2;
00062 break;
00063 case "en":
00064 case "on":
00065 $data|=0x3;
00066 break;
00067 default:$good=FALSE;
00068 }
00069
00071
00072 switch ($_GET['shtr']) {
00073 case "":break;
00074 case "dis":$data|=0x8; break;
00075 case "en": $data|=0xc; break;
00076 default:$good=FALSE;
00077 }
00078 if (($good != FALSE) && ($data != 0))
00079 send347(0x10,$data);
00080 else if (! is_numeric($timeout))
00081 echo <<<USAGE
00082 <p>This script controls powering parts of the camera modules controlled by the 10347 CCD timing board:</p>
00083 <ul>
00084 <li><b>pwr=en</b> - enables analog power supplies turning on when image acuisition is triggered (subject to timeout)</li>
00085 <li><b>pwr=dis</b> - disables analog power ( and turns off at once)</li>
00086 <li><b>shtr=en</b> - enable mechanical shutter power (to be controlled by sequencer)</li>
00087 <li><b>shtr=dis</b> - enable mechanical shutter power (to be controlled by sequencer)</li>
00088 <li><b>timeout=off</b> - analog power will stay on indefinitely</li>
00089 <li><b>timeout=<i>ttt</i></b> - analog power will stay on for <i>ttt</i> seconds after exposure</li>
00090 </ul>
00091 USAGE;
00092
00093
00094 ?>