You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alexander Hiam edited this page Apr 17, 2015
·
2 revisions
This library allows you to communicate with I2C devices.
The BeagleBone Black (BBB) has two exposed I2C buses.
####I2C1 :
SCL : P9_17
SDA : P9_18
####I2C2 :
SCL : P9_19
SDA : P9_20
The 2 I2C buses are accessed through the pre-initialized objects I2C1 and I2C2.
##API
####I2Cn.open(use_10bit_address=False):
Initialize the I2C bus interface.
If the optional argument use_10bit_address=True the bus will use 10-bit slave addresses instead of 7-bit addresses.
####I2Cn.close(use_10bit_address=False):
Closes the I2C bus interface.
####I2Cn.read(slave_addr, n_bytes):
Reads n_bytes words from the I2C slave device with the given address and returns them as a list.
####I2Cn.readTransaction(slave_addr, tx_byte, n_bytes)
Writes tx_byte then immediately reads n_bytes words from the I2C slave device with the given address and returns them as a list.
####I2Cn.write(slave_addr, [bytes])
Writes the given list of bytes to the I2C slave device with the given address. Only integers in the range [0,255] are valid.