Example #1
0
    def __init__(self, port, speed, kernel_image, kernel_address, upload_only,
                 output_only):
        self.kernel_image = kernel_image
        self.kernel_address = kernel_address
        self.upload_only = upload_only
        self.output_only = output_only

        self.port = asyncserial.AsyncSerial(port, baudrate=speed)
 def start():
     if platform.system() == 'Windows':
         # Need to use Proactor (IOCP) event loop for serial port.
         loop = asyncio.ProactorEventLoop()
     else:
         loop = asyncio.new_event_loop()
     self.device = asyncserial.AsyncSerial(*args, loop=loop, **kwargs)
     self.loop = loop
     loop.call_soon(loop_started.set)
     loop.run_forever()
Example #3
0
 def __init__(self, serial_dev):
     if serial_dev is None:
         self.simulation = True
     else:
         self.simulation = False
         self.port = asyncserial.AsyncSerial(serial_dev,
                                             baudrate=19200,
                                             bytesize=8,
                                             parity="N",
                                             stopbits=1,
                                             xonxoff=0)
Example #4
0
    def __init__(self, port, speed, kernel_image, kernel_address,
                 upload_only, output_only):
        self.kernel_image = kernel_image
        self.kernel_address = kernel_address
        self.upload_only = upload_only
        self.output_only = output_only

        self.port = asyncserial.AsyncSerial(port, baudrate=speed)
        if serial.__version__[0] == "2":
            self.port.ser.setRTS(False)
        else:
            self.port.ser.rts = False
Example #5
0
    def __init__(self, port, speed, kernel_image, kernel_address, upload_only,
                 output_only):
        self.kernel_image = kernel_image
        self.kernel_address = kernel_address
        self.upload_only = upload_only
        self.output_only = output_only

        self.port = asyncserial.AsyncSerial(port, baudrate=speed)

        if not (upload_only or output_only):
            self.keyqueue = asyncio.Queue(100)

            def getkey_callback(c):
                self.keyqueue.put_nowait(c)

            init_getkey(getkey_callback)

        if self.upload_only:
            self.main_task = asyncio.ensure_future(self.upload_only_coro())
        else:
            self.main_task = asyncio.ensure_future(self.main_coro())
Example #6
0
    def _open_asyncserial():
        with asyncserial.AsyncSerial(**kwargs) as async_device:
            yield asyncio.From(asyncio.sleep(5))

        raise asyncio.Return(None)
Example #7
0
 def __init__(self, serial_dev):
     if serial_dev is None:
         self.simulation = True
     else:
         self.simulation = False
         self.port = asyncserial.AsyncSerial(serial_dev, baudrate=9600)