def __init__(self,
path='/dev/ttyACM0',
baudrate=9600,
bytesize=EIGHTBITS,
parity=PARITY_NONE,
stopbits=STOPBITS_ONE,
timeout=1,
open_on_create=True,
debugging=False):
"""
Create Telium device instance
:param str path: str Path to serial emulated device
:param int baudrate: Set baud rate
:param int timeout: Maximum delai before hanging out.
:param bool open_on_create: Define if device has to be opened on instance creation
:param bool debugging: Enable print device <-> host com trace. (stdout)
"""
self._path = path
self._baud = baudrate
self._debugging = debugging
self._device_timeout = timeout
self._device = None
self._device = Serial(
self._path if open_on_create else None,
baudrate=self._baud,
bytesize=bytesize,
parity=parity,
stopbits=stopbits,
timeout=timeout
)
if not open_on_create:
self._device.setPort(self._path)
评论列表
文章目录