acn/rtx
acn
/
rtx
1
0
Fork 0
rtx/minibtx.py

28 lines
636 B
Python

# -*- coding: UTF-8 -*-
'''
rtx - RetroText
minibtx: Funktionen für das miniBtx-Modul
by Anna Christina Naß <acn@acn.wtf>
released under GPL
'''
import glob
import serial
import config
import logging
MINIBTX_START = b'\x01'
MINIBTX_CONNECT = b'\x00'
def wait_for_minibtx():
connected = False
logging.debug("wait_for_minibtx")
while not connected:
rc = glob.ser.read(1)
logging.debug("miniBtx: >%s<", rc)
if rc == MINIBTX_START:
logging.info("miniBtx starts connection...")
if rc == MINIBTX_CONNECT:
logging.info("miniBtx connected!")
connected = True