HD44780  0.1.0
HD44780.h
Go to the documentation of this file.
1 
12 #ifndef __HD44780_H__
13 #define __HD44780_H__
14 
15 #include <stdbool.h>
16 #include <stdlib.h>
17 #include <stm32f1xx_hal.h>
18 
24 typedef struct
25 {
26  GPIO_TypeDef *rs_gpio;
28  GPIO_TypeDef *rw_gpio;
30  GPIO_TypeDef *en_gpio;
32  GPIO_TypeDef *d0_gpio;
34  GPIO_TypeDef *d1_gpio;
36  GPIO_TypeDef *d2_gpio;
38  GPIO_TypeDef *d3_gpio;
40  GPIO_TypeDef *d4_gpio;
42  GPIO_TypeDef *d5_gpio;
44  GPIO_TypeDef *d6_gpio;
46  GPIO_TypeDef *d7_gpio;
48  uint16_t rs_pin;
50  uint16_t rw_pin;
52  uint16_t en_pin;
54  uint16_t d0_pin;
56  uint16_t d1_pin;
58  uint16_t d2_pin;
60  uint16_t d3_pin;
62  uint16_t d4_pin;
64  uint16_t d5_pin;
66  uint16_t d6_pin;
68  uint16_t d7_pin;
75 
80 
86  bool font_5x10;
87 } HD44780;
88 
93 typedef struct
94 {
100 
106 
112 
117 
122  bool shift_rtl;
124 
131 void HD44780_init(const HD44780 *lcd);
132 
140 void HD44780_configure(const HD44780 *lcd, const HD44780_Config *config);
141 
147 void HD44780_clear(const HD44780 *lcd);
148 
154 void HD44780_return_home(const HD44780 *lcd);
155 
167 void HD44780_cursor_to(const HD44780 *lcd, uint8_t column, uint8_t row);
168 
182 void HD44780_shift_display(const HD44780 *lcd, int8_t n);
183 
199 void HD44780_create_symbol(const HD44780 *lcd, uint8_t address, bool font_5x10, const uint8_t symbol[]);
200 
210 void HD44780_put_char(const HD44780 *lcd, uint8_t chr);
211 
222 void HD44780_put_str(const HD44780 *lcd, const char *str);
223 
224 #endif /* __HD44780_H__ */
void HD44780_cursor_to(const HD44780 *lcd, uint8_t column, uint8_t row)
Move the cursor to the desired position.
Definition: HD44780.c:404
void HD44780_create_symbol(const HD44780 *lcd, uint8_t address, bool font_5x10, const uint8_t symbol[])
Create a user defined character to display in the LCD.
Definition: HD44780.c:424
void HD44780_configure(const HD44780 *lcd, const HD44780_Config *config)
Update the configuration of the controller.
Definition: HD44780.c:382
void HD44780_return_home(const HD44780 *lcd)
Reset display shift to the initial position and move the cursor to position 0 of the first line.
Definition: HD44780.c:399
void HD44780_shift_display(const HD44780 *lcd, int8_t n)
Shift the contents of the display right or left by n positions.
Definition: HD44780.c:414
void HD44780_init(const HD44780 *lcd)
Initialize the necessary hardware peripherals, then configure the controller itself.
Definition: HD44780.c:342
void HD44780_put_str(const HD44780 *lcd, const char *str)
Write a string to the lcd, then advance the cursor.
Definition: HD44780.c:483
void HD44780_put_char(const HD44780 *lcd, uint8_t chr)
Write a single character to the lcd, then advance the cursor.
Definition: HD44780.c:449
void HD44780_clear(const HD44780 *lcd)
Clear the display and move the cursor to position 0 of the first line.
Definition: HD44780.c:394
HD44780 controller configuration.
Definition: HD44780.h:94
bool shift_display
Shift the display when data is entered instead of shifting only the cursor.
Definition: HD44780.h:116
bool enable_blink
Make the character indicated by the cursor blink.
Definition: HD44780.h:111
bool shift_rtl
Shift the display (depending on the shift_display parameter) and/or cursor in right to left direction...
Definition: HD44780.h:122
bool disable_display
Disable the display.
Definition: HD44780.h:99
bool enable_cursor
Make the cursor visible.
Definition: HD44780.h:105
HD44780 controller instance.
Definition: HD44780.h:25
uint16_t d0_pin
Pin number of the mcu pin connected to the controller's D0 line.
Definition: HD44780.h:54
uint16_t rs_pin
Pin number of the mcu pin connected to the controller's RS line.
Definition: HD44780.h:48
uint16_t d3_pin
Pin number of the mcu pin connected to the controller's D3 line.
Definition: HD44780.h:60
GPIO_TypeDef * d5_gpio
GPIO port of the mcu pin connected to the controller's D5 line.
Definition: HD44780.h:42
bool single_line
Display a single taller line on the display instead of the default 2 lines.
Definition: HD44780.h:79
uint16_t d4_pin
Pin number of the mcu pin connected to the controller's D4 line.
Definition: HD44780.h:62
uint16_t d6_pin
Pin number of the mcu pin connected to the controller's D6 line.
Definition: HD44780.h:66
GPIO_TypeDef * en_gpio
GPIO port of the mcu pin connected to the controller's EN line.
Definition: HD44780.h:30
GPIO_TypeDef * rs_gpio
GPIO port of the mcu pin connected to the controller's RS line.
Definition: HD44780.h:26
uint16_t d5_pin
Pin number of the mcu pin connected to the controller's D5 line.
Definition: HD44780.h:64
bool interface_8_bit
Use 8 physical data lines (DB7-DB0) for communication with the controller instead of the default 4 li...
Definition: HD44780.h:74
GPIO_TypeDef * d6_gpio
GPIO port of the mcu pin connected to the controller's D6 line.
Definition: HD44780.h:44
GPIO_TypeDef * d7_gpio
GPIO port of the mcu pin connected to the controller's D7 line.
Definition: HD44780.h:46
uint16_t en_pin
Pin number of the mcu pin connected to the controller's EN line.
Definition: HD44780.h:52
bool font_5x10
Use the 5x10 dots character font instead of the default 5x8 dots font.
Definition: HD44780.h:86
uint16_t d1_pin
Pin number of the mcu pin connected to the controller's D1 line.
Definition: HD44780.h:56
uint16_t d2_pin
Pin number of the mcu pin connected to the controller's D2 line.
Definition: HD44780.h:58
uint16_t rw_pin
Pin number of the mcu pin connected to the controller's RW line.
Definition: HD44780.h:50
GPIO_TypeDef * rw_gpio
GPIO port of the mcu pin connected to the controller's RW line.
Definition: HD44780.h:28
GPIO_TypeDef * d4_gpio
GPIO port of the mcu pin connected to the controller's D4 line.
Definition: HD44780.h:40
GPIO_TypeDef * d2_gpio
GPIO port of the mcu pin connected to the controller's D2 line.
Definition: HD44780.h:36
GPIO_TypeDef * d1_gpio
GPIO port of the mcu pin connected to the controller's D1 line.
Definition: HD44780.h:34
GPIO_TypeDef * d0_gpio
GPIO port of the mcu pin connected to the controller's D0 line.
Definition: HD44780.h:32
GPIO_TypeDef * d3_gpio
GPIO port of the mcu pin connected to the controller's D3 line.
Definition: HD44780.h:38
uint16_t d7_pin
Pin number of the mcu pin connected to the controller's D7 line.
Definition: HD44780.h:68