HD44780 peripheral library for stm32 microcontrollers.
More...
#include <stdbool.h>
#include <stdlib.h>
#include <stm32f1xx_hal.h>
Go to the source code of this file.
|
void | HD44780_init (const HD44780 *lcd) |
| Initialize the necessary hardware peripherals, then configure the controller itself. More...
|
|
void | HD44780_configure (const HD44780 *lcd, const HD44780_Config *config) |
| Update the configuration of the controller. More...
|
|
void | HD44780_clear (const HD44780 *lcd) |
| Clear the display and move the cursor to position 0 of the first line. More...
|
|
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. More...
|
|
void | HD44780_cursor_to (const HD44780 *lcd, uint8_t column, uint8_t row) |
| Move the cursor to the desired position. More...
|
|
void | HD44780_shift_display (const HD44780 *lcd, int8_t n) |
| Shift the contents of the display right or left by n positions. More...
|
|
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. More...
|
|
void | HD44780_put_char (const HD44780 *lcd, uint8_t chr) |
| Write a single character to the lcd, then advance the cursor. More...
|
|
void | HD44780_put_str (const HD44780 *lcd, const char *str) |
| Write a string to the lcd, then advance the cursor. More...
|
|
HD44780 peripheral library for stm32 microcontrollers.
More information is available at the project's home page: https://github.com/murar8/stm32-HD44780
- Version
- 0.1.0
- Author
- Lorenzo Murarotto lnzmr.nosp@m.r@gm.nosp@m.ail.c.nosp@m.om
- Copyright
- Copyright 2021 Lorenzo Murarotto. This project is released under the MIT license.
◆ HD44780_clear()
void HD44780_clear |
( |
const HD44780 * |
lcd | ) |
|
Clear the display and move the cursor to position 0 of the first line.
- Parameters
-
◆ HD44780_configure()
Update the configuration of the controller.
- Parameters
-
lcd | Controller instance. |
config | New controller configuration. |
◆ HD44780_create_symbol()
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.
The controller memory can store up to 8 5x8 symbols, and up to 4 5x10 symbols. Please take into consideartion that 5x10 symbols needs 2 CGRAM slots, so after defining a 5x10 symbol at address n, next symbol should be defined at address n+2.
- Parameters
-
lcd | Controller instance. |
address | ASCII code of the new symbol, must be in the range from 0 to 7 inclusive. |
font_5x10 | Wheteher the new symbol will be a 5x10 character. |
symbol | Array of 5 bit values where each bit will determine whether the corresponding pixel is lit up in its corresponding row. |
◆ HD44780_cursor_to()
void HD44780_cursor_to |
( |
const HD44780 * |
lcd, |
|
|
uint8_t |
column, |
|
|
uint8_t |
row |
|
) |
| |
Move the cursor to the desired position.
- Parameters
-
lcd | Controller instance. |
column | Index of the desired cursor position in the line. Must be less than 0x50 in single line mode, and less than 0x28 in two lines mode, or the cursor will wrap to the next line causing undefined behaviour. |
row | Index of the desired row. Must be 0 if the controller is configured for single line mode, and 0 or 1 when the controller is in two lines mode. |
◆ HD44780_init()
void HD44780_init |
( |
const HD44780 * |
lcd | ) |
|
Initialize the necessary hardware peripherals, then configure the controller itself.
The initial configuration will be the same as calling HD44780_configure() with all the config flags set to false.
- Parameters
-
◆ HD44780_put_char()
void HD44780_put_char |
( |
const HD44780 * |
lcd, |
|
|
uint8_t |
chr |
|
) |
| |
Write a single character to the lcd, then advance the cursor.
When the character is '\n' the cursor will advance to the next line, wrapping around from last to first. When the character is '\t' 4 spaces will be written to the display.
- Parameters
-
lcd | Controller instance. |
chr | Character to be printed to the lcd. |
◆ HD44780_put_str()
void HD44780_put_str |
( |
const HD44780 * |
lcd, |
|
|
const char * |
str |
|
) |
| |
Write a string to the lcd, then advance the cursor.
The same considerations for special characters from HD44780_put_char apply to this function.
- Note
- The string must be null terminated.
- Parameters
-
lcd | Controller instance. |
str | String to be printed to the lcd. |
◆ HD44780_return_home()
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.
- Parameters
-
◆ HD44780_shift_display()
void HD44780_shift_display |
( |
const HD44780 * |
lcd, |
|
|
int8_t |
n |
|
) |
| |
Shift the contents of the display right or left by n positions.
- Note
- The first and second line will shift at the same time.
-
The execution time of this function will increase linearly with the numbers of positions shifted (~37us / position shifted).
- Parameters
-
lcd | Controller instance. |
n | Number of positions to shift. When the value is positive the diplay will shift left to right, when negative the shift operation will advance right to left. |