Charles.Forsyth20060303-partialeea662d19 years agoHistory
87 lines · 2.1 KB · Text
RawDownload
.TH I2C 3.SH NAMEi2c \- basic I2C interface.SH SYNOPSIS.B bind -a.BI #J n.B /dev.PP.BI /dev/i2c. n .ctl. br.BI /dev/i2c. n .data.fi.SH DESCRIPTION.I I2cserves a one-level directory with two filesthat give access to the target device with address.I n(given in hexadecimal)on the system's I2C bus..I Nis usually determined by the I2C device manufacturer.I2C gives address 0 special meaning as the `general call' address.See an I2C specification for details..PPThe control file.BI i2c. n .ctlaccepts commands to set the valid address range andsubaddressing mode for the corresponding data file.The following control messages can be written to it:.TP.B a10Force 10-bit addressing instead of 7-bit addressing.Otherwise 10-bit addressing is used only if the device address.I nis bigger than 255..TP.BI size " nbytes".brSet the logical size of the target device to.IR nbytes .(By default when opened, it is 256 bytes, enough for most small I2C devices.)IO requests will be kept within this limit.This value is also returned by.B Sys->statas the length of the data file..TP.BI subaddress " \fR[\fP n \fR]\fP".brCause subsequent reads and writeson the data file to use I2C subaddressingwith.I nbyte subaddresses (default: 1 byte)..I Nmust be no larger than 4.The target device must support subaddressing.By default, the device is not subaddressed.Setting.I nto zero switches off subaddressing..PPWhen read,the control file displays the current settings..PPThe data file.BI i2c. n .datacan be read or written toexchange data with the slave device with address.I n(where.I nis given in hexadecimal).Each write request transmits the given datato the device.Each read request sends a receiverequest to the device and returns the resulting data.If the I2C target is subaddressed, the current file offsetis 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 declaredsize of the device..SH SOURCE.B /os/port/devi2c.c.br.B /os/*/i2c.c.br.B /os/cerf405/iic.c