當前位置: 首頁>>代碼示例>>Python>>正文


Python TestLib.toHex方法代碼示例

本文整理匯總了Python中TestLib.toHex方法的典型用法代碼示例。如果您正苦於以下問題:Python TestLib.toHex方法的具體用法?Python TestLib.toHex怎麽用?Python TestLib.toHex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TestLib的用法示例。


在下文中一共展示了TestLib.toHex方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: zeroes

# 需要導入模塊: import TestLib [as 別名]
# 或者: from TestLib import toHex [as 別名]
def zeroes(message):
    correct_value = '0x00000000'
    hex_message = t.toHex(message,0)
    print 'correct value: ', correct_value
    print 'int message: ', message
    print 'hex message: ', hex_message
    return passFail(hex_message==correct_value)
開發者ID:caleb-james-smith,項目名稱:old_ngccm,代碼行數:9,代碼來源:bridge_test.py

示例2: onesZeroes

# 需要導入模塊: import TestLib [as 別名]
# 或者: from TestLib import toHex [as 別名]
def onesZeroes(message):
    correct_value = '0xaaaaaaaa'
    hex_message = t.toHex(message,0)
    print 'correct value: '+str(correct_value)
    print 'int message: '+str(message)
    print 'hex message: '+str(hex_message)
    return passFail(hex_message==correct_value)
開發者ID:BaylorCMS,項目名稱:NGCCMeFEC,代碼行數:9,代碼來源:bridge_test.py

示例3: getSerial

# 需要導入模塊: import TestLib [as 別名]
# 或者: from TestLib import toHex [as 別名]
 def getSerial(self):
     if int(self.raw.split()[1]) != 0x70:
         print 'Not in Family 0x70'
         return 'Family_Code_Error'
     serial = t.serialNum(self.raw) # cereal
     oats = t.reverse(serial) # reversed
     eggs = t.toHex(oats) # hex
     return eggs
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:10,代碼來源:uniqueIDClass.py

示例4: qieDaisyChain0

# 需要導入模塊: import TestLib [as 別名]
# 或者: from TestLib import toHex [as 別名]
def qieDaisyChain0(message):
    hex_message = t.toHex(message,1)
    print 'int message: '+str(message)
    print 'hex message:'+str(hex_message)
    split_message = t.splitMessage(hex_message,6)
    for i in xrange(len(split_message)):
        print 'QIE '+str(i+1)+': '+str(split_message[i])
    return hex_message
開發者ID:BaylorCMS,項目名稱:NGCCMeFEC,代碼行數:10,代碼來源:bridge_test.py

示例5: qieDaisyChain0

# 需要導入模塊: import TestLib [as 別名]
# 或者: from TestLib import toHex [as 別名]
def qieDaisyChain0(message):
    hex_message = t.toHex(message,1)
    print 'int message: ', message
    print 'hex message:', hex_message
    split_message = t.splitMessage(hex_message,6)
    for i in xrange(len(split_message)):
        print 'QIE ',i+1,': ',split_message[i]
    return hex_message
開發者ID:caleb-james-smith,項目名稱:old_ngccm,代碼行數:10,代碼來源:bridge_test.py

示例6: getUniqueIDs

# 需要導入模塊: import TestLib [as 別名]
# 或者: from TestLib import toHex [as 別名]
def getUniqueIDs(rmList, slotList, verbose=0):
    print "Unique IDs"
    uniqueIDArray = []
    # Iterate through RM 0, 1, 2, 3 (include desired RMs in list)
    for rm in rmList:
        print '--- RM ',rm, ' ---'
        t.openRM(rm)
        idList = []
        # Iterate through Slot 0, 1, 2, 3 (run for all 4 slots by default)
        for slot in slotList[rm]:
            message = uniqueID(slot)
            # print checkCRC(message,7,10, verbose)
            final_message = t.serialNum(message)
            final_message = t.reverse(final_message)
            final_message = t.toHex(final_message)
            idList.append(message)
            print 'Slot ',slot,': ',message,'\t-> ',final_message
        uniqueIDArray.append(idList)
    return uniqueIDArray
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:21,代碼來源:uniqueID.py

示例7: bridgeTests

# 需要導入模塊: import TestLib [as 別名]
# 或者: from TestLib import toHex [as 別名]
def bridgeTests(slot, testList, verbosity=0):
    passed = 0
    failed = 0
    neither = 0
    num_tests = len(testList)
    print '## Number of Tests: ', num_tests
    for test in testList:
        print '\nNumber: ', test, ' ###'
        print 'Name: ', bridgeDict[test]['name']
        function = bridgeDict[test]['function']
        address = bridgeDict[test]['address']
        num_bytes = bridgeDict[test]['bits']/8
        message = readBridge(slot, address, num_bytes)
        # print '*** RAW MESSAGE :', t.reverseBytes(message)
        print 'hex message: ', t.toHex(message,1)

        # Check for i2c Error
        mList = message.split()
        error = mList.pop(0)
        if int(error) != 0:
            print '\[email protected]@@@@@ I2C ERROR : ',message,'\n'
        message = " ".join(mList)

        result = function(message)
        print 'RESULT = ',result
        if result == 'PASS':
            passed += 1
        elif result == 'FAIL':
            failed += 1
        else:
            print 'Neither PASS Nor FAIL'
            neither += 1
        if verbosity:
            print 'Register Name: ', bridgeDict[test]['name']
            print 'Register Value: ', message
            print 'Test Result: ', result

    test_list = [passed, failed, neither]
    return test_list
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:41,代碼來源:bridge_test.py

