Esempio n. 1
0
def tt4I(): 
    if len(sys.argv)>3:
        print 'Wring argument number'
        
    tt4.TT4Init()
    [xNum,yNum]=tt4.tt4GetSysInf()
    tPre=time.time()
    tt4.tt4SusScan()
    tNow=time.time()
    tDiff=(tNow-tPre)*1000
    print 'Suspend scan execute time:{0}' .format(tDiff)
    tPre=tNow
    
    try:    
        while True:
            print 'measure suspend current'
            time.sleep(2)
            
    except KeyboardInterrupt:
        tNow=time.time()
        tDiff=(tNow-tPre)*1000
        print 'Measure time :{0}' .format(tDiff)
        tt4.ldoPowerOff()               
        GPIO.cleanup()
Esempio n. 2
0
def tt4Sy(): 
    if len(sys.argv)<3 or len(sys.argv)>4:
        print 'wrong number of argument number'
        sys.exit()       
    elif len(sys.argv)==3 and sys.argv[2].startswith('--'):
        susTime=int(sys.argv[2][2:])
        fprint=0
        print 'suspend waiting time={0} sec' .format(susTime)        
    elif len(sys.argv)==4 and sys.argv[3].startswith('--'):
        susTime=int(sys.argv[2][2:]) # in sec
        filename=sys.argv[3][2:] 
        print filename
        fo = open(filename, "w")
        fprint=1
        print 'suspend waiting time={0} sec' .format(susTime)
    else:
        print 'wrong argument inputed'
        sys.exit()
       
    tt4.TT4Init()
    count=0
    tPalmon=0
    tInit=time.time()
    tPre=tInit
    print 'please put you palm on the screen.'
    print 'Please swipe the palm till suspend show finish'
    try:
        while True:
            if GPIO.input(bInt)==0 and tPalmon<=5000:
                #print 'time:%s INT Low'%time.time()
                count=count+1
                tNow=time.time()
                diff=(tNow-tPre)*1000
                tPalmon=(tNow-tInit)*1000
                tPre=tNow
                data1=tt4.readFgData(TT4Addr,3,10)
                a,b=tt4.TT4resolve(data1)
                count1=0
                #print a[0][4],a[0][3]
                if a[0][4]==0:
                    if a[0][3]==1:
                        print 'LO:{0}, large Object Detected' .format(a[0][3])
                        if fprint==1:
                            fo.write('RID:{0},TDF:{1},LO:{2},NE:{3},LargeObj\n'\
                            .format(a[0][1],diff,a[0][3],a[0][6]))
                    else:
                         print 'RID:{0}, liftoff' .format(a[0][1])
                         if fprint==1:
                            fo.write('RID:{0},TDF:{1},LO:{2},NE:{3},liftoff\n'\
                            .format(a[0][1],diff,a[0][3],a[0][6]))                                           
                else:
                    while count1<a[0][4]:
                        print 'RID:{0},TDF:{1},LO:{2},NE:{3},TIP:{4},EID:{5},TID:{6},{7},{8},{9},{10},{11},{12},'\
                        .format(a[0][1],diff,a[0][3],a[0][6],b[count1][1],\
                        b[count1][2],b[count1][3],b[count1][4],b[count1][5],\
                        b[count1][6],b[count1][7],b[count1][8],b[count1][9]) 
                        if fprint==1:
                            if count1==0:
                                fo.write('RID:{0},TDF:{1},LO:{2},NE:{3},'\
                                .format(a[0][1],diff,a[0][3],a[0][6]))
                                fo.write('Type:{0},TIP:{1},EID:{2},TID:{3},{4},{5},{6},{7},{8},{9},'\
                                .format(b[count1][0],b[count1][1],b[count1][2],b[count1][3],\
                                b[count1][4],b[count1][5],b[count1][6],b[count1][7],\
                                b[count1][8],b[count1][9])) 
                            else:
                                fo.write('Type:{0},TIP:{1},EID:{2},TID:{3},{4},{5},{6},{7},{8},{9},'\
                                .format(b[count1][0],b[count1][1],b[count1][2],b[count1][3],\
                                b[count1][4],b[count1][5],b[count1][6],b[count1][7],\
                                b[count1][8],b[count1][9])) 
            
                        count1=count1+1                   
                    if fprint==1:                
                        fo.write('\n')
                tt4.delayMs(0.5)
            elif tPalmon<=5000 and GPIO.input(bInt)==1:
                tcal=time.time()
                tPalmon=(tcal-tInit)*1000
                tt4.delayMs(1)            
            elif tPalmon>5000 and GPIO.input(bInt)==1:  # supend start
                tt4.tt4SusScan()
                print 'Scan susped start. Please swip the palm or finger on the screen'
                if fprint==1:
                    fo.write('Scan suspend start\n')
                tt4.delayMs(susTime*1000)               
                print 'Scan resume start. Please liftoff the palm and finger'
                tt4.tt4Resume()
                tInit=time.time()
                if fprint==1:
                    fo.write('Scan resumed\n')
                tPalmon=0
    except KeyboardInterrupt:
        print 'exit check :%s' %time.time()
        tt4.ldoPowerOff()               
        GPIO.cleanup()
        if fprint==1:
            fo.close()
