Example #1
0
async def gps_test():
    global gps, uart  # For shutdown
    print('Initialising')
    # Adapt UART instantiation for other MicroPython hardware
    uart = pyb.UART(4, 9600, read_buf_len=200)
    # read_buf_len is precautionary: code runs reliably without it.
    sreader = asyncio.StreamReader(uart)
    swriter = asyncio.StreamWriter(uart, {})
    timer = aswitch.Delay_ms(cb_timeout)
    sentence_count = 0
    gps = as_rwGPS.GPS(sreader, swriter, local_offset=1, fix_cb=callback,
                       fix_cb_args=(timer,),  msg_cb = message_cb)
    await asyncio.sleep(2)
    await gps.command(as_rwGPS.DEFAULT_SENTENCES)
    print('Set sentence frequencies to default')
    #await gps.command(as_rwGPS.FULL_COLD_START)
    #print('Performed FULL_COLD_START')
    print('awaiting first fix')
    loop = asyncio.get_event_loop()
    loop.create_task(sat_test(gps))
    loop.create_task(stats(gps))
    loop.create_task(navigation(gps))
    loop.create_task(course(gps))
    loop.create_task(date(gps))
    await gps.data_received(True, True, True, True)  # all messages
    loop.create_task(change_status(gps, uart))
Example #2
0
 def __init__(self, uart_no = 2, timeout=4000,rx=35,tx=21):
     self.uart = UART(2,baudrate=9600,rx=rx,tx=tx)
     self.timeout = timeout
     self.loop = asyncio.get_event_loop()
     self.swriter = asyncio.StreamWriter(self.uart, {})
     self.sreader = asyncio.StreamReader(self.uart)
     self.delay = aswitch.Delay_ms()
     self.response = []
 def __init__(self, uart_no=2, timeout=4000):
     self.uart = UART(1, baudrate=9600, rx=12, tx=13)
     self.timeout = timeout
     self.loop = asyncio.get_event_loop()
     self.swriter = asyncio.StreamWriter(self.uart, {})
     self.sreader = asyncio.StreamReader(self.uart)
     self.delay = aswitch.Delay_ms()
     self.response = []
     loop = asyncio.get_event_loop()
     loop.create_task(self._recv())
Example #4
0
async def gps_test():
    print('Initialising')
    # Adapt for other MicroPython hardware
    uart = pyb.UART(4, 9600, read_buf_len=200)
    # read_buf_len is precautionary: code runs reliably without it.)
    sreader = asyncio.StreamReader(uart)
    timer = aswitch.Delay_ms(timeout)
    sentence_count = 0
    gps = as_GPS.AS_GPS(sreader, local_offset=1, fix_cb=callback, fix_cb_args=(timer,))
    loop = asyncio.get_event_loop()
    print('awaiting first fix')
    loop.create_task(sat_test(gps))
    loop.create_task(stats(gps))
    loop.create_task(navigation(gps))
    loop.create_task(course(gps))
    loop.create_task(date(gps))