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
00037
00038
00039 function send347($register_address,$d0=0) {
00040 $i2c = fopen('/dev/xi2c16', 'w');
00041 fseek ($i2c, 0x2000+2*$register_address) ;
00042 fwrite($i2c, chr (floor($d0/256)).chr ($d0-256*floor($d0/256)));
00043 fclose($i2c);
00044 }
00045
00046 $good=TRUE;
00047 $data= 0;
00048 $timeout=$_GET['timeout'];
00050 if ($timeout != "") {
00051 if (($timeout=="off") || ($timeout=="off")) $timeout=0;
00052 if (!is_numeric($timeout)) $good=FALSE;
00053 else {
00054 $timeout=intval(1000*$timeout);
00055 if ( ($timeout==0) || ($timeout >= 65535)) $timeout = 65535;
00056 send347(0x80,$timeout);
00057 }
00058 }
00060 switch ($_GET['pwr']) {
00061 case "":break;
00062 case "dis":
00063 case "off":
00064 $data|=0x2;
00065 break;
00066 case "en":
00067 case "on":
00068 $data|=0x3;
00069 break;
00070 default:$good=FALSE;
00071 }
00072
00074
00075 switch ($_GET['shtr']) {
00076 case "":break;
00077 case "dis":$data|=0x8; break;
00078 case "en": $data|=0xc; break;
00079 default:$good=FALSE;
00080 }
00081 if (($good != FALSE) && ($data != 0))
00082 send347(0x10,$data);
00083 else if (! is_numeric($timeout))
00084 echo <<<USAGE
00085 <p>This script controls powering parts of the camera modules controlled by the 10347 CCD timing board:</p>
00086 <ul>
00087 <li><b>pwr=en</b> - enables analog power supplies turning on when image acuisition is triggered (subject to timeout)</li>
00088 <li><b>pwr=dis</b> - disables analog power ( and turns off at once)</li>
00089 <li><b>shtr=en</b> - enable mechanical shutter power (to be controlled by sequencer)</li>
00090 <li><b>shtr=dis</b> - enable mechanical shutter power (to be controlled by sequencer)</li>
00091 <li><b>timeout=off</b> - analog power will stay on indefinitely</li>
00092 <li><b>timeout=<i>ttt</i></b> - analog power will stay on for <i>ttt</i> seconds after exposure</li>
00093 </ul>
00094 USAGE;
00095
00096
00097 ?>