2022-06-26 16:45:27 +00:00
|
|
|
/*
|
|
|
|
Copyright 2022, Savanni D'Gerinel <savanni@luminescent-dreams.com>
|
|
|
|
|
|
|
|
This file is part of Savanni's AVR library.
|
|
|
|
|
|
|
|
Lumeto is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
Lumeto is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with Lumeto. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2022-06-26 16:40:04 +00:00
|
|
|
/* This library covers a five-wire diagnostic display board.
|
|
|
|
*
|
|
|
|
* Hardware:
|
|
|
|
* 74HC595 shift register
|
|
|
|
* Adafruit HD44780 LCD
|
|
|
|
*
|
|
|
|
* Input pins:
|
|
|
|
* SDI -- Serial data in. This leads to the 74HC595, pin 14 (A).
|
|
|
|
* CLK -- Clock pulse. One bit will be shifted into the device on each rising
|
|
|
|
* edge. This leads to the 74HC595, pin 11 (Shift Clock).
|
|
|
|
* LS -- Latch pulse. All data in the shift register will be sent to the
|
|
|
|
* output on a rising edge. This leads to the 74HC595, pin 12 (Latch Clock);
|
|
|
|
* RS -- Register select. 0 to write an instruction to the display, 1 to write
|
|
|
|
* data to the display.
|
|
|
|
* E -- Enable. This tells the display to read the data. The display will get
|
|
|
|
* the data on the shift register outputs, so be sure to send LS before
|
|
|
|
* sending E.
|
|
|
|
*
|
|
|
|
* 74HC595 -> HD44780
|
|
|
|
* Qa -> D0
|
|
|
|
* Qb -> D1
|
|
|
|
* Qc -> D2
|
|
|
|
* Qd -> D3
|
|
|
|
* Qe -> D4
|
|
|
|
* Qf -> D5
|
|
|
|
* Qg -> D6
|
|
|
|
* Qh -> D7
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DISPLAY_H__
|
|
|
|
#define __DISPLAY_H__
|
|
|
|
|
|
|
|
#include <shift_register.h>
|
|
|
|
|
|
|
|
typedef struct DISPLAY {
|
|
|
|
shift_register_t reg;
|
|
|
|
gpio_t register_select;
|
|
|
|
gpio_t enable;
|
|
|
|
} display_t;
|
|
|
|
|
|
|
|
void display_init(display_t *);
|
|
|
|
|
|
|
|
void display_clear(display_t *);
|
|
|
|
|
|
|
|
void display_enable(display_t *);
|
|
|
|
|
2022-06-26 17:28:23 +00:00
|
|
|
void display_set_location(display_t *, size_t, size_t);
|
|
|
|
|
2022-06-26 16:40:04 +00:00
|
|
|
void display_write_message(display_t *, const char *);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|