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.1.1  2008/11/27 20:04:03  elphel
00023 *!
00024 *!
00025 *!  Revision 1.1  2007/12/06 19:02:52  elphel
00026 *!  collected most of the camera PHP script into one  /packages/web/353/php_top directory
00027 *!
00028 *!  Revision 1.1  2007/10/12 23:00:45  elphel
00029 *!  adding power347.php to control power supplies and power timeout (supporting new FPGA interface)
00030 *!
00031 *!  Revision 1.1  2007/10/11 06:43:56  elphel
00032 *!  Added two small PHP scripts to controll compressor (all sensors) and trigger (CCD with 10347 board only)
00033 *!
00034 *!
00035 */
00036 
00037 
00038 //slow version of functions - they will reopen i2c for each word
00039 function send347($register_address,$d0=0) {
00040    $i2c  = fopen('/dev/xi2c16', 'w');
00041    fseek ($i2c, 0x2000+2*$register_address) ; //Micron sensor slave 0xba
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 ?>

Generated on Fri Nov 28 00:06:25 2008 for elphel by  doxygen 1.5.1