Skip to content
This repository was archived by the owner on Sep 30, 2019. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Adafruit_I2C/Adafruit_I2C.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ def getPiRevision():
with open('/proc/cpuinfo','r') as f:
for line in f:
if line.startswith('Revision'):
return 1 if line.rstrip()[-1] in ['2','3'] else 2
rev_num = int(line.rstrip()[-4:], 16)
if rev_num <= 3: return 1
elif rev_num > 3 and rev_num < 16: return 2
else: return 3
except:
return 0

Expand Down