Skip to content
Snippets Groups Projects
Select Git revision
  • L2SS-1173-add-attributes-in-ec2
  • master default protected
  • control-single-hba-and-lba
  • L2SS-1957-remove-pcon-control
  • stabilise-landing-page
  • all-stations-lofar2
  • L2SS-2357-fix-ruff
  • v0.39.7-backports
  • Move-sdptr-to-v1.5.0
  • fix-build-ubuntu
  • tokens-in-env-files
  • fix-build
  • L2SS-2214-deploy-cdb
  • fix-missing-init
  • add-power-hardware-apply
  • L2SS-2129-Add-Subrack-Routine
  • Also-listen-internal-to-rpc
  • fix-build-dind
  • L2SS-2153--Improve-Error-Handling
  • L2SS-2153-Add-Grpc-Gateway-support
  • L2SS-1970-apsct-lol
  • v0.52.3 protected
  • v0.52.3dev0 protected
  • 0.53.1dev0
  • v0.52.2-rc3 protected
  • v0.52.2-rc2 protected
  • v0.52.2-rc1 protected
  • v0.52.1.1 protected
  • v0.52.1 protected
  • v0.52.1-rc1 protected
  • v0.51.9-6 protected
  • v0.51.9-5 protected
  • v0.51.9-4 protected
  • v0.51.9-3 protected
  • v0.51.9-2 protected
  • v0.51.9-1 protected
  • v0.51.9 protected
  • v0.51.8 protected
  • v0.39.15-wsrttwo protected
  • v0.39.15-wsrt protected
  • v0.39.14-wsrt protected
41 results

Dockerfile

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    i2cdirect.py 1.79 KiB
    name='RECVTR_LB_TEST' #YAML config file with all register values etc
    
    import logging
    #import argparse
    from pypcc.opcuaserv import opcuaserv
    from pypcc.opcuaserv import i2client
    from pypcc.opcuaserv import yamlreader
    #from opcuaserv import pypcc2
    from pypcc.i2cserv import i2cthread
    #import threading
    import time
    import sys
    import signal
    from pypcc.yamlconfig import Find;
    import pypcc.yamlconfig as yc
    from datetime import datetime
    from pypcc.opcuaserv.yamlreader import byte2var,var2byte
    
    class i2cdirect():
        def __init__(self,name):
            self.conf=yc.yamlconfig(name)
            self.conf.linkdevices()
            self.conf.loaddrivers()
            self.conf.linkdrivers()
    
        def GetVal(self,name,N=1):
            varid=self.conf.getvarid(name);
            if varid is None:
                logging.error("Variable "+name+" not found")
                return None,None
            var1=self.conf.getvars()[varid]
            drv=var1.get('drivercls');
            data=drv.OPCUAReadVariable(varid,var1,[])
            data=data[0].data
            return byte2var(var1,data),var1
    
        def SetVal(self,name,data):
            varid=self.conf.getvarid(name);
            if varid is None:
                logging.error("Variable "+name+" not found")
                return None
            var1=self.conf.getvars()[varid]
            drv=var1.get('drivercls');        
            data2=var2byte(var1,data)
            return drv.OPCUASetVariable(varid,var1,data2,[])
    
        def SetRegister(self,regname,value):
            methodid=self.conf.getmethodid("RECVTR_Init");
            var1=self.conf.getmethod(methodid)
            drv=var1.get('drivercls');
            v1=self.conf.getdevreg(regname)
            drv2=v1.get('drivercls')
            mask=[]
            if drv:  drv.Setdevreg(v1,value,mask)
            elif drv2: drv2.Setdevreg(v1,value,mask)
            else: logging.warn("Driver not specified for instruction"+key)