diff options
Diffstat (limited to 'display_sim.c')
-rw-r--r-- | display_sim.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/display_sim.c b/display_sim.c index c87329e..93e62c4 100644 --- a/display_sim.c +++ b/display_sim.c @@ -63,7 +63,7 @@ static FILE uart_out = FDEV_SETUP_STREAM(uart_putc, NULL, _FDEV_SETUP_WRITE); /* internal function to dump the display contents to stdout, since there * is no background thread for doing this constantly */ -void display_display(void) +static void full_display(void) { int y = 0; printf("\033[6A"); // hack: raw ANSI escape sequence to move up 6 @@ -74,7 +74,9 @@ void display_display(void) printf("`--------------------'\n"); } -void display_clear(void) +/**/ + +static void display_clear(void) { int x = 0; int y = 0; @@ -85,10 +87,10 @@ void display_clear(void) display[y][x] = '\0'; } - display_display(); + full_display(); } -void display_init(void) +static void display_init(void) { uart_init(); /* FIXME hack: stdout not guaranteed to be assignable */ @@ -98,7 +100,7 @@ void display_init(void) cursor_x = cursor_y = 0; } -void display_write(const char *text) +static void display_write(const char *text) { char c = '\0'; while (cursor_x < LCD_WIDTH && *text) { @@ -108,11 +110,19 @@ void display_write(const char *text) c = '_'; display[cursor_y][cursor_x++] = c; } - display_display(); + full_display(); } -void display_set_cursor(int x, int y) +static void display_set_cursor(int x, int y) { cursor_x = x; cursor_y = y; } + +void get_system_display(struct display *display) +{ + display->init = display_init; + display->clear = display_clear; + display->write = display_write; + display->set_cursor = display_set_cursor; +} |