LCD monitor command. #55

This commit is contained in:
Travis Goodspeed 2017-12-08 18:52:16 -05:00
parent d917393b70
commit 37088f8731
2 changed files with 17 additions and 3 deletions

View File

@ -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);

View File

@ -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;