Add display timings. Don't disable the display when clearing.

This commit is contained in:
Savanni D'Gerinel 2022-06-27 20:03:49 -04:00
parent b6208b0e6d
commit d86b6c596b
1 changed files with 10 additions and 4 deletions

View File

@ -42,18 +42,24 @@ void display_init(display_t *disp) {
} }
void display_clear(display_t *disp) { void display_clear(display_t *disp) {
write_instruction(disp, 0x01); write_instruction(disp, 0b00000001);
write_instruction(disp, 0x02); _delay_ms(3);
write_instruction(disp, 0b00000010);
_delay_ms(3);
} }
void display_enable(display_t *disp) { void display_enable(display_t *disp) {
// write_instruction(disp, 0x0e);
write_instruction(disp, 0b00001100); 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; size_t addr = row * 40 + column;
write_instruction(disp, 0b10000000 | addr); write_instruction(disp, 0b10000000 | addr);
_delay_us(100);
} }
void display_write_message(display_t *disp, const char *msg) { void display_write_message(display_t *disp, const char *msg) {