diff options
author | Keith Packard <keithp@keithp.com> | 2012-03-22 20:02:30 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-03-28 21:37:03 -0700 |
commit | d236a5c7cd6e9b1d7192e801d63b4bd348cc2f12 (patch) | |
tree | 6a17f52df639b45620ccf48a4411f8f88c94d2eb /src/stm/ao_lcd_font.c | |
parent | 6da2f5846f2d28ea1f09f60ef2cc3f68113ac62a (diff) |
Move LCD string output code to ao_lcd_font.c
It's all very specific to the 14-segment display, so
stick it there.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm/ao_lcd_font.c')
-rw-r--r-- | src/stm/ao_lcd_font.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/stm/ao_lcd_font.c b/src/stm/ao_lcd_font.c index f6074587..2bd787ed 100644 --- a/src/stm/ao_lcd_font.c +++ b/src/stm/ao_lcd_font.c @@ -99,3 +99,30 @@ ao_lcd_font_string(char *s) { while (pos < 6) ao_lcd_font_char(pos++, ' ', 0); } + +static void +ao_lcd_font_text(void) +{ + char string[20]; + uint8_t c = 0; + ao_cmd_white(); + while (ao_cmd_lex_c != '\n' && c < sizeof (string) - 1) { + string[c++] = ao_cmd_lex_c; + ao_cmd_lex(); + } + string[c++] = '\0'; + ao_lcd_font_string(string); + stm_lcd.sr = (1 << STM_LCD_SR_UDR); +} + +const struct ao_cmds ao_lcd_font_cmds[] = { + { ao_lcd_font_text, "t <string>\0Write <string> to LCD" }, + { 0, NULL } +}; + +void +ao_lcd_font_init(void) +{ + ao_cmd_register(ao_lcd_font_cmds); +} + |