original_docstring: Reads an unsigned 16-bit value from the I2C device
docstring: Reads an unsigned 16-bit value from the I2C device
docstring_tokens: Reads an unsigned 16 - bit value from the I2C device
code: def readU16(self, reg, little_endian=True):
      "Reads an unsigned 16-bit value from the I2C device"
      try:
        result = self.bus.read_word_data(self.address,reg)
        # Swap bytes if using big endian because read_word_data assumes little
        # endian on ARM (little endian) systems.
        if not little_endian:
          result = ((result << 8) & 0xFF00) + (result >> 8)
        if (self.debug):
          print "I2C: Device 0x%02X returned 0x%04X from reg 0x%02X" % (self.address, result & 0xFFFF, reg)
        return result
      except IOError, err:
        return self.errMsg()
code_tokens: def readU16 ( self , reg , little_endian = True ) : try : result = self . bus . read_word_data ( self . address , reg ) if not little_endian : result = ( ( result << 8 ) & 0xFF00 ) + ( result >> 8 ) if ( self . debug ) : print "I2C: Device 0x%02X returned 0x%04X from reg 0x%02X" % ( self . address , result & 0xFFFF , reg ) return result except IOError , err : return self . errMsg ( )
short_docstring: Reads an unsigned 16-bit value from the I2C device
short_docstring_tokens: Reads an unsigned 16 - bit value from the I2C device
comment: "Reads an unsigned 16-bit value from the I2C device"$SEP$# Swap bytes if using big endian because read_word_data assumes little$SEP$# endian on ARM (little endian) systems.