I2C的设定及使用
int/string i2c_ioctl(int $i2c_id, string $cmd)
在$cmd上可使用的命令种类及使用方法请参考 PHPoC Device Programming Guide for P40。
根据使用命令的返还值
<?php
include "/lib/sd_340.php";
i2c_ioctl(0, "set saddr 0x0e"); // configuring I2C slave's device address
i2c_ioctl(0, "set mode sm"); // configuring I2C mode (standard mode)
i2c_ioctl(0, "req read 0"); // reading data from the I2C
i2c_ioctl(0, "req write"); // writing data to the I2C
?>