Commit 7aace7b6 authored by Paolo Baesso's avatar Paolo Baesso

Added i2c sintruction in the interface to send single commands to the i2c…

Added i2c sintruction in the interface to send single commands to the i2c display. In the future it can be changed to send instructions to other devices, if needed. Still work in progress.
parent 5abe4cd8
...@@ -96,7 +96,7 @@ zeClock.checkDesignID() ...@@ -96,7 +96,7 @@ zeClock.checkDesignID()
#zeClock.setPage(0, True) #zeClock.setPage(0, True)
#zeClock.getPage(True) #zeClock.getPage(True)
clkRegList= zeClock.parse_clk("./../../bitFiles/TLU_CLK_Config_v1e.txt") clkRegList= zeClock.parse_clk("./../../bitFiles/TLU_CLK_Config_v1e.txt")
#zeClock.writeConfiguration(clkRegList)###### zeClock.writeConfiguration(clkRegList)######
zeClock.writeRegister(0x0536, [0x0A]) #Configures manual switch of inputs zeClock.writeRegister(0x0536, [0x0A]) #Configures manual switch of inputs
zeClock.writeRegister(0x0949, [0x0F]) #Enable all inputs zeClock.writeRegister(0x0949, [0x0F]) #Enable all inputs
zeClock.writeRegister(0x052A, [0x05]) #Configures source of input zeClock.writeRegister(0x052A, [0x05]) #Configures source of input
......
...@@ -12,6 +12,7 @@ from I2CuHal import I2CCore ...@@ -12,6 +12,7 @@ from I2CuHal import I2CCore
from si5345 import si5345 # Library for clock chip from si5345 import si5345 # Library for clock chip
from AD5665R import AD5665R # Library for DAC from AD5665R import AD5665R # Library for DAC
from PCA9539PW import PCA9539PW # Library for serial line expander from PCA9539PW import PCA9539PW # Library for serial line expander
from I2CDISP import CFA632 #Library for display
class TLU: class TLU:
"""docstring for TLU""" """docstring for TLU"""
...@@ -100,7 +101,10 @@ class TLU: ...@@ -100,7 +101,10 @@ class TLU:
self.IC7.setInvertReg(1, 0x00)# 0= normal, 1= inverted self.IC7.setInvertReg(1, 0x00)# 0= normal, 1= inverted
self.IC7.setIOReg(1, 0x00)# 0= output, 1= input self.IC7.setIOReg(1, 0x00)# 0= output, 1= input
self.IC7.setOutputs(1, 0xB0)# If output, set to XX self.IC7.setOutputs(1, 0xB0)# If output, set to XX
#Display
self.DISP=CFA632(self.TLU_I2C, 0x2A) #
################################################################################################################################## ##################################################################################################################################
################################################################################################################################## ##################################################################################################################################
......
...@@ -59,6 +59,26 @@ class MyPrompt(cmd.Cmd): ...@@ -59,6 +59,26 @@ class MyPrompt(cmd.Cmd):
except IOError: except IOError:
print "\t Could not retrieve CONF data." print "\t Could not retrieve CONF data."
return return
def do_i2c(self, args):
#print "Twinkle"
#TLU.IC7.setOutputs(1, 0x30)
#time.sleep(0.5)
#TLU.IC7.setOutputs(1, 0xB0)
#time.sleep(0.5)
#TLU.IC7.setOutputs(1, 0x30)
#time.sleep(0.5)
#TLU.IC7.setOutputs(1, 0xB0)
#TLU.DISP.test()
arglist = args.split()
if len(arglist) == 0:
print "\tno command specified"
else:
i2ccmd= arglist[0]
results = list(map(int, arglist))
TLU.DISP.writeSomething(results)
print "Sending i2c command to display"
return
def do_id(self, args): def do_id(self, args):
"""Interrogates the TLU and prints it unique ID on screen""" """Interrogates the TLU and prints it unique ID on screen"""
......
# -*- coding: utf-8 -*-
import uhal
from I2CuHal import I2CCore
import StringIO
class CFA632:
#Class to configure the EEPROM
def __init__(self, i2c, slaveaddr=0x2A):
self.i2c = i2c
self.slaveaddr = slaveaddr
def test(self):
print "Testing the display"
return
def writeSomething(self, i2ccmd):
mystop= True
print "Write random stuff"
print i2ccmd
#myaddr= [int(i2ccmd)]
self.i2c.write( self.slaveaddr, i2ccmd, mystop)
return
# -*- coding: utf-8 -*-
import uhal
from I2CuHal import I2CCore
import StringIO
class NHDC0220Biz:
#Class to configure the EEPROM
def __init__(self, i2c, slaveaddr=0x3c):
self.i2c = i2c
self.slaveaddr = 0x2a#slaveaddr
def test(self):
print "Testing the display"
return
def writeSomething(self):
mystop= True
print "Write random stuff"
myaddr= [0x08, 0x38]
self.i2c.write( self.slaveaddr, myaddr, mystop)
return
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