Go code written by George McBay ( under BSD License.  
Portions adapted from Adafruit's Raspberry-Pi Python Code Library.


Adafruit's Raspberry-Pi Python Code Library
  Here is a growing collection of libraries and example python scripts
  for controlling a variety of Adafruit electronics with a Raspberry Pi
  In progress!

  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried, Kevin Townsend and Mikey Sklar for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
  To download, we suggest logging into your Pi with Internet accessibility and typing:
  git clone
Expand ▾ Collapse ▴




View Source
const (
	// as defined in /usr/include/linux/i2c-dev.h
	I2C_SLAVE = 0x0703
	I2C_SMBUS = 0x0720
	// as defined in /usr/include/linux/i2c.h
	I2C_SMBUS_WRITE          = 0
	I2C_SMBUS_READ           = 1
	I2C_SMBUS_BLOCK_MAX      = 32


This section is empty.


This section is empty.


type I2CBus

type I2CBus struct {
	// contains filtered or unexported fields

func Bus

func Bus(bus byte) (i2cbus *I2CBus, err error)

    Returns an instance to an I2CBus. If we already have an I2CBus created for the requested bus number, just return that, otherwise set up a new one and open up its associated i2c-dev file

    func (*I2CBus) ReadByteBlock

    func (i2cbus *I2CBus) ReadByteBlock(addr, reg byte, readLength byte) (list []byte, err error)

    func (*I2CBus) WriteByte

    func (i2cbus *I2CBus) WriteByte(addr, reg, value byte) (err error)

    func (*I2CBus) WriteByteBlock

    func (i2cbus *I2CBus) WriteByteBlock(addr, reg byte, list []byte) (err error)

    Source Files


    Path Synopsis