Example #1
0
// I2cStart initializes i2c device for addresss
func (e *Adaptor) I2cStart(address int) (err error) {
	if e.i2cDevice != nil {
		return
	}

	// TODO: handle the additional I2C buses
	e.i2cDevice, err = sysfs.NewI2cDevice("/dev/i2c-0", address)
	return
}
Example #2
0
// I2cStart initializes i2c device for addresss
func (e *Adaptor) I2cStart(address int) (err error) {
	if e.i2cDevice != nil {
		return
	}

	// most board use I2C bus 1
	bus := "/dev/i2c-1"

	// except for Arduino which uses bus 6
	if e.board == "arduino" {
		bus = "/dev/i2c-6"
		e.arduinoI2CSetup()
	}

	e.i2cDevice, err = sysfs.NewI2cDevice(bus, address)
	return
}
Example #3
0
// I2cStart starts a i2c device in specified address on i2c bus /dev/i2c-1
func (b *Adaptor) I2cStart(address int) (err error) {
	if b.i2cDevice == nil {
		b.i2cDevice, err = sysfs.NewI2cDevice("/dev/i2c-1", address)
	}
	return
}
Example #4
0
// I2cStart starts a i2c device in specified address
func (r *Adaptor) I2cStart(address int) (err error) {
	if r.i2cDevice == nil {
		r.i2cDevice, err = sysfs.NewI2cDevice(r.i2cLocation, address)
	}
	return err
}