platypush/plugins/gpio/zeroborg/lib/__init__.py
def Init(self, tryOtherBus=False):
        """
Init([tryOtherBus])

Prepare the I2C driver for talking to the ZeroBorg

If tryOtherBus is True, this function will attempt to use the other bus if the ThunderBorg devices can not be found on
the current busNumber.

    This is only really useful for early Raspberry Pi models!
        """
        self.Print('Loading ZeroBorg on bus %d, address %02X' % (self.busNumber, self.i2cAddress))

        # Open the bus
        self.i2cRead = io.open("/dev/i2c-" + str(self.busNumber), "rb", buffering=0)
        fcntl.ioctl(self.i2cRead, I2C_SLAVE, self.i2cAddress)
        self.i2cWrite = io.open("/dev/i2c-" + str(self.busNumber), "wb", buffering=0)
        fcntl.ioctl(self.i2cWrite, I2C_SLAVE, self.i2cAddress)

        # Check for ZeroBorg
        # noinspection PyBroadException
        try:
            i2cRecv = self.RawRead(COMMAND_GET_ID, I2C_NORM_LEN)
            if len(i2cRecv) == I2C_NORM_LEN:
                if i2cRecv[1] == I2C_ID_ZEROBORG:
                    self.foundChip = True
                    self.Print('Found ZeroBorg at %02X' % self.i2cAddress)
                else:
                    self.foundChip = False
                    self.Print('Found a device at %02X, but it is not a ZeroBorg (ID %02X instead of %02X)' % (
                        self.i2cAddress, i2cRecv[1], I2C_ID_ZEROBORG))
            else:
                self.foundChip = False
                self.Print('Missing ZeroBorg at %02X' % self.i2cAddress)
        except KeyboardInterrupt:
            raise
        except Exception as e:
            self.foundChip = False
            self.Print('Missing ZeroBorg at %02X: %s' % (self.i2cAddress, str(e)))

        # See if we are missing chips
        if not self.foundChip:
            self.Print('ZeroBorg was not found')
            if tryOtherBus:
                if self.busNumber == 1:
                    self.busNumber = 0
                else:
                    self.busNumber = 1
                self.Print('Trying bus %d instead' % self.busNumber)
                self.Init(False)
            else:
                self.Print(
                    'Are you sure your ZeroBorg is properly attached, the correct address is used, and the I2C ' +
                    'drivers are running?')
                self.bus = None
        else:
            self.Print('ZeroBorg loaded on bus %d' % self.busNumber)

Init([tryOtherBus])

Prepare the I2C driver for talking to the ZeroBorg

If tryOtherBus is True, this function will attempt to use the other bus if the ThunderBorg devices can not be found on
the current busNumber.

    This is only really useful for early Raspberry Pi models!
        
Init([tryOtherBus])
Prepare the I2C driver for talking to the ZeroBorg

If tryOtherBus is True, this function will attempt to use the other bus if the ThunderBorg devices can not be found on
the current busNumber.

This is only really useful for early Raspberry Pi models!
Init ( [ tryOtherBus ] ) Prepare the I2C driver for talking to the ZeroBorg If tryOtherBus is True this function will attempt to use the other bus if the ThunderBorg devices can not be found on the current busNumber . This is only really useful for early Raspberry Pi models!
def Init(self, tryOtherBus=False):
        self.Print('Loading ZeroBorg on bus %d, address %02X' % (self.busNumber, self.i2cAddress))
        self.i2cRead = io.open("/dev/i2c-" + str(self.busNumber), "rb", buffering=0)
        fcntl.ioctl(self.i2cRead, I2C_SLAVE, self.i2cAddress)
        self.i2cWrite = io.open("/dev/i2c-" + str(self.busNumber), "wb", buffering=0)
        fcntl.ioctl(self.i2cWrite, I2C_SLAVE, self.i2cAddress)
        try:
            i2cRecv = self.RawRead(COMMAND_GET_ID, I2C_NORM_LEN)
            if len(i2cRecv) == I2C_NORM_LEN:
                if i2cRecv[1] == I2C_ID_ZEROBORG:
                    self.foundChip = True
                    self.Print('Found ZeroBorg at %02X' % self.i2cAddress)
                else:
                    self.foundChip = False
                    self.Print('Found a device at %02X, but it is not a ZeroBorg (ID %02X instead of %02X)' % (
                        self.i2cAddress, i2cRecv[1], I2C_ID_ZEROBORG))
            else:
                self.foundChip = False
                self.Print('Missing ZeroBorg at %02X' % self.i2cAddress)
        except KeyboardInterrupt:
            raise
        except Exception as e:
            self.foundChip = False
            self.Print('Missing ZeroBorg at %02X: %s' % (self.i2cAddress, str(e)))
        if not self.foundChip:
            self.Print('ZeroBorg was not found')
            if tryOtherBus:
                if self.busNumber == 1:
                    self.busNumber = 0
                else:
                    self.busNumber = 1
                self.Print('Trying bus %d instead' % self.busNumber)
                self.Init(False)
            else:
                self.Print(
                    'Are you sure your ZeroBorg is properly attached, the correct address is used, and the I2C ' +
                    'drivers are running?')
                self.bus = None
        else:
            self.Print('ZeroBorg loaded on bus %d' % self.busNumber)
def Init ( self , tryOtherBus = False ) : self . Print ( 'Loading ZeroBorg on bus %d, address %02X' % ( self . busNumber , self . i2cAddress ) ) self . i2cRead = io . open ( "/dev/i2c-" + str ( self . busNumber ) , "rb" , buffering = 0 ) fcntl . ioctl ( self . i2cRead , I2C_SLAVE , self . i2cAddress ) self . i2cWrite = io . open ( "/dev/i2c-" + str ( self . busNumber ) , "wb" , buffering = 0 ) fcntl . ioctl ( self . i2cWrite , I2C_SLAVE , self . i2cAddress ) try : i2cRecv = self . RawRead ( COMMAND_GET_ID , I2C_NORM_LEN ) if len ( i2cRecv ) == I2C_NORM_LEN : if i2cRecv [ 1 ] == I2C_ID_ZEROBORG : self . foundChip = True self . Print ( 'Found ZeroBorg at %02X' % self . i2cAddress ) else : self . foundChip = False self . Print ( 'Found a device at %02X, but it is not a ZeroBorg (ID %02X instead of %02X)' % ( self . i2cAddress , i2cRecv [ 1 ] , I2C_ID_ZEROBORG ) ) else : self . foundChip = False self . Print ( 'Missing ZeroBorg at %02X' % self . i2cAddress ) except KeyboardInterrupt : raise except Exception as e : self . foundChip = False self . Print ( 'Missing ZeroBorg at %02X: %s' % ( self . i2cAddress , str ( e ) ) ) if not self . foundChip : self . Print ( 'ZeroBorg was not found' ) if tryOtherBus : if self . busNumber == 1 : self . busNumber = 0 else : self . busNumber = 1 self . Print ( 'Trying bus %d instead' % self . busNumber ) self . Init ( False ) else : self . Print ( 'Are you sure your ZeroBorg is properly attached, the correct address is used, and the I2C ' + 'drivers are running?' ) self . bus = None else : self . Print ( 'ZeroBorg loaded on bus %d' % self . busNumber )
Init([tryOtherBus])
Prepare the I2C driver for talking to the ZeroBorg
Init ( [ tryOtherBus ] ) Prepare the I2C driver for talking to the ZeroBorg
"""
Init([tryOtherBus])

Prepare the I2C driver for talking to the ZeroBorg

If tryOtherBus is True, this function will attempt to use the other bus if the ThunderBorg devices can not be found on
the current busNumber.

    This is only really useful for early Raspberry Pi models!
        """ # Open the bus # Check for ZeroBorg # noinspection PyBroadException # See if we are missing chips
self
tryOtherBus