Esempio n. 3
0
def tt4S():
    fprint=0
    if len(sys.argv)<3 or len(sys.argv)>5:
        print 'wrong argument'
        GPIO.cleanup()
        sys.exit()
    elif len(sys.argv)==3 and sys.argv[2].startswith('--'):
        print 'Without sav to file arguments'
        cmdNum=int(sys.argv[2][2:])
        print 'Command Number is: 0x%02x' %cmdNum
    elif len(sys.argv)==4 and sys.argv[3].startswith('--'):
        print 'with save to file arguments'
        cmdNum=int(sys.argv[2][2:])
        print 'Command Number is: 0x%02x' %cmdNum
        filename=sys.argv[3][2:]
        print 'fileName:{0}'.format(filename)          
        fo = open(filename, "w")
        fprint=1
    else:
        print 'wrong argument'
        
    tt4.TT4Init()
    tt4.delayMs(1)
    tt4.tt4SusScan()
    tt4.delayMs(1)
    [xNum,yNum]=tt4.tt4GetSysInf() #rx=x; tx=y
    totalByte=xNum*yNum*2      
    mutual=np.zeros((1,totalByte/2))
    self=np.zeros((1,(yNum+xNum)))    
    try:
        while True:
            print 'Initial get:%s' %time.time()      
            index=0
            indexTx=0        
            tt4.delayMs(2)           
            mutual,self=tt4GetScan(yNum,xNum,cmdNum)
            while index<(totalByte/2):
                print '{0},'.format(mutual[0][index]),
                if fprint==1:
                    fo.write('{0},'.format(mutual[0][index]))                      
                    index=index+1
                if index%xNum==0:
                    print '{0},'.format(self[0][indexTx+xNum]),
                    print ''
                    if fprint==1:
                        fo.write('{0}\n'.format(self[0][indexTx+xNum]))
                        indexTx=indexTx+1
                            
            for i in range(0,xNum):
                print '{0},'.format(self[0][i]),
                if fprint==1:
                    fo.write('{0},'.format(self[0][i]))
            print ''
            if fprint==1:
                fo.write('\n')
                fo.write('Page Start\n')
    except KeyboardInterrupt:
        print 'exit :%s' %time.time() 
        tt4.ldoPowerOff()  
        GPIO.cleanup()
        if fprint==1:
            fo.close()
Esempio n. 4
0
def tt4R():
    fprint=0
    if len(sys.argv)<2 or len(sys.argv)>4:
        print 'no tx or rx number arguments or wrong arguments'
        GPIO.cleanup()
        sys.exit()
#    elif len(sys.argv)==3:
#        Print 'start to get the system information'
#        sysinf=int(sys.argv[2][2:])
#        if sysinf=='sysInf':
#            tt4GetSysInf()
#    elif len(sys.argv)==4:
#        print 'no save to file arguments'
#        txNum=int(sys.argv[2][2:])
#        rxNum=int(sys.argv[3][2:])
#        print 'txNum:{0},rxNum{1}'.format(txNum,rxNum)
#        fprint=0
    elif len(sys.argv)==3:
        print 'with save to file arguments'
        #txNum=int(sys.argv[2][2:])
        #rxNum=int(sys.argv[3][2:])
        filename=sys.argv[2][2:]
        print 'fileName:{0}'.format(filename)          
        fo = open(filename, "w")
        fprint=1
    
    tt4.TT4Init()
    tt4.delayMs(10)
    tt4SusScan()
    tt4.delayMs(10)
    [txNum,rxNum]=tt4GetSysInf()

    totalByte=txNum*rxNum*2+2      
    cmRawData=np.zeros((1,totalByte/2))
    cpRawData=np.zeros((1,(txNum+rxNum)*2))    

    while True:
        print 'Initial get:%s' %time.time()      
        index=0
        indexTx=0
        
        try:
            tt4.delayMs(1)
            cmRawData,cpRawData=tt4GetRawData(txNum,rxNum)
            while index<(totalByte/2):
                print '{0},'.format(cmRawData[0][index]),
                if fprint==1:
                    fo.write('{0},'.format(cmRawData[0][index]))                      
                index=index+1
                if index%rxNum==0:
                    print '{0},'.format(cpRawData[0][indexTx]),
                    print ''
                    if fprint==1:
                        fo.write('{0}\n'.format(cpRawData[0][indexTx]))
                        indexTx=indexTx+1
                        
            for i in range(txNum*2,txNum*2+rxNum-1):
                print '{0},'.format(cpRawData[0][i]),
                if fprint==1:
                    fo.write('{0},'.format(cpRawData[0][i]))
            print ''
            if fprint==1:
                fo.write('\n')
                fo.write('page start \n')
        except KeyboardInterrupt:
            print 'exit :%s' %time.time()
            tt4.ldoPowerOff()            
            GPIO.cleanup()
            if fprint==1:
                fo.close()
            break
Esempio n. 5
0
def tt4D():
    fprint = 0
    if len(sys.argv) < 2 or len(sys.argv) > 4:
        print 'no tx or rx number arguments or wrong arguments'
        GPIO.cleanup()
        sys.exit()

    elif len(sys.argv) == 3:
        print 'with save to file arguments'
        # txNum=int(sys.argv[2][2:])
        # rxNum=int(sys.argv[3][2:])
        filename = sys.argv[2][2:]
        print 'fileName:{0}'.format(filename)
        fo = open(filename, "w")
        fprint = 1

    tt4.TT4Init()
    tt4.delayMs(10)
    tt4ResumeScan()
    tt4.delayMs(10)
    tt4SusScan()
    tt4.delayMs(10)
    [txNum, rxNum] = tt4GetSysInf()
    totalByte = txNum * rxNum
    mrData = np.zeros((1, totalByte))
    mdData = np.zeros((1, totalByte))

    while True:
        print 'Initial get:%s' % time.time()

        try:
            if fprint == 1:
                fo.write('\n')
                fo.write('mutual raw page start \n')

            mrData, mdData = tt4GetMutual(txNum, rxNum)
            index = 0
            while index < (totalByte):
                print '{0},'.format(mrData[0][index]),
                if fprint == 1:
                    fo.write('{0},'.format(mrData[0][index]))
                index = index + 1
                if index % txNum == 0:
                    print ''
                    if fprint == 1:
                        fo.write('\n')
            print ''

            if fprint == 1:
                fo.write('\n')
                fo.write('mutual diff page start \n')
            index = 0
            while index < (totalByte):
                print '{0},'.format(mdData[0][index]),
                if fprint == 1:
                    fo.write('{0},'.format(mdData[0][index]))
                index = index + 1
                if index % txNum == 0:
                    print ''
                    if fprint == 1:
                        fo.write('\n')
            print ''

        except KeyboardInterrupt:
            print 'exit :%s' % time.time()
            GPIO.cleanup()
            if fprint == 1:
                fo.close()
            break
Esempio n. 6
0
def tt4P(): 
    if len(sys.argv)<2 or len(sys.argv)>3:
        print 'wrong argument'
        sys.exit()
    elif len(sys.argv)==3 and sys.argv[2].startswith('--'):
        filename=sys.argv[2][2:] 
        print filename
        fo = open(filename, "w")
        fprint=1
    elif len(sys.argv)==2 and sys.argv[2].startswith('--'):
        fprint=0
    else:
        print 'wrong argument inputed'
        
        
    tt4.TT4Init()
    count=0
    tPre=time.time()
    try:
        while True:    
            tt4.delayMs(0.02)
            #print 'before Falling'
            if GPIO.input(bInt)==0:
                #print 'time:%s INT Low'%time.time()
                count=count+1
                tNow=time.time()
                diff=(tNow-tPre)*1000
                tPre=tNow
                data1=tt4.readFgData(TT4Addr,3,10)
                a,b=tt4.TT4resolve(data1)
                count1=0
                #print a[0][4],a[0][3]
                if a[0][4]==0:
                    if a[0][3]==1:
                        print 'LO:{0}, large Object Detected' .format(a[0][3])
                        if fprint==1:
                            fo.write('RID:{0},TDF:{1},LO:{2},NE:{3},largeObject`\n'\
                            .format(a[0][1],diff,a[0][3],a[0][6]))
                    else:
                         print 'RID:{0}, liftoff' .format(a[0][1])
                         if fprint==1:
                            fo.write('RID:{0},TDF:{1},LO:{2},NE:{3},liftoff\n'\
                            .format(a[0][1],diff,a[0][3],a[0][6]))                                           
                else:
                    while count1<a[0][4]:
                        print 'RID:{0},TDF:{1},LO:{2},NE:{3},TIP:{4},EID:{5},TID:{6},{7},{8},{9},{10},{11},{12},'\
                        .format(a[0][1],diff,a[0][3],a[0][6],b[count1][1],\
                        b[count1][2],b[count1][3],b[count1][4],b[count1][5],\
                        b[count1][6],b[count1][7],b[count1][8],b[count1][9]) 
                        if fprint==1:
                            if count1==0:
                                fo.write('RID:{0},TDF:{1},LO:{2},NE:{3},'\
                                .format(a[0][1],diff,a[0][3],a[0][6]))
                                fo.write('Type:{0},TIP:{1},EID:{2},TID:{3},{4},{5},{6},{7},{8},{9},'\
                                .format(b[count1][0],b[count1][1],b[count1][2],b[count1][3],\
                                b[count1][4],b[count1][5],b[count1][6],b[count1][7],\
                                b[count1][8],b[count1][9])) 
                            else:
                                fo.write('Type:{0},TIP:{1},EID:{2},TID:{3},{4},{5},{6},{7},{8},{9},'\
                                .format(b[count1][0],b[count1][1],b[count1][2],b[count1][3],\
                                b[count1][4],b[count1][5],b[count1][6],b[count1][7],\
                                b[count1][8],b[count1][9])) 
            
                        count1=count1+1                   
                    if fprint==1:                
                        fo.write('\n')
                    tt4.delayMs(0.5)
            else:
                tt4.delayMs(1)
    except KeyboardInterrupt:
        print 'exit check :%s' %time.time()
        tt4.ldoPowerOff()               
        GPIO.cleanup()
        if fprint==1:
            fo.close()
Esempio n. 7
0
def tt4PrintRep():
    if len(sys.argv) < 3:
        print 'no print to file argument'
        fprint = 0
    elif sys.argv[2].startswith('--'):
        filename = sys.argv[2][2:]
        print filename
        fo = open(filename, "w")
        fprint = 1

    tt4.TT4Init()
    count = 0
    while True:
        try:
            tt4.delayMs(0.02)
            #print 'before Falling'
            if GPIO.input(bInt) == 0:
                print 'time:%s INT Low' % time.time()
                count = count + 1
                data1 = tt4.readFgData(TT4Addr, 3, 10)
                a, b = tt4.TT4resolve(data1)
                count1 = 0
                #print a[0][4],a[0][3]
                if a[0][4] == 0:
                    if a[0][3] == 1:
                        print 'LO:{0}, large Object Detected'.format(a[0][3])
                    else:
                        print 'RID:{0}, liftoff'.format(a[0][1])
                else:
                    while count1 < a[0][4]:
                        print 'RID:{0},T:{1},LO:{2},NE:{3},TIP:{4},EID:{5},TID:{6},{7},{8},{9},{10},{11},{12},'\
                        .format(a[0][1],a[0][2],a[0][3],a[0][6],b[count1][1],\
                        b[count1][2],b[count1][3],b[count1][4],b[count1][5],\
                        b[count1][6],b[count1][7],b[count1][8],b[count1][9])
                        if fprint == 1:
                            if count1 == 0:
                                fo.write('RID:{0},T:{1},LO:{2},NE:{3},'\
                                .format(a[0][1],a[0][2],a[0][3],a[0][6]))
                                fo.write('Type:{0},TIP:{1},EID:{2},TID:{3},{4},{5},{6},{7},{8},{9},'\
                                .format(b[count1][0],b[count1][1],b[count1][2],b[count1][3],\
                                b[count1][4],b[count1][5],b[count1][6],b[count1][7],\
                                b[count1][8],b[count1][9]))
                            else:
                                fo.write('Type:{0},TIP:{1},EID:{2},TID:{3},{4},{5},{6},{7},{8},{9},'\
                                .format(b[count1][0],b[count1][1],b[count1][2],b[count1][3],\
                                b[count1][4],b[count1][5],b[count1][6],b[count1][7],\
                                b[count1][8],b[count1][9]))

                        count1 = count1 + 1

                if fprint == 1:
                    fo.write('\n')
                tt4.delayMs(0.5)
            else:
                tt4.delayMs(1)
        except KeyboardInterrupt:
            print 'exit check :%s' % time.time()
            GPIO.cleanup()
            if fprint == 1:
                fo.close()
            break