Did I find the right examples for you? yes no

All Samples(2)  |  Call(0)  |  Derive(0)  |  Import(2)

src/p/y/PyBBIO-HEAD/bbio/platform/beaglebone/i2c.py   PyBBIO(Download)
 
import bbio
from config import I2C
from i2c_setup import i2cInit
 
        bus : string - represents bus address eg. i2c1, i2c2; not dev_file
        '''
        assert bus in I2C, "Invalid bus address %s" %bus
        self.config = bus
        self.bus = None # This is the smbus object
            print "Could not initialize i2c bus : %s" % self.config 
            return
        self.bus = smbus.SMBus(int(I2C[self.config][0][-1]))
        #smbus takes the dev_file number as parameter, not bus number
        #so if I pass 1 as the parameter, is uses /dev/i2c-1 file not i2c1 bus

src/p/y/PyBBIO-HEAD/bbio/platform/beaglebone/3.8/i2c_setup.py   PyBBIO(Download)
import  cape_manager, bbio, glob, os
from config import I2C
 
def i2cInit(bus):
	'''
	Initializes reqd I2C bus
	i2c0 (/dev/i2c-0) and i2c2 (/dev/i2c-1) are already initialized
	overlay to be applied for i2c1 (/dev/i2c-2)
	'''
	dev_file, overlay = I2C[bus]