Commit b1c71ceb authored by Paolo Baesso's avatar Paolo Baesso

Added debug to I2CuHal2 to indicate when a slave fails to ACKNOWLEDGE (useful to…

Added debug to I2CuHal2 to indicate when a slave fails to ACKNOWLEDGE (useful to see if a device is responding at all). Also started to expande the functions available for the LCD09052 display.
parent 11b74324
# -*- coding: utf-8 -*-
import uhal
from I2CuHal import I2CCore
from I2CuHal2 import I2CCore
import StringIO
class CFA632:
......@@ -16,8 +16,8 @@ class CFA632:
def writeSomething(self, i2ccmd):
mystop= True
print "Write random stuff"
print i2ccmd
print "Write to CFA632"
print "\t", i2ccmd
#myaddr= [int(i2ccmd)]
self.i2c.write( self.slaveaddr, i2ccmd, mystop)
return
......@@ -32,11 +32,22 @@ class LCD09052:
def test(self):
print "Testing the display"
return
def setBrightness(self, value= 250):
if value < 0:
print "setBrightness: minimum value= 0. Coherced to 0"
value = 0
if value > 250:
print "setBrightness: maximum value= 250. Coherced to 250"
value = 250
i2ccmd= [7, value]
mystop= True
self.i2c.write( self.slaveaddr, i2ccmd, mystop)
def writeSomething(self, i2ccmd):
mystop= True
print "Write random stuff"
print i2ccmd
print "Write to LCD09052"
print "\t", i2ccmd
#myaddr= [int(i2ccmd)]
self.i2c.write( self.slaveaddr, i2ccmd, mystop)
return
......
......@@ -130,6 +130,7 @@ class I2CCore:
if not ack:
self.cmd_stat.write(I2CCore.stopcmd)
self.target.dispatch()
print "no ack from I2C address", hex(addr>>1)
return nwritten
nwritten += 1
for val in data:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment