| I2C(3) | Library Functions Manual | I2C(3) |
i2c - basic I2C interface
bind -a #Jn /dev
/dev/i2c.n.ctl
/dev/i2c.n.data
I2c serves a one-level directory with two files that give access to the target device with address n (given in hexadecimal) on the system's I2C bus. N is usually determined by the I2C device manufacturer. I2C gives address 0 special meaning as the `general call' address. See an I2C specification for details.
The control file i2c.n.ctl accepts commands to set the valid address range and subaddressing mode for the corresponding data file. The following control messages can be written to it:
When read, the control file displays the current settings.
The data file i2c.n.data can be read or written to exchange data with the slave device with address n (where n is given in hexadecimal). Each write request transmits the given data to the device. Each read request sends a receive request to the device and returns the resulting data. If the I2C target is subaddressed, the current file offset is used as the subaddress; otherwise the file offset is ignored, and the device typically starts at 0 for each transfer request. Read and write requests are trimmed to the declared size of the device.
/os/port/devi2c.c
/os/*/i2c.c
/os/cerf405/iic.c