I2C通信设定
void i2c_setup(int $i2c_id, int $saddr[, string $mode = “sm”])
$mode: SPI模式(标准模式 - sm, 高速模式 - fm)
I2C mode | notation | clock speed |
---|---|---|
standard | sm | 100Kbps |
fast | fm | 400Kbps |
none
<?php
include "/lib/sd_340.php";
i2c_setup(0, 0x1e); // configuring I2C slave address (0x0E)
i2c_setup(0, 0x1e, "fm"); // configuring I2C slave address (0x0E) and fast mode
?>