Wednesday, 6 April 2011

Tellymate works good

I bought a TTL Tellymate kit from Batsocks to hook to my Bifferboard, with a simple transistor to invert the RS232 it works good. It's like cool retro ascii from days gone by.
I whipped up a quick bash script to interact with it :
#=============================
#!/bin/bash
export TERM=vt52
PORT=/dev/ttyS0
ESC="\x1b"

function dohelp {
echo -en "tm \n -c clear screen\n -q print diagnostic info\n -b big letter banner \n -e program to run\n"
}

function cls {
echo -en $ESC"E" >$PORT
}
while getopts "b:cqe:h" flag
do
case "$flag" in
c) CLS="yes" ;;
q) Q="yes" ;;
b) BIGTEXT="$OPTARG" ;;
e) PROG=$OPTARG ;;
h) dohelp;;
esac
done
if [ "$PROG" != "" ] ;then savestate ;fi
if [ $CLS ]; then cls;fi
if [ $Q ];then
echo -en $ESC"Q" >$PORT
fi

if [ "$BIGTEXT" != "" ]; then
echo -en $ESC"_4"$BIGTEXT"\n"$ESC"_5"$BIGTEXT"\n" >$PORT
fi
#needs more functions to do x and y pos etc..
#====================================================

along with figlet and the fold and other linux text utilities it was easy to do stuff :
eg.
tm -c -b TESTING -e "figlet -c -w38 Telly Mate test"

tm -c -e "figlet -c -w38 `date`"
(hard to take good photos of lcd but )

No comments: