Skip to content
Snippets Groups Projects
Select Git revision
  • 28fb67fbdcb2843e3033f51bcae291ac1ff2ac1b
  • master default protected
  • revert-cs032-ccd-ip
  • deploy-components-parallel
  • fix-chrony-exporter
  • L2SS-2407-swap-iers-caltable-monitoring-port
  • L2SS-2357-fix-ruff
  • sync-up-with-meta-pypcc
  • stabilise-landing-page
  • all-stations-lofar2
  • 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
  • v0.55.5-r2 protected
  • v0.52.8-rc1 protected
  • v0.55.5 protected
  • v0.55.4 protected
  • 0.55.2.dev0
  • 0.55.1.dev0
  • 0.55.0.dev0
  • v0.54.0 protected
  • 0.53.2.dev0
  • 0.53.1.dev0
  • v0.52.3-r2 protected
  • remove-snmp-client
  • 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
41 results

Docker_notebook.ipynb

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    i2c_switch2.py 1.40 KiB
    #3 switches of UNB2
    import logging
    from .i2c_smbus import i2c_smbus as i2c
    
    class i2c_switch2(i2c):
        def __init__(self,config):
            i2c.__init__(self,config)
            self.SWaddr1=config['devreg'][0]['addr']
            self.SWaddr2=config['devreg'][1]['addr']
            self.SWaddr3=config['devreg'][2]['addr']
            self.channel1=-1
            self.channel2=-1
            self.channel3=-1
            logging.info("i2c switch2 at address %i,%i,%i" % (self.SWaddr1,self.SWaddr2,self.SWaddr3))
            logging.warn("APSCT switch disabled for testing")
    
        def SetSW1(self,channelbit):
            channel=1<<(channelbit)
            if (channel)==self.channel1: return True;
            logging.debug("SetChannel1=%i" % channelbit)
            self.channel1=channel
            self.channel2=-1
            self.channel3=-1
            return True; #testing without APSCT switch
    #        return self.i2csetget(self.SWaddr1,[channel])
    
        def SetSW2(self,channelbit):
            channel=1<<(channelbit)
            if (channel)==self.channel2: return True;
            logging.debug("SetChannel2=%i" % channelbit)
            self.channel2=channel
            self.channel3=-1
            return self.i2csetget(self.SWaddr2,[channel])
    
        def SetSW3(self,channelbit):
            channel=1<<(channelbit)
            if (channel)==self.channel3: return True;
            logging.debug("SetChannel3=%i" % channelbit)
            self.channel3=channel
            return self.i2csetget(self.SWaddr3,[channel])