Add multi-line support
This commit is contained in:
parent
9536b2c2b9
commit
0d9ef55b44
|
@ -38,7 +38,7 @@ void display_init(display_t *disp) {
|
|||
sr_initialize(&disp->reg);
|
||||
set_line_direction(&disp->register_select, LINE_OUT);
|
||||
set_line_direction(&disp->enable, LINE_OUT);
|
||||
write_instruction(disp, 0b00111100);
|
||||
write_instruction(disp, 0b00111000);
|
||||
}
|
||||
|
||||
void display_clear(display_t *disp) {
|
||||
|
@ -47,7 +47,13 @@ void display_clear(display_t *disp) {
|
|||
}
|
||||
|
||||
void display_enable(display_t *disp) {
|
||||
write_instruction(disp, 0x0e);
|
||||
// write_instruction(disp, 0x0e);
|
||||
write_instruction(disp, 0b00001100);
|
||||
}
|
||||
|
||||
void display_set_location(display_t *disp, size_t column, size_t row) {
|
||||
size_t addr = row * 40 + column;
|
||||
write_instruction(disp, 0b10000000 | addr);
|
||||
}
|
||||
|
||||
void display_write_message(display_t *disp, const char *msg) {
|
||||
|
|
|
@ -56,6 +56,8 @@ void display_clear(display_t *);
|
|||
|
||||
void display_enable(display_t *);
|
||||
|
||||
void display_set_location(display_t *, size_t, size_t);
|
||||
|
||||
void display_write_message(display_t *, const char *);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -37,8 +37,9 @@ int main(void) {
|
|||
display_clear(&display);
|
||||
_delay_ms(500);
|
||||
|
||||
const char msg[] = "Hello, my bat";
|
||||
display_write_message(&display, msg);
|
||||
display_write_message(&display, "Hello, my bat");
|
||||
display_set_location(&display, 0, 1);
|
||||
display_write_message(&display, " -- Savanni");
|
||||
display_enable(&display);
|
||||
|
||||
set_line(&light);
|
||||
|
|
Loading…
Reference in New Issue