X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fstm%2Fao_lcd_font.c;h=b1664b1381f0ad2b9853bb982b7ddec65117fb1f;hb=e64438271e481ca9f9eeb0ce2b1f9eca071b7ad4;hp=f6074587e55e785a042ca55e89fa24b6a5a4e257;hpb=6da2f5846f2d28ea1f09f60ef2cc3f68113ac62a;p=fw%2Faltos diff --git a/src/stm/ao_lcd_font.c b/src/stm/ao_lcd_font.c index f6074587..b1664b13 100644 --- a/src/stm/ao_lcd_font.c +++ b/src/stm/ao_lcd_font.c @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -98,4 +99,31 @@ ao_lcd_font_string(char *s) { } while (pos < 6) ao_lcd_font_char(pos++, ' ', 0); + stm_lcd.sr = (1 << STM_LCD_SR_UDR); } + +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); +} + +const struct ao_cmds ao_lcd_font_cmds[] = { + { ao_lcd_font_text, "t \0Write to LCD" }, + { 0, NULL } +}; + +void +ao_lcd_font_init(void) +{ + ao_cmd_register(ao_lcd_font_cmds); +} +