Skip to content
Snippets Groups Projects
Select Git revision
  • 07ebc1f4ed24d452f4675a4165a6ab6224b81a20
  • MCCS-163 default
  • main
  • sar-277-update-docs-with-examples-for-lrc
  • st-946-automate
  • sar_302-log-fix
  • sar-287_subarray_commands_to_lrc
  • sar_302-POC_await_sub_device_state
  • sat_302_fix_pipelines
  • sar-286_lrc_one_subarry_command
  • sar-286_lrc_improvements
  • sar-288-async-controller
  • sar-276-combine-tango-queue
  • sar-255_remove_nexus_reference
  • sar-275-add-LRC
  • sar-273-add-lrc-attributes
  • sar-272
  • sp-1106-marvin-1230525148-ska-tango-base
  • sp-1106-marvin-813091765-ska-tango-base
  • sar-255/Publish-package-to-CAR
  • mccs-661-device-under-test-fixture
  • mccs-659-pep257-docstring-linting
  • 0.11.3
  • 0.11.2
  • 0.11.1
  • 0.11.0
  • 0.10.1
  • 0.10.0
  • 0.9.1
  • 0.9.0
  • 0.8.1
  • 0.8.0
  • 0.7.2
  • 0.7.1
  • 0.7.0
  • 0.6.6
  • 0.6.5
  • 0.6.4
  • 0.6.3
  • 0.6.2
  • 0.6.1
  • 0.6.0
42 results

reference_component_manager.rst

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])