Loading src/php_top/i2c.php +3 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,9 @@ switch ($cmd) { case "fromEEPROM" : if (($EEPROM_bus0 == 4) || ($EEPROM_bus0 == 5)) { // using FPGA PIO bus (bus=1 in NC353) for IMU, GPS and such, bus = 5 - 10389 eeprom $rslt=i2c_read256b(0xa0+($EEPROM_chn * 2), $EEPROM_bus0); if (!is_string($rslt)){ break; // will report error } $zero=strpos($rslt,chr(0)); if ($zero!==false) $rslt=substr($rslt,0, $zero); if (substr($rslt,0,5)=="<?xml") { Loading src/php_top/i2c_include.php +13 −4 Original line number Diff line number Diff line Loading @@ -418,15 +418,24 @@ function i2c_read256b($slave = 0xa0, $bus = 4, $extrausec = 0) { // will read 25 } if ($bus == 2) { // System i2c in nc393 (was 5) $sa7 = $slave >> 1; for($i = 0; $i < 256; $i ++) /* // very slow for($i = 0; $i < 256; $i ++) { exec ( 'i2cget -y 0 ' . $sa7 . ' ' . $i . ' b', $i2c_data, $return ); if ($return != 0) return - 1; } $data == ""; foreach ($i2c_data as $c) $data.=chr($c); */ exec('i2cdump -y 0 ' . $sa7 . ' b', $i2c_data, $return ); if ($return != 0) return - 1; // Extract data from dump table $line=""; for ($j=0; $j<16; $j++) $line .= substr($i2c_data[$j+1],4,48); $data == ""; foreach (explode(' ',$line) as $e) $data.=chr(intval($e,16)); return $data; } $i2c_fn = '/dev/xi2c8' . (($bus == 0) ? '' : '_aux'); $i2c = fopen ( $i2c_fn, 'r' ); fseek ( $i2c, $slave * 128 ); // 256 per slave, but slave are only even Loading src/php_top/parsedit.php +4 −1 Original line number Diff line number Diff line Loading @@ -1468,15 +1468,18 @@ function getDescription ($compositeName,$descriptions){ */ function getParDescriptions($autocampars) { /* $file=file($autocampars); $path=""; foreach ($file as $line) if (strpos($line,'$configPath')!==false ){ foreach ($file as $line) if ((strpos($line,'$configPath')!==false ) || ((strpos($line,"'configPath'")!==false)){ $name= strtok ($line,'"'); if (strpos ($name,'//')===false) { $path=strtok ('"'); break; } } */ $path='/etc/elphel393/autocampars0.xml'; $path = str_replace("0.",strval($GLOBALS [sensor_port]).".",$path); // NC393: here it does not really matter $xml = simplexml_load_file($path); $descriptions=array(); Loading Loading
src/php_top/i2c.php +3 −0 Original line number Diff line number Diff line Loading @@ -234,6 +234,9 @@ switch ($cmd) { case "fromEEPROM" : if (($EEPROM_bus0 == 4) || ($EEPROM_bus0 == 5)) { // using FPGA PIO bus (bus=1 in NC353) for IMU, GPS and such, bus = 5 - 10389 eeprom $rslt=i2c_read256b(0xa0+($EEPROM_chn * 2), $EEPROM_bus0); if (!is_string($rslt)){ break; // will report error } $zero=strpos($rslt,chr(0)); if ($zero!==false) $rslt=substr($rslt,0, $zero); if (substr($rslt,0,5)=="<?xml") { Loading
src/php_top/i2c_include.php +13 −4 Original line number Diff line number Diff line Loading @@ -418,15 +418,24 @@ function i2c_read256b($slave = 0xa0, $bus = 4, $extrausec = 0) { // will read 25 } if ($bus == 2) { // System i2c in nc393 (was 5) $sa7 = $slave >> 1; for($i = 0; $i < 256; $i ++) /* // very slow for($i = 0; $i < 256; $i ++) { exec ( 'i2cget -y 0 ' . $sa7 . ' ' . $i . ' b', $i2c_data, $return ); if ($return != 0) return - 1; } $data == ""; foreach ($i2c_data as $c) $data.=chr($c); */ exec('i2cdump -y 0 ' . $sa7 . ' b', $i2c_data, $return ); if ($return != 0) return - 1; // Extract data from dump table $line=""; for ($j=0; $j<16; $j++) $line .= substr($i2c_data[$j+1],4,48); $data == ""; foreach (explode(' ',$line) as $e) $data.=chr(intval($e,16)); return $data; } $i2c_fn = '/dev/xi2c8' . (($bus == 0) ? '' : '_aux'); $i2c = fopen ( $i2c_fn, 'r' ); fseek ( $i2c, $slave * 128 ); // 256 per slave, but slave are only even Loading
src/php_top/parsedit.php +4 −1 Original line number Diff line number Diff line Loading @@ -1468,15 +1468,18 @@ function getDescription ($compositeName,$descriptions){ */ function getParDescriptions($autocampars) { /* $file=file($autocampars); $path=""; foreach ($file as $line) if (strpos($line,'$configPath')!==false ){ foreach ($file as $line) if ((strpos($line,'$configPath')!==false ) || ((strpos($line,"'configPath'")!==false)){ $name= strtok ($line,'"'); if (strpos ($name,'//')===false) { $path=strtok ('"'); break; } } */ $path='/etc/elphel393/autocampars0.xml'; $path = str_replace("0.",strval($GLOBALS [sensor_port]).".",$path); // NC393: here it does not really matter $xml = simplexml_load_file($path); $descriptions=array(); Loading