示例8: checkCRC

# 需要導入模塊: import TestLib [as 別名]
# 或者: from TestLib import toHex [as 別名]
def checkCRC(message, numBytes, base=10, verbose=0):
    POLYNOMIAL = 0x131 # x^8 + x^5 + x^4 + 1 -> 9'b100110001 = 0x131
    crc = 0
    mList = toIntList(message, base)
    errorCode = mList[0]
    dataList = mList[1:-1]
    checksum = mList[-1]
    if verbose > 2:
        print 'hex = ',t.toHex(message)
        print 'data = ',dataList
        print 'checksum = ',checksum
    if errorCode != 0:
        return 'I2C_BUS_ERROR'
    # calculates 8-bit checksum with give polynomial
    for byteCtr in xrange(numBytes):
        crc ^= dataList[byteCtr]
        # crc &= 0xFF
        if verbose > 1:
            print "CRC = ",crc
        for bit in xrange(8,0,-1):
            if crc & 0x80: # True if crc >= 128, False if crc < 128
                crc = (crc << 1) ^ POLYNOMIAL
                # crc &= 0xFF
                if verbose > 1:
                    print 'true crc = ',crc
            else: # crc < 128
                crc = (crc << 1)
                # crc &= 0xFF
                if verbose > 1:
                    print 'false crc = ',crc
    if verbose > 0:
        print 'CRC = ',crc
        print 'checksum = ',checksum
    if crc != checksum:
        return 'CHECKSUM_ERROR'
    return 'CHECKSUM_OK'
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:38,代碼來源:caleb_checksum.py

示例9: simplePrint

# 需要導入模塊: import TestLib [as 別名]
# 或者: from TestLib import toHex [as 別名]
def simplePrint(message):
    hex_message = t.toHex(message,1)
    print 'int message: ', message
    print 'hex message:', hex_message
    return hex_message
開發者ID:caleb-james-smith,項目名稱:old_ngccm,代碼行數:7,代碼來源:TestLib.py

示例10: fwVersion

# 需要導入模塊: import TestLib [as 別名]
# 或者: from TestLib import toHex [as 別名]
def fwVersion(message):
    # correct_value = "N/A" # We need to find Firmware Version
    message = t.toHex(message)
    # print 'correct value: '+str(correct_value)
    print 'hex message: '+str(message)
    return message
開發者ID:BaylorCMS,項目名稱:NGCCMeFEC,代碼行數:8,代碼來源:bridge_test.py

示例11: simplePrint

# 需要導入模塊: import TestLib [as 別名]
# 或者: from TestLib import toHex [as 別名]
def simplePrint(message):
    hex_message = t.toHex(message,1)
    print 'int message: '+str(message)
    print 'hex message:'+str(hex_message)
    return hex_message
開發者ID:BaylorCMS,項目名稱:NGCCMeFEC,代碼行數:7,代碼來源:bridge_test.py

示例12: simplePrint

# 需要導入模塊: import TestLib [as 別名]
# 或者: from TestLib import toHex [as 別名]
def simplePrint(message):
    hex_message = t.toHex(message,1)
    return hex_message
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:5,代碼來源:bridge_test.py

示例13: qieDaisyChain1

# 需要導入模塊: import TestLib [as 別名]
# 或者: from TestLib import toHex [as 別名]
def qieDaisyChain1(message):
    hex_message = t.toHex(message,1)
    split_message = t.splitMessage(hex_message,6)
    for i in xrange(len(split_message)):
        print 'QIE ',i+7,': ',split_message[i]
    return hex_message
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:8,代碼來源:bridge_test.py

示例14: onesZeroes

# 需要導入模塊: import TestLib [as 別名]
# 或者: from TestLib import toHex [as 別名]
def onesZeroes(message):
    correct_value = '0xaaaaaaaa'
    hex_message = t.toHex(message,0)
    return passFail(hex_message==correct_value)
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:6,代碼來源:bridge_test.py

示例15: zeroes

# 需要導入模塊: import TestLib [as 別名]
# 或者: from TestLib import toHex [as 別名]
def zeroes(message):
    correct_value = '0x00000000'
    hex_message = t.toHex(message,0)
    return passFail(hex_message==correct_value)
開發者ID:caleb-james-smith,項目名稱:QIETesting,代碼行數:6,代碼來源:bridge_test.py


注:本文中的TestLib.toHex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。