Skip to content

Commit dda6bc8

Browse files
author
K. Townsend
committed
Added I2C bus auto-detect override
1 parent e704414 commit dda6bc8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Adafruit_I2C/Adafruit_I2C.py

+4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ def getPiRevision():
2222

2323
def __init__(self, address, bus=smbus.SMBus(1 if getPiRevision() > 1 else 0), debug=False):
2424
self.address = address
25+
# By default, the correct I2C bus is auto-detected using /proc/cpuinfo
2526
self.bus = bus
27+
# Alternatively, you can hard-code the bus version below:
28+
# self.bus = smbus.SMBus(0); # Force I2C0 (early 256MB Pi's)
29+
# self.bus = smbus.SMBus(1); # Force I2C1 (512MB Pi's)
2630
self.debug = debug
2731

2832
def reverseByteOrder(self, data):

0 commit comments

Comments
 (0)