Skip to content
Snippets Groups Projects
Commit 3f623182 authored by Paulus Kruger's avatar Paulus Kruger
Browse files

Clean up

parent 6ed3a9c2
No related branches found
No related tags found
No related merge requests found
...@@ -55,20 +55,17 @@ Variables: ...@@ -55,20 +55,17 @@ Variables:
# var_bitoffset: 5 # var_bitoffset: 5
# var_R/W: RO # var_R/W: RO
# - var_name: CONF - var_name: CONF
# var_dev: IO3.CONF1 var_dev: IO3.CONF1
# var_width: 8 var_width: 8
# var_R/W: RO
# - var_name: OUT - var_name: OUT
# var_dev: IO3.OUT1 var_dev: IO3.OUT1
# var_width: 8 var_width: 8
# var_R/W: RO
# - var_name: IN - var_name: IN
# var_dev: IO3.IN1 var_dev: IO3.IN1
# var_width: 8 var_width: 8
# var_R/W: RO
Methods: Methods:
......
...@@ -5,28 +5,6 @@ I2C_devices: ...@@ -5,28 +5,6 @@ I2C_devices:
dev_registers: dev_registers:
- reg_name: a0 - reg_name: a0
reg_addr: 0x00 reg_addr: 0x00
- reg_name: a3
reg_addr: 0x03
- reg_name: a5
reg_addr: 0x05
- reg_name: a6
reg_addr: 0x06
- reg_name: a7
reg_addr: 0x07
- reg_name: a8
reg_addr: 0x08
- reg_name: a9
reg_addr: 0x09
- reg_name: aA
reg_addr: 0x0A
- reg_name: aD
reg_addr: 0x0D
- reg_name: aF
reg_addr: 0x0F
- reg_name: a11
reg_addr: 0x11
- reg_name: a13
reg_addr: 0x13
Variables: Variables:
- var_name: locked - var_name: locked
...@@ -38,28 +16,28 @@ Methods: ...@@ -38,28 +16,28 @@ Methods:
- method_name: Power_off - method_name: Power_off
method_invisible: 1 method_invisible: 1
registers: registers:
- PLL1.a3: [0x88] - PLL1.3: [0x88]
- method_name: Power_on - method_name: Power_on
method_invisible: 1 method_invisible: 1
registers: registers:
- PLL1.a3: [0x08] - PLL1.3: [0x08]
- method_name: Reset - method_name: Reset
method_invisible: 1 method_invisible: 1
registers: registers:
- PLL1.a3: [0x0C] - PLL1.3: [0x0C]
- method_name: Setup - method_name: Setup
method_invisible: 1 method_invisible: 1
registers: registers:
- PLL1.a3: [0x08] - PLL1.3: [0x08]
- PLL1.a5: [0x97] - PLL1.5: [0x97]
- PLL1.a6: [0x10] - PLL1.6: [0x10]
- PLL1.a7: [0x04] - PLL1.7: [0x04]
- PLL1.a8: [0x01] - PLL1.8: [0x01]
- PLL1.a7: [0x00] - PLL1.7: [0x00]
- PLL1.a9: [0x10] - PLL1.9: [0x10]
- PLL1.aA: [0x14] - PLL1.10: [0x14] #0x0A
- PLL1.a9: [0x00] - PLL1.9: [0x00]
- PLL1.aD: [0x01] #02? - PLL1.13: [0x01] #0x0D
- PLL1.aF: [0x01] - PLL1.15: [0x01] #0x0F
- PLL1.a11: [0x01] - PLL1.17: [0x01] #0x11
- PLL1.a13: [0x01] - PLL1.19: [0x01] #0x13
dev_name: PCC_I2C dev_name: PCC_I2C
dev_children: dev_children:
# - child_name: Switch1
- child_dev : I2Cswitch - child_dev : I2Cswitch
child_conf: LTS_switch child_conf: LTS_switch
child_addr: 1 child_addr: 1 #I2C port on raspberry pi
\ No newline at end of file \ No newline at end of file
dev_name: Switch1 dev_name: Switch1
dev_address: 0x70 #A0,1,2=0 dev_address: 0x70
#dev_device: TCA9548 dev_device: TCA9548
# LTS midplane: I2C 0-5 = RCU 0-5, I2C 6 = UNB2_N0, I2C 7 = UNB2 # LTS midplane: I2C 0-5 = RCU 0-5, I2C 6 = UNB2_N0, I2C 7 = UNB2
# Todo: change RCU-5 to Clock board
dev_children: dev_children:
- child_name: RCU01 - child_name: RCU01
child_dev: I2Cdevices child_dev: I2Cdevices
......
...@@ -3,3 +3,12 @@ ...@@ -3,3 +3,12 @@
Python OPC-UA server to control the I2C devices in the LTS. Python OPC-UA server to control the I2C devices in the LTS.
+ opcuserv.py: OPC-UA server that expose (visible) variables and methods. + opcuserv.py: OPC-UA server that expose (visible) variables and methods.
LTS structure:
> Raspberry pi (LTS_pypcc.yaml -> I2C controller on raspberry pi)
>> Control PCB (LTS_switch.yaml -> I2C switch)
>>> RCU2 PCB (LTS_RCUx.yaml -> I2C devices)
>>>> RCU2 Dither source (LTS_RCU2_dither.yaml -> I2C bitbang)
>>>> ADC (LTS_RCU2_ADC.yaml -> SPI bitbang2)
>>> Clock PCB (LTS_clk.yaml I2C device)
>>>> PLL (LTS_clkPLL.yaml -> SPI bitbang1)
...@@ -5,7 +5,7 @@ class SPIbitbang2(I2Cdevices): ...@@ -5,7 +5,7 @@ class SPIbitbang2(I2Cdevices):
def I2CSet(self,dev,reg,value,I2Ccallback,width=8,bitoffset=0): def I2CSet(self,dev,reg,value,I2Ccallback,width=8,bitoffset=0):
SPI=Find(self.D['I2C_devices'],'dev_name',dev) SPI=Find(self.D['I2C_devices'],'dev_name',dev)
Reg=Find(SPI['dev_registers'],'reg_name',reg) Reg=Find(SPI['dev_registers'],'reg_name',reg)
reg_address=Reg['reg_addr'] reg_address=(Reg['reg_addr'] if Reg else int(reg))
SetBit=I2Ccallback SetBit=I2Ccallback
# dev_rw = 0x00 # 0 for write, 1 for read # dev_rw = 0x00 # 0 for write, 1 for read
...@@ -27,7 +27,7 @@ class SPIbitbang2(I2Cdevices): ...@@ -27,7 +27,7 @@ class SPIbitbang2(I2Cdevices):
SPI=Find(self.D['I2C_devices'],'dev_name',dev) SPI=Find(self.D['I2C_devices'],'dev_name',dev)
Reg=Find(SPI['dev_registers'],'reg_name',reg) Reg=Find(SPI['dev_registers'],'reg_name',reg)
reg_address=Reg['reg_addr'] reg_address=(Reg['reg_addr'] if Reg else int(reg))
# print(ADC_reg_address,CS,SDIOdir,SDI,SDO,CLK) # print(ADC_reg_address,CS,SDIOdir,SDI,SDO,CLK)
SetBit=I2Ccallback SetBit=I2Ccallback
ADC_bytes = 0x00 ADC_bytes = 0x00
......
import pypcc; #import pypcc;
import pypcc_test as pypcc;
P1=pypcc.pypcc("LTS_pypcc.yaml") P1=pypcc.pypcc("LTS_pypcc.yaml")
......
import pypcc; #import pypcc;
import pypcc_test as pypcc;
P1=pypcc.pypcc("LTS_pypcc.yaml") P1=pypcc.pypcc("LTS_pypcc.yaml")
...@@ -34,92 +35,6 @@ if True: ...@@ -34,92 +35,6 @@ if True:
Getvalue("OUT") Getvalue("OUT")
Getvalue("IN") Getvalue("IN")
Getvalue("PLL_locked") Getvalue("PLL_locked")
# P1.CallMethod("CLK_PLL_Setup",None)
exit() Getvalue("PLL_locked")
if False:
P1.CallMethod("RCU01_Init_ADCR",None)
Getvalue("ADC_lock1")
if False:
Setvalue("Band1",1)
Setvalue("Band2",0)
Setvalue("Band3",1)
Getvalue("Band1")
Getvalue("Band2")
Getvalue("Band3")
#exit()
if False:
# Setvalue("Dth3_Pwr",0)
# Setvalue("Dth2_Pwr",0)
# Setvalue("Dth3_Pwr",1)
# Setvalue("Dth2_Pwr",1)
P1.CallMethod("RCU01_Dither1_Setup",None)
P1.CallMethod("RCU01_Dither2_Setup",None)
P1.CallMethod("RCU01_Dither3_Setup",None)
# a=[0,0,0,0]
# P1.GetVarValue("RCU01_Dth1_FREQ",a)
# print("GET:",a[0])
# Getvalue("Dither1_Frequency")
Setvalue("Dither1_Frequency",101.0)
Setvalue("Dither2_Frequency",101.2)
Getvalue("Dither1_Frequency")
Getvalue("Dither2_Frequency")
# Getvalue("Dth1_FREQ")
if False:
# a=[0,0,0]
# P1.GetVarValue("RCU01_V_x",a)
# print("GET:",a[0])
# import time
# time.sleep(0.2)
# Setvalue("V_x",0xC0)
# time.sleep(0.2)
# a=[0,0,0]
# P1.GetVarValue("RCU01_Temp",a)
# print("GET:",a[0])
Getvalue("Temp")
#exit()
if False:
P1.CallMethod("RCU01_ADC1_Switch_on",None)
Getvalue("ADC1_locked")
Getvalue("ADC2_locked")
Getvalue("ADC3_locked")
#Getvalue("ADC_lock3")
#Getvalue("ADC_lock1")
#Setvalue("LED0",1)
#Getvalue("LED0")
#Setvalue("Band2",1)
#Getvalue("Band2")
#Getvalue("LED0")
exit()
#Setvalue("Dth3_Pwr",1)
Setvalue("Dth2_Pwr",0)
Setvalue("Dth2_SDA",0)
Setvalue("Dth2_SCL",0)
Setvalue("Dth3_Pwr",0)
Setvalue("Dth3_SDA",0)
Setvalue("Dth3_SCL",0)
Setvalue("LED0",2)
Setvalue("Att1",10)
Setvalue("Att2",10)
Setvalue("Att3",10)
#Setvalue("Dth3_Pwr",1)
#Setvalue("Dth2_SCL",1)
#assert(a[0]==1)
#print(P1.SetVarValue("RCU01_Band1",3))
#print(P1.SetVarValue("RCU02_Band1",0))
#print(P1.GetVarValue("RCU01_Band1",a))
#print(a[0])
#assert(a[0]==3)
#print(P1.GetVarValue("RCU02_Band1",a))
#assert(a[0]==0)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment