From 45398caf80007bd106b7fa76667c994441d8bbdf Mon Sep 17 00:00:00 2001 From: klaute Date: Mon, 29 Aug 2016 22:02:26 +0200 Subject: [PATCH] First thoughts to implement the serial connection support. --- tools/muxctrl.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/muxctrl.py b/tools/muxctrl.py index 4f7784f..7776d1c 100755 --- a/tools/muxctrl.py +++ b/tools/muxctrl.py @@ -48,6 +48,10 @@ THREAD_LOOP_DELAY_S = 0.01 ############################################################################### +ser = None + +############################################################################### + baudrate = 0xffffffff muxLine = 0xff @@ -98,13 +102,14 @@ thread_lock = None ########## function to call by the thread def processReceivedData(): - incoming = [] - thread_started = True for thread_stop == False: # 1. read byte from serial port into incoming + incoming = [] + incoming = ser.read(64) + # 2. process the received data for c in incoming: cc_state_fn[cc_state](c) @@ -224,17 +229,16 @@ def resetToBtldr(): ##### def openSerialDevice(d): - pass + ser = serial.Serial(d, 115200, timeout=0) ##### def closeSerialDevice(): - pass + ser.close() ##### def sendSerialData(data): for c in data: - - pass + ser.write(c) ###############################################################################