Hitachi HD44780 display controller
Controlled by PCF8574 I2C interface
hd44780.h
Go to the documentation of this file.
1 /* @file */
2 
12 #ifndef __HD44780_H__
13 #define __HD44780_H__
14 
15 #include <stdio.h>
16 #include <pigpiod_if2.h>
17 #include <errno.h>
18 #include <unistd.h>
19 #include <stdbool.h>
20 
21 #define I2C_BUS 1
22 #define I2C_FLAGS 0
23 #define HD44780_ADDRESS 0x3f
24 
25 #define HD44780_CLEAR 0x01
26 #define HD44780_HOME 0x02
27 #define HD44780_ENTRY_MODE 0x04
28 #define HD44780_CURSOR_DIR 0x02
29 #define HD44780_CURSOR_SHIFT 0x10
30 #define HD44780_DISPLAY_CURSOR 0x08
31 #define HD44780_DISPLAY_ON 0x04
32 #define HD44780_DISPLAY_OFF 0x00
33 #define HD44780_CURSOR_ON 0x02
34 #define HD44780_CURSOR_OFF 0x00
35 #define HD44780_CURSOR_BLINK 0x01
36 #define HD44780_CURSOR_NOBLINK 0x00
37 
38 #define HD44780_ENTIRE_DISPLAY 0x04
39 #define HD44780_CURSOR_ONOFF 0x02
40 #define HD44780_BLINK 0x01
41 #define HD44780_CURSOR 0x10
42 #define HD44780_1_LINE 0x00
43 #define DH44780_CURSOR_MOVE 0x00
44 #define DH44780_DISPLAY_SHIFT 0x08
45 #define DH44780_SHIFT_LEFT 0x00
46 #define DH44780_SHIFT_RIGHT 0x04
47 
48 #define HD44780_FUNCTION 0x20
49 
50 #define HD44789_8_BIT_MODE 0x10
51 #define HD44780_4_BIT_MODE 0x00
52 #define HD44780_TWO_LINES 0x08
53 #define HD44780_5x10_FONT 0x04
54 #define HD44780_5x8_FONT 0x00
55 #define HD44780_1_LINE 0x00
56 #define HD44780_2_LINE 0x08
57 #define HD44780_CURSOR_DEC 0x00
58 #define HD44780_CURSOR_INC 0x02
59 #define HD44780_DISPLAY_SHIFT 0x01
60 
61 #define HD44780_CGRAM_AHDR 0x10
62 #define HD44780_HDRAM_AHDR 0x20
63 #define HD44780_BUSY_FLAG 0x40
64 
65 #define HD44780_BL 0x08
66 #define HD44780_EN 0x04
67 #define HD44780_READ 0x02
68 #define HD44780_WRITE 0x00
69 #define HD44780_CMD_REG 0x00
70 #define HD44780_DATA_REG 0x01
71 
72 #define HD44780_SET_DDRAM 0x80
73 #define HD44780_2ND_LINE 0x40
74 
75 #define HD44780_INCREMENT true
76 #define HD44780_DECREMENT false
77 #define HD44780_ON true
78 #define HD44780_OFF false
79 
80 #define HD44780_SUCCESS 0
81 #define HD44780_MAX_STRLEN 16
82 
98 /*
99  function prototypes
100 */
101 void hd44780SetDebug(bool);
102 int hd44780BackLight(bool);
103 int hd44780PutC(char);
104 int hd44780GetC(char *);
105 int hd44780ReadBusy(bool *, unsigned char *);
106 int hd44780PutS(char *);
107 int hd44780Home(void);
108 int hd44780Clear(void);
109 int hd44780Cursor(bool,bool);
110 int hd44780EntryMode(bool,bool);
111 int hd44780SetDDRamAddr(unsigned char);
112 int hd44780SecondLine(void);
113 int hd44780Open(void);
114 void hd44780Close(void);
115 
116 #endif
117 
118 
119 
int hd44780GetC(char *)
Read a character from the display.
Definition: hd44780.c:478
int hd44780SetDDRamAddr(unsigned char)
Sets the DDRAM address.
Definition: hd44780.c:205
void hd44780SetDebug(bool)
switches debug mode on or off
Definition: hd44780.c:28
int hd44780Home(void)
Sets the DDRAM address to zero such that the next character is written to the top left position if th...
Definition: hd44780.c:92
int hd44780SecondLine(void)
Sets the DDRAM address to the beginning of the second line.
Definition: hd44780.c:195
void hd44780Close(void)
hd44770Close: closes the I2C connection to the pcf8574 and disconnects from the pigpio library ...
Definition: hd44780.c:611
int hd44780PutS(char *)
Writes a zero terminated character string to the display Not more than 16 characters are written it n...
Definition: hd44780.c:331
int hd44780ReadBusy(bool *, unsigned char *)
Reads the busy flag and the DDRAM address.
Definition: hd44780.c:451
int hd44780PutC(char)
Write a character to the display.
Definition: hd44780.c:285
int hd44780EntryMode(bool, bool)
Defines if the address counter counts up or down and sets shifting the whole display on or off...
Definition: hd44780.c:173
int hd44780Cursor(bool, bool)
Sets the DDRAM address to zero such that the next character is written to the top left position if th...
Definition: hd44780.c:117
int hd44780BackLight(bool)
switches the display back light on or off
Definition: hd44780.c:39
int hd44780Open(void)
hd44770Open: initializes the pigpio library opens the I2C connection to the pcf8574 which is on the I...
Definition: hd44780.c:502
int hd44780Clear(void)
Clears the display.
Definition: hd44780.c:224