i2c_ctl_arr(0,$i2c_old_ctrl);/// restore old speed (not thread-safe)
$data=="";
foreach($i2c_dataas$c)$data.=chr($c);
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
$data=fread($i2c,256);// full 256 bytes
fclose($i2c);
if(($bus==0)&&($extrausec>=0)){
i2c_ctl_arr(0,$i2c_old_ctrl);// / restore old speed (not thread-safe)
}
}
return$data;
return$data;
}// end of i2c_read256b ()
}// end of i2c_read256b ()
//this EEPROM writes only 4 bytes sequentionally (only 2 LSBs are incremented)
//this EEPROM writes only 4 bytes sequentionally (only 2 LSBs are incremented)
functioni2c_write256b($data,$slave=0xa0,$bus=1,$extrausec=0){//will write up to 256 bytes $data to slave (address is 8-bit, includes r/~w). EEPROM should be un-protected
functioni2c_write256b($data,$slave=0xa0,$bus=4,$extrausec=0){// will write up to 256 bytes $data to slave (address is 8-bit, includes r/~w). EEPROM should be un-protected