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

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