From d86b6c596b434bbdd992220e62adaec1bf4222be Mon Sep 17 00:00:00 2001 From: Savanni D'Gerinel Date: Mon, 27 Jun 2022 20:03:49 -0400 Subject: [PATCH] Add display timings. Don't disable the display when clearing. --- display/display.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/display/display.c b/display/display.c index 26c09b3..68b7894 100644 --- a/display/display.c +++ b/display/display.c @@ -42,18 +42,24 @@ void display_init(display_t *disp) { } void display_clear(display_t *disp) { - write_instruction(disp, 0x01); - write_instruction(disp, 0x02); + write_instruction(disp, 0b00000001); + _delay_ms(3); + write_instruction(disp, 0b00000010); + _delay_ms(3); + } void display_enable(display_t *disp) { - // write_instruction(disp, 0x0e); write_instruction(disp, 0b00001100); + _delay_us(100); + write_instruction(disp, 0b00000100); + _delay_us(100); } -void display_set_location(display_t *disp, size_t column, size_t row) { +void display_set_location(display_t *disp, size_t row, size_t column) { size_t addr = row * 40 + column; write_instruction(disp, 0b10000000 | addr); + _delay_us(100); } void display_write_message(display_t *disp, const char *msg) {