func TenBit(addr int) int
TenBit marks an I2C address as a 10-bit address.
Devfs is an I2C driver that works against the devfs. You need to load the "i2c-dev" kernel module to use this driver.
type Devfs struct { // Dev is the I2C bus device, e.g. /dev/i2c-1. Required. Dev string }
func (d *Devfs) Open(addr int, tenbit bool) (driver.Conn, error)
Device represents an I2C device. Devices must be closed once they are no longer in use.
type Device struct {
// contains filtered or unexported fields
}
func Open(o driver.Opener, addr int) (*Device, error)
Open opens a connection to an I2C device. All devices must be closed once they are no longer in use. For devices that use 10-bit I2C addresses, addr can be marked as a 10-bit address with TenBit.
▹ Example
func (d *Device) Close() error
Close closes the device and releases the underlying sources.
func (d *Device) Read(buf []byte) error
Read reads len(buf) bytes from the device.
func (d *Device) ReadReg(reg byte, buf []byte) error
ReadReg is similar to Read but it reads from a register.
func (d *Device) Write(buf []byte) (err error)
Write writes the buffer to the device. If it is required to write to a specific register, the register should be passed as the first byte in the given buffer.
func (d *Device) WriteReg(reg byte, buf []byte) (err error)
WriteReg is similar to Write but writes to a register.