regwr accepts tuples properly. Fix EDS.LED for Python 2

This commit is contained in:
James Bowman 2019-03-03 11:28:13 -08:00
parent 895f5a3941
commit 652fdd41d4
2 changed files with 4 additions and 6 deletions

View File

@ -46,12 +46,10 @@ class LED:
"""
if t == 0:
self.i2.start(self.a, 0)
self.i2.write(bytes((0, r, g, b)))
self.i2.stop()
self.i2.regwr(self.a, 0, r, g, b)
else:
self.i2.start(self.a, 0)
self.i2.write(bytes((1, r, g, b, t)))
self.i2.stop()
self.i2.regwr(self.a, 1, r, g, b, t)
def hex(self, hhh, t = 0):
"""

View File

@ -76,12 +76,12 @@ class I2CDriver:
if PYTHON2:
def __ser_w(self, s):
if isinstance(s, list):
if isinstance(s, list) or isinstance(s, tuple):
s = "".join([chr(c) for c in s])
self.ser.write(s)
else:
def __ser_w(self, s):
if isinstance(s, list):
if isinstance(s, list) or isinstance(s, tuple):
s = bytes(s)
self.ser.write(s)