'imu_period'=>'auto',// 0xFFFFFFFF, // 0 - off, >=0xff000000 - "when ready", else - number of SCLK periods
functioninit_default_config(){
'sclk_freq'=>5000000,// $clkr_divr= 8, // 80MHz divisor to get half SCLK rate (defaulkt SCLK=5MHz)
$default_config=array(
'stall'=>2,// SPI stall time in usec
'imu_period'=>'auto',// 0xFFFFFFFF, // 0 - off, >=0xff000000 - "when ready", else - number of SCLK periods
'baud_rate'=>19200,// $rs232_div=80/2/$baud
'sclk_freq'=>5000000,// $clkr_divr= 8, // 80MHz divisor to get half SCLK rate (defaulkt SCLK=5MHz)
'imu_slot'=>1,
'stall'=>2,// SPI stall time in usec
'gps_slot'=>2,
'baud_rate'=>19200,// $rs232_div=80/2/$baud
'gps_mode'=>2,// 0 - pps neg, 1 - pps pos, 2 - start of first sentence after pause, 3 start of sentence
'imu_slot'=>1,
'msg_conf'=>10,// GPIO bit number for external (odometer) input (+16 - invert polarity). Timestamp uses leading edge, software may write to 56-byte buffer before the trailing edge
'gps_mode'=>2,// 0 - pps neg, 1 - pps pos, 2 - start of first sentence after pause, 3 start of sentence
'extra_conf'=>4,// 0 - config_long_sda_en, 1 -config_late_clk, 2 - config_single_wire, should be set for 103695 rev "A"
'msg_conf'=>10,// GPIO bit number for external (odometer) input (+16 - invert polarity). Timestamp uses leading edge, software may write to 56-byte buffer before the trailing edge
'slow_spi'=>0,// set to 1 for slow SPI devices (0 for ADIS-16375)
'imu_sa'=>3,// i2c slave address modifier for the 103695A pca9500
'extra_conf'=>4,// 0 - config_long_sda_en, 1 -config_late_clk, 2 - config_single_wire, should be set for 103695 rev "A"
'sleep_busy'=>30000,// microseconds
'slow_spi'=>0,// set to 1 for slow SPI devices (0 for ADIS-16375)
'imu_registers'=>array(// / Up to 28 total
'imu_sa'=>3,// i2c slave address modifier for the 103695A pca9500
0x10,// x gyro low
'sleep_busy'=>30000,//microseconds
0x12,// x gyro high
'imu_registers'=>array(/// Up to 28 total
0x14,// y gyro low
0x10,// x gyro low
0x16,// y gyro high
0x12,// x gyro high
0x18,// z gyro low
0x14,// y gyro low
0x1a,// z gyro high
0x16,// y gyro high
0x18,// z gyro low
0x1c,// x accel low
0x1a,// z gyro high
0x1e,// x accel high
0x20,// y accel low
0x1c,// x accel low
0x22,// y accel high
0x1e,// x accel high
0x24,// z accel low
0x20,// y accel low
0x26,// z accel high
0x22,// y accel high
0x24,// z accel low
0x40,// x delta angle low
0x26,// z accel high
0x42,// x delta angle high
0x44,// y delta angle low
0x40,// x delta angle low
0x46,// y delta angle high
0x42,// x delta angle high
0x48,// z delta angle low
0x44,// y delta angle low
0x4a,// z delta angle high
0x46,// y delta angle high
0x48,// z delta angle low
0x4c,// x delta velocity low
0x4a,// z delta angle high
0x4e,// x delta velocity high
0x50,// y delta velocity low
0x4c,// x delta velocity low
0x52,// y delta velocity high
0x4e,// x delta velocity high
0x54,// z delta velocity low
0x50,// y delta velocity low
0x56,// z delta velocity high
0x52,// y delta velocity high
0x54,// z delta velocity low
0x0e,// temperature
0x56,// z delta velocity high
0x70,// time m/s
0x72,// time d/h
0x0e,// temperature
0x74
0x70,// time m/s
)// time y/m
0x72,// time d/h
,
0x74// time y/m
'nmea'=>array(
),
// / first three letters - sentence to log (letters after "$GP"). next "n"/"b" (up to 24 total) - "n" number (will be encoded 2 digits/byte, follwed by "0xF"
'nmea'=>array(
// / "b" - byte - all but last will have MSB 0 (& 0x7f), the last one - with MSB set (| 0x80). If there are no characters in the field 0xff will be output
/// first three letters - sentence to log (letters after "$GP"). next "n"/"b" (up to 24 total) - "n" number (will be encoded 2 digits/byte, follwed by "0xF"
array(
/// "b" - byte - all but last will have MSB 0 (& 0x7f), the last one - with MSB set (| 0x80). If there are no characters in the field 0xff will be output
'RMC',
array('RMC','nbnbnbnnnnb'),
'nbnbnbnnnnb'
array('GGA','nnbnbnnnnbnbbb'),
),
array('GSA','bnnnnnnnnnnnnnnnn'),
array(
array('VTG','nbnbnbnb')
'GGA',
),
'nnbnbnnnnbnbbb'
'message'=>'Odometer message'// Message - up to 56 bytes
),
);
array(
return$default_config;
'GSA',
'bnnnnnnnnnnnnnnnn'
),
array(
'VTG',
'nbnbnbnb'
)
),
'message'=>'Odometer message'
)// Message - up to 56 bytes
;
return$default_config;
}
}
/**
/**
Combines $conf and $dflt arrays - all driver parameters are overwritten aftre the call
* Combines $conf and $dflt arrays - all driver parameters are overwritten aftre the call
exec('timeout '.$timeout.' cat /dev/'.$dev,$fullOutput);// &$fullOutput - Fatal error: Call-time pass-by-reference has been removed in php
exec('timeout '.$timeout.' cat /dev/'.$dev,$fullOutput);// &$fullOutput - Fatal error: Call-time pass-by-reference has been removed in php
// var_dump($fullOutput);
// var_dump($fullOutput);
foreach($fullOutputas$line)
foreach($fullOutputas$line)
if(strpos($line,'$GP')===0){
if(strpos($line,'$GP')===0){
$gpsPresent=true;
$gpsPresent=true;
...
@@ -468,8 +473,7 @@ function init_default_config() {
...
@@ -468,8 +473,7 @@ function init_default_config() {
0x70,// time m/s
0x70,// time m/s
0x72,// time d/h
0x72,// time d/h
0x74
0x74
)// time y/m
),// time y/m
,
'nmea'=>array(
'nmea'=>array(
// / first three letters - sentence to log (letters after "$GP"). next "n"/"b" (up to 24 total) - "n" number (will be encoded 4 digits/byte, follwed by "0xF"
// / first three letters - sentence to log (letters after "$GP"). next "n"/"b" (up to 24 total) - "n" number (will be encoded 4 digits/byte, follwed by "0xF"
// / "b" - byte - all but last will have MSB 0 (& 0x7f), the last one - with MSB set (| 0x80). If there are no characters in the field 0xff will be output
// / "b" - byte - all but last will have MSB 0 (& 0x7f), the last one - with MSB set (| 0x80). If there are no characters in the field 0xff will be output
...
@@ -491,8 +495,8 @@ function init_default_config() {
...
@@ -491,8 +495,8 @@ function init_default_config() {
)
)
),
),
'message'=>'Odometer message'
'message'=>'Odometer message'
)// Message - up to 56 bytes
);// Message - up to 56 bytes
;
return$default_config;
return$default_config;
}
}
/**
/**
...
@@ -516,7 +520,7 @@ function combineLoggerConfigs($new_conf, $dflt = null) {
...
@@ -516,7 +520,7 @@ function combineLoggerConfigs($new_conf, $dflt = null) {
while(count($conf['imu_registers'])<28)
while(count($conf['imu_registers'])<28)
$conf['imu_registers'][count($conf['imu_registers'])]=0;// zero pad if less than 28 registers
$conf['imu_registers'][count($conf['imu_registers'])]=0;// zero pad if less than 28 registers
// / Configure NMEA sentences to log. If there are less than 4 - copy additional (unique) from defaults
// / Configure NMEA sentences to log. If there are less than 4 - copy additional (unique) from defaults
while(count($conf['nmea'])<4){
while(count($conf['nmea'])<4){
for($i=0;$i<4;$i++){
for($i=0;$i<4;$i++){
$new=true;
$new=true;
...
@@ -539,7 +543,7 @@ function combineLoggerConfigs($new_conf, $dflt = null) {
...
@@ -539,7 +543,7 @@ function combineLoggerConfigs($new_conf, $dflt = null) {
return$conf;
return$conf;
}
}
functionsetup_IMU_logger($conf){
functionsetup_IMU_logger($conf){
global$verbose;
global$verbose,$binfile;
// $xclk_freq=80000000; // 80 MHz in NC353
// $xclk_freq=80000000; // 80 MHz in NC353
$xclk_freq=100000000;// 100 MHz in NC393
$xclk_freq=100000000;// 100 MHz in NC393
$data=array();
$data=array();
...
@@ -582,13 +586,13 @@ function setup_IMU_logger($conf) {
...
@@ -582,13 +586,13 @@ function setup_IMU_logger($conf) {