51 lines
1.2 KiB
C
51 lines
1.2 KiB
C
/* 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 *);
|
|
|
|
void display_write_message(display_t *, const char *);
|
|
|
|
#endif
|
|
|