packages/web/353/php_top/power347.php

Go to the documentation of this file.
00001 <?php
00002 /*!***************************************************************************
00003 *! FILE NAME  : power347.php
00004 *! DESCRIPTION: Controls triggering of 10347 CCD timing board
00005 *! Copyright (C) 2007 Elphel, Inc
00006 *! -----------------------------------------------------------------------------**
00007 *!
00008 *!  This program is free software: you can redistribute it and/or modify
00009 *!  it under the terms of the GNU General Public License as published by
00010 *!  the Free Software Foundation, either version 3 of the License, or
00011 *!  (at your option) any later version.
00012 *!
00013 *!  This program is distributed in the hope that it will be useful,
00014 *!  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 *!  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 *!  GNU General Public License for more details.
00017 *!
00018 *!  You should have received a copy of the GNU General Public License
00019 *!  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020 *! -----------------------------------------------------------------------------**
00021 *!  $Log: power347.php,v $
00022 *!  Revision 1.1  2007/12/06 19:02:52  elphel
00023 *!  collected most of the camera PHP script into one  /packages/web/353/php_top directory
00024 *!
00025 *!  Revision 1.1  2007/10/12 23:00:45  elphel
00026 *!  adding power347.php to control power supplies and power timeout (supporting new FPGA interface)
00027 *!
00028 *!  Revision 1.1  2007/10/11 06:43:56  elphel
00029 *!  Added two small PHP scripts to controll compressor (all sensors) and trigger (CCD with 10347 board only)
00030 *!
00031 *!
00032 */
00033 
00034 
00035 //slow version of functions - they will reopen i2c for each word
00036 function send347($register_address,$d0=0) {
00037    $i2c  = fopen('/dev/xi2c16', 'w');
00038    fseek ($i2c, 0x2000+2*$register_address) ; //Micron sensor slave 0xba
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 ?>

Generated on Thu Aug 7 16:19:01 2008 for elphel by  doxygen 1.5.1