First thoughts to implement the serial connection support.

This commit is contained in:
klaute 2016-08-29 22:02:26 +02:00
parent 03632dfc10
commit 45398caf80

View file

@ -48,6 +48,10 @@ THREAD_LOOP_DELAY_S = 0.01
############################################################################### ###############################################################################
ser = None
###############################################################################
baudrate = 0xffffffff baudrate = 0xffffffff
muxLine = 0xff muxLine = 0xff
@ -98,13 +102,14 @@ thread_lock = None
########## function to call by the thread ########## function to call by the thread
def processReceivedData(): def processReceivedData():
incoming = []
thread_started = True thread_started = True
for thread_stop == False: for thread_stop == False:
# 1. read byte from serial port into incoming # 1. read byte from serial port into incoming
incoming = []
incoming = ser.read(64)
# 2. process the received data # 2. process the received data
for c in incoming: for c in incoming:
cc_state_fn[cc_state](c) cc_state_fn[cc_state](c)
@ -224,17 +229,16 @@ def resetToBtldr():
##### #####
def openSerialDevice(d): def openSerialDevice(d):
pass ser = serial.Serial(d, 115200, timeout=0)
##### #####
def closeSerialDevice(): def closeSerialDevice():
pass ser.close()
##### #####
def sendSerialData(data): def sendSerialData(data):
for c in data: for c in data:
ser.write(c)
pass
############################################################################### ###############################################################################