Esempio n. 1
0
def initGPS (speed,format):
    
    try:

        #GPS RESET, GPIO 18 configured as Output, value is Cleared to '0'
        #GPS held in RESET
        GPIO.setIOdir(18,1,1)
        
        #GPS RESET, GPIO 18 configured as Output, value is Cleared to '0'
        #GPS is running
        GPIO.setIOvalue(18, 0)
        
        #Init Serial Port Settings
        res = GSM864QP_SER.init_parameters(speed,format)
        MOD.sleep(10)
        
        res = GSM864QP_SER.send_50PIN('\r\n')

        #Disable all NMEA output sentences
        #NMEA GPS sentences will only transmit when polled by CW20.update() method
        res = GSM864QP_SER.send_50PIN('$PNMRX103,ALL,0\r\n')
        
        ## Start timeout timer            
        CW20_timerA = timers.timer(0)
        CW20_timerA.start(2)  

        # Empty Serial Port Buffer
        res = "junk"
        while(res != ""):
            res = GSM864QP_SER.read_50PIN()
            if (CW20_timerA.isexpired()):
                break

    except:
        print 'Script encountered an exception.'
        print 'Exception Type: ' + str(sys.exc_type)
        print 'MODULE -> CW20'
        print 'METHOD -> initGPS(' + speed + ',' + format + ')'

    return