packages/web/353/php_top/trig.php

Go to the documentation of this file.
00001 <?php
00002 /*!***************************************************************************
00003 *! FILE NAME  : trig.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: trig.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:53  elphel
00026 *!  collected most of the camera PHP script into one  /packages/web/353/php_top directory
00027 *!
00028 *!  Revision 1.4  2007/10/31 04:59:41  elphel
00029 *!  Included changes by Diego
00030 *!
00031 *!  Revision 1.3  2007/10/16 20:03:06  elphel
00032 *!  removed irrelevant comment
00033 *!
00034 *!  Revision 1.2  2007/10/12 23:00:46  elphel
00035 *!  adding power347.php to control power supplies and power timeout (supporting new FPGA interface)
00036 *!
00037 *!  Revision 1.1  2007/10/11 06:43:56  elphel
00038 *!  Added two small PHP scripts to controll compressor (all sensors) and trigger (CCD with 10347 board only)
00039 *!
00040 *!
00041 */
00042 
00043 
00044 //slow version of functions - they will reopen i2c for each word
00045 function send347($register_address,$d0=0) {
00046    $i2c  = fopen('/dev/xi2c16', 'w');
00047    fseek ($i2c, 0x2000+2*$register_address) ;
00048    fwrite($i2c, chr (floor($d0/256)).chr ($d0-256*floor($d0/256)));
00049    fclose($i2c);
00050 }
00051 
00052 //print_r ($_GET);
00053  switch  ($_GET['cmd']) {
00054   case "immed":    send347(0x14,0); print "OK immed"; break; 
00055   case "arm":      send347(0x14,3); print "OK arm"; break; 
00056   case "disarm":   send347(0x14,2); print "OK disarm";  break; 
00057   case "single":   send347(0x14,1); print "OK single"; break; 
00058   case "fireall":  send347(0x14,4); print "OK fireall"; break; 
00059   default:
00060     echo <<<USAGE
00061    <p>This script controls triggering of 10347 CCD timing board:</p>
00062    <ul>
00063     <li><b>cmd=immed</b> - immediately trigger this camera module</li>
00064     <li><b>cmd=arm</b> -   arm camera to accept external trigger</li>
00065     <li><b>cmd=disarm</b> - disarm camera (will ignore trigger) </li>
00066     <li><b>cmd=single</b> - arm camera for one external trigger only, then disarm </li>
00067     <li><b>cmd=fireall</b> - generate external trigger out pulse </li>
00068   </ul>
00069 USAGE;
00070   }
00071 
00072 
00073 ?>

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