# --------------------------------------------------------------- # Power-on the XBEE LP subsystem xlp_pwr = Pin('PWR_XBEE_LP', Pin.OUT_PP) xlp_pwr.high() # Re-direct the XBEE LP subsystem to the MCU xlp_dir = Pin('XBEE_LP_DIR', Pin.OUT_PP) xlp_dir.high() # XBEE LP UART configuration xhp_uart = UART('XBEE_HP', 115200, rxbuf=0, dma=True) # Parser configuration xhp_uart.parser(UART.ParserUBX, rxbuf=2048, rxcallback=OnUbloxMsg, frcallback=OnUbloxParsed) xhp_uart.parser(UART.ParserRTCM, rxbuf=2048, rxcallback=OnRtcmMsg) # Main application process def app_proc(): while True: # Call the RTCM framer function xhp_uart.process(UART.ParserRTCM) # Call the UBX framer function xhp_uart.process(UART.ParserUBX) if __name__ == "__main__": # Start the application process
# --------------------------------------------------------------- # GNSS Modules # --------------------------------------------------------------- # Power-on the GNSS subsystem gnss_pwr = Pin('PWR_GNSS', Pin.OUT_PP) gnss_pwr.high() # UART configuration of ZEDs with application buffer zed1_uart = UART('ZED1', 115200, rxbuf=1024) # Parser configuration zed1_uart.parser(UART.ParserNMEA, rxbuf=256, rxcallback=OnNmeaMsg, frcallback=OnParsedMsg) # Main application process def app_proc(): while True: # ZED Message processor zed1_uart.process(UART.ParserNMEA) if __name__ == "__main__": # Start the application process _thread.start_new_thread(app_proc, ())
# --------------------------------------------------------------- # GNSS Modules # --------------------------------------------------------------- # Power-on the GNSS subsystem gnss_pwr = Pin('PWR_GNSS', Pin.OUT_OD) gnss_pwr.high() # UART configuration of ZED with application buffer zed1 = UART('ZED1', 115200, rxbuf=0, dma=False) # Parser configurations zed1.parser(UART.ParserNMEA, rxbuf=256, rxcallback=OnNmeaMsg, frcallback=OnNmeaParsed) zed1.parser(UART.ParserUBX, rxbuf=256, rxcallback=OnUbloxMsg, frcallback=OnUbloxParsed) # Main application process def app_proc(): while True: # Call the UBX framer function zed1.process(UART.ParserUBX) # Call the NMEA framer function zed1.process(UART.ParserNMEA)
# --------------------------------------------------------------- # GNSS Modules # --------------------------------------------------------------- # Power-on the GNSS subsystem gnss_pwr = Pin('PWR_GNSS', Pin.OUT_OD) gnss_pwr.high() # UART configuration of ZED with application buffer zed1_uart = UART('ZED1', 115200, rxbuf=0, dma=False) # Parser configurations zed1_uart.parser(UART.ParserUBX, rxbuf=2048, rxcallback=OnUbloxMsg, frcallback=OnUbloxParsed) # Main application process def app_proc(): while True: # Call the UBX framer processor zed1_uart.process(UART.ParserUBX) if __name__ == "__main__": # Start the application process _thread.start_new_thread(app_proc, ())
# --------------------------------------------------------------- # XBEE Expansions # --------------------------------------------------------------- # Power-on the XBEE LP subsystem xlp_pwr = Pin('PWR_XBEE_LP', Pin.OUT_PP) xlp_pwr.high() # Re-direct the XBEE LP subsystem to the MCU xlp_dir = Pin('XBEE_LP_DIR', Pin.OUT_PP) xlp_dir.high() # XBEE LP UART configuration xlp_uart = UART('XBEE_LP', 115200, rxbuf=0, dma=True) # Parser configuration xlp_uart.parser(UART.ParserRTCM, rxbuf=1030, rxcallback=OnRtcmMsg) # Main application process def app_proc(): while True: # Call the RTCM framer processor xlp_uart.process(UART.ParserRTCM) if __name__ == "__main__": # Start the application process _thread.start_new_thread(app_proc, ())
def OnNmeaMsg2(uart, nmeaMsg): s = 'ZED2: ' + nmeaMsg.decode('utf-8') print(s) fp2.write(s + '\n') # --------------------------------------------------------------- # ZED2 GNSS NMEA message parsed callback # --------------------------------------------------------------- def OnParsedMsg2(msgType, msgItems): pass # Parser configuration zed1_uart.parser(UART.ParserNMEA, rxbuf=256, rxcallback=OnNmeaMsg1, frcallback=OnParsedMsg1) zed2_uart.parser(UART.ParserNMEA, rxbuf=256, rxcallback=OnNmeaMsg2, frcallback=OnParsedMsg2) # --------------------------------------------------------------- # Thread #1 process # --------------------------------------------------------------- async def thread1_proc(): global fext1, fext2 global fp1, fp2 while True: