Version: v0.0.0-...-f612f80 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2015 License: Apache-2.0 Imports: 4 Imported by: 0



Package i2c provides low level control over the linux i2c bus. based on https://github.com/davecheney/i2c/blob/master/i2c.go



View Source
const (
	I2C_RETRIES = 0x0701 /* number of times a device address should be polled when not acknowledging */
	I2C_TIMEOUT = 0x0702 /* set timeout in units of 10 ms */
	/* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses
	 * are NOT supported! (due to code brokenness)
	I2C_SLAVE       = 0x0703 /* Use this slave address */
	I2C_SLAVE_FORCE = 0x0706 /* Use this slave address, even if it is already in use by a driver! */
	I2C_TENBIT      = 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
	I2C_FUNCS       = 0x0705 /* Get the adapter functionality mask */
	I2C_RDWR        = 0x0707 /* Combined R/W transfer (one STOP only) */
	I2C_PEC         = 0x0708 /* != 0 to use PEC with SMBus */
	I2C_SMBUS       = 0x0720 /* SMBus transfer */
View Source
const I2CCLOCK_CHANGE = 0x0740


This section is empty.


func SetBusFreq

func SetBusFreq(hz uint) error


type I2C

type I2C struct {
	// contains filtered or unexported fields

I2C represents a connection to an i2c device.

func New

func New(addr uint, bus int) (*I2C, error)

New opens a connection to an i2c device.

func (*I2C) Read

func (i2c *I2C) Read(b []byte) error

func (*I2C) Write

func (i2c *I2C) Write(buf ...byte) error

Write sends buf to the remote i2c device. The interpretation of the message is implementation dependant.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL