1
0
mirror of https://github.com/jonathanhogg/scopething synced 2025-07-14 03:02:09 +01:00

Scaling using modelling function

This commit is contained in:
Jonathan Hogg
2016-10-23 15:52:30 +01:00
parent 668a63902c
commit 7eb23b38f2
2 changed files with 45 additions and 24 deletions

View File

@ -13,10 +13,10 @@ class SerialStream:
@staticmethod
def available_ports():
return [port.device for port in serial.tools.list_ports.comports()]
return [port.device for port in serial.tools.list_ports.comports() if port.usb_description() == 'FT245R USB FIFO']
def __init__(self, port=-1, loop=None, **kwargs):
self._device = self.available_ports()[port]
def __init__(self, port=0, device=None, loop=None, **kwargs):
self._device = self.available_ports()[port] if device is None else device
self._connection = serial.Serial(self._device, timeout=0, write_timeout=0, **kwargs)
self._loop = loop if loop is not None else asyncio.get_event_loop()
self._input_buffer = bytes()