From 37088f8731a17c13338c164338cc8abd237f5929 Mon Sep 17 00:00:00 2001 From: Travis Goodspeed Date: Fri, 8 Dec 2017 18:52:16 -0500 Subject: [PATCH] LCD monitor command. #55 --- bin/goodwatch.py | 13 +++++++++++-- firmware/monitor.c | 7 ++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/bin/goodwatch.py b/bin/goodwatch.py index 5e6c3db..d1e2122 100755 --- a/bin/goodwatch.py +++ b/bin/goodwatch.py @@ -111,14 +111,19 @@ class GoodWatch: """Peeks a 16-bit word from memory.""" s=self.transact("\x01\x00"+chr16(adr)); return ord16(s[2:4]); + def lcdstring(self,string): + """Writes an 8-letter string to the LCD.""" + self.transact("\x03"+string+"\x00"); + return; if __name__=='__main__': parser = argparse.ArgumentParser(description='GoodWatch Client') parser.add_argument('-p','--port', help='Serial Port',default='/dev/ttyUSB0'); parser.add_argument('-r','--peek', - help='Serial Port'); - + help='Peek'); + parser.add_argument('-l','--lcd', + help='Write a string the LCD.'); parser.add_argument('-d','--dump', help='Produce a core dump.',action='count'); parser.add_argument('-D','--dmesg', @@ -141,6 +146,10 @@ if __name__=='__main__': adr=int(args.peek,16); val=goodwatch.peek(adr); print "0x%04x: %04x\n" % (adr,val); + + if args.lcd!=None: + goodwatch.lcdstring(args.lcd); + #Exit turbomode when we're done. #goodwatch.turbomode(0); diff --git a/firmware/monitor.c b/firmware/monitor.c index 1168ec5..75368db 100644 --- a/firmware/monitor.c +++ b/firmware/monitor.c @@ -16,7 +16,7 @@ enum { SETTURBOMODE = 0x00, PEEK = 0x01, POKE = 0x02, - LCD = 0x03, + LCDSTRING = 0x03, DMESG = 0x04 } monitor_verb; @@ -50,6 +50,11 @@ int monitor_handle(uint8_t *buffer, int len){ } break; + case LCDSTRING: + lcd_zero(); + lcd_string((char*) buffer+1); + break; + case DMESG: break;