]> mj.ucw.cz Git - home-hw.git/commitdiff
Waiting room: More display
authorMartin Mares <mj@ucw.cz>
Fri, 18 Apr 2025 19:40:29 +0000 (21:40 +0200)
committerMartin Mares <mj@ucw.cz>
Fri, 18 Apr 2025 19:40:29 +0000 (21:40 +0200)
waiting/firmware/main.c

index c8b1b64e51506635ae24af7b3075f7bc03a4ea68..ac9b97915d9493a00a1e7383d79dd659e682b8d5 100644 (file)
@@ -185,12 +185,23 @@ static void display_command(byte cmd)
        display_write_nibble((cmd << 4) & 0xf0);
 }
 
+static void display_goto(uint row, uint col)
+{
+       display_command(LCD_CMD_SET_DDRAM_ADDR | (row * 0x40) | col);
+}
+
 static void display_char(byte ch)
 {
        display_write_nibble((ch & 0xf0) | LCD_BIT_RS);
        display_write_nibble(((ch << 4) & 0xf0) | LCD_BIT_RS);
 }
 
+static void display_string(const char *str)
+{
+       while (*str)
+               display_char(*str++);
+}
+
 static void display_init(void)
 {
        debug_puts("Display init\n");
@@ -224,16 +235,13 @@ static void display_init(void)
        // Configure text direction
        display_command(LCD_CMD_ENTRY_MODE_SET | LCD_ENTRY_INCREMENT);
 
-       // Go home (this takes a long time)
-       display_command(LCD_CMD_RETURN_HOME);
+       // Clear the display (this takes a long time)
+       display_command(LCD_CMD_CLEAR_DISPLAY);
        delay_ms(2);
 
-       display_char('M');
-       display_char('n');
-       display_char('a');
-       display_char('u');
-       display_char('!');
-       display_command(LCD_CMD_SET_DDRAM_ADDR | 1);
+       display_goto(0, 0);
+       display_string("Mnauky!");
+       display_goto(1, 0);
 
        debug_puts("Display ready\n");
 }