Made the ZeroBorg module Python3-friendly

This commit is contained in:
Fabio Manganiello 2018-02-20 20:41:56 +01:00
parent f16719f575
commit 779a907ebd

View file

@ -217,9 +217,8 @@ Command codes can be found at the top of ZeroBorg.py, data is a list of 0 or mor
Under most circumstances you should use the appropriate function instead of RawWrite Under most circumstances you should use the appropriate function instead of RawWrite
""" """
rawOutput = chr(command) rawOutput = bytes([command])
for singleByte in data: if data: rawOutput += bytes(data)
rawOutput += chr(singleByte)
self.i2cWrite.write(rawOutput) self.i2cWrite.write(rawOutput)
@ -240,7 +239,7 @@ Under most circumstances you should use the appropriate function instead of RawR
rawReply = self.i2cRead.read(length) rawReply = self.i2cRead.read(length)
reply = [] reply = []
for singleByte in rawReply: for singleByte in rawReply:
reply.append(ord(singleByte)) reply.append(singleByte)
if command == reply[0]: if command == reply[0]:
break break
else: else: