12 KiB
group hd44780
HD44780 Character LCD Driver
Summary
Members | Descriptions |
---|---|
define HD44780_CMD_CLEAR_DISPLAY |
|
define HD44780_CMD_RETURN_HOME |
|
define HD44780_CMD_ENTRY_MODE |
|
define HD44780_ENTRY_MODE_INC |
|
define HD44780_ENTRY_MODE_SHIFT |
|
define HD44780_CMD_DISPLAY |
|
define HD44780_DISPLAY_ON |
|
define HD44780_DISPLAY_CURSOR |
|
define HD44780_DISPLAY_BLINK |
|
define HD44780_CMD_MOVE |
|
define HD44780_MOVE_DISPLAY |
|
define HD44780_MOVE_RIGHT |
|
define HD44780_CMD_FUNCTION |
|
define HD44780_FUNCTION_8_BIT |
|
define HD44780_FUNCTION_2_LINES |
|
define HD44780_FUNCTION_5X10_DOTS |
|
define HD44780_CMD_SET_CGRAM_ADDRESS |
|
define HD44780_CMD_SET_DDRAM_ADDRESS |
|
define HD44780_BUSY_FLAG |
|
public void hd44780_write (uint8_t data,bool isData) |
Write a byte to the display. |
public uint8_t hd44780_read (bool isData) |
Read a byte from the display. |
public bool hd44780_busy (void) |
Indicates whether the display is currently processing, and cannot accept instructions. |
public void hd44780_command (uint8_t command) |
Send a command to the display. Refer to the datasheet for the valid commands. |
public void hd44780_data (uint8_t data) |
Send a byte of data to the display. |
public void hd44780_clear (void) |
Clear the display. |
public void hd44780_home (void) |
Move the cursor to the home position. |
public void hd44780_on (bool cursor,bool blink) |
Turn the display on, and/or set the cursor position. |
public void hd44780_off (void) |
Turn the display off. |
public void hd44780_set_cgram_address (uint8_t address) |
Set the CGRAM address. |
public void hd44780_set_ddram_address (uint8_t address) |
Set the DDRAM address. |
public void hd44780_init (bool cursor,bool blink) |
Initialize the display. |
public void hd44780_set_cursor (uint8_t col,uint8_t line) |
Move the cursor to the specified position on the display. |
public void hd44780_define_char (uint8_t index,uint8_t * data) |
Define a custom character. |
public void hd44780_putc (char c) |
Print a character to the display. The newline character will move the cursor to the start of the next line. |
public void hd44780_puts (const char * s) |
Print a string of characters to the display. |
public void hd44780_define_char_P (uint8_t index,const uint8_t * data) |
Define a custom character from PROGMEM. |
public void hd44780_puts_P (const char * s) |
Print a string of characters from PROGMEM to the display. |
Members
define
HD44780_CMD_CLEAR_DISPLAY
define
HD44780_CMD_RETURN_HOME
define
HD44780_CMD_ENTRY_MODE
define
HD44780_ENTRY_MODE_INC
define
HD44780_ENTRY_MODE_SHIFT
define
HD44780_CMD_DISPLAY
define
HD44780_DISPLAY_ON
define
HD44780_DISPLAY_CURSOR
define
HD44780_DISPLAY_BLINK
define
HD44780_CMD_MOVE
define
HD44780_MOVE_DISPLAY
define
HD44780_MOVE_RIGHT
define
HD44780_CMD_FUNCTION
define
HD44780_FUNCTION_8_BIT
define
HD44780_FUNCTION_2_LINES
define
HD44780_FUNCTION_5X10_DOTS
define
HD44780_CMD_SET_CGRAM_ADDRESS
define
HD44780_CMD_SET_DDRAM_ADDRESS
define
HD44780_BUSY_FLAG
public void
hd44780_write
(uint8_t data,bool isData)
Write a byte to the display.
Parameters
-
data
The byte to send to the display. -
isData
Whether the byte is an instruction or character data.
public uint8_t
hd44780_read
(bool isData)
Read a byte from the display.
Parameters
isData
Whether to read the current cursor position, or the character at the cursor.
Returns
If isData
is true
, the returned byte will be the character at the current DDRAM address. Otherwise, it will be the current DDRAM address and the busy flag.
public bool
hd44780_busy
(void)
Indicates whether the display is currently processing, and cannot accept instructions.
Returns
true
if the display is busy.
public void
hd44780_command
(uint8_t command)
Send a command to the display. Refer to the datasheet for the valid commands.
This function waits for the display to clear the busy flag before sending the command.
Parameters
command
The command to send.
public void
hd44780_data
(uint8_t data)
Send a byte of data to the display.
This function waits for the display to clear the busy flag before sending the data.
Parameters
data
The byte of data to send.
public void
hd44780_clear
(void)
Clear the display.
This function is called on init.
public void
hd44780_home
(void)
Move the cursor to the home position.
This function is called on init.
public void
hd44780_on
(bool cursor,bool blink)
Turn the display on, and/or set the cursor position.
This function is called on init.
Parameters
-
cursor
Whether to show the cursor. -
blink
Whether to blink the cursor, if shown.
public void
hd44780_off
(void)
Turn the display off.
public void
hd44780_set_cgram_address
(uint8_t address)
Set the CGRAM address.
This function is used when defining custom characters.
Parameters
address
The CGRAM address to move to, from0x00
to0x3F
.
public void
hd44780_set_ddram_address
(uint8_t address)
Set the DDRAM address.
This function is used when printing characters to the display, and setting the cursor.
Parameters
address
The DDRAM address to move to, from0x00
to0x7F
.
public void
hd44780_init
(bool cursor,bool blink)
Initialize the display.
This function should be called only once, before any of the other functions can be called.
Parameters
-
cursor
Whether to show the cursor. -
blink
Whether to blink the cursor, if shown.
public void
hd44780_set_cursor
(uint8_t col,uint8_t line)
Move the cursor to the specified position on the display.
Parameters
-
col
The column number to move to, from 0 to 15 on 16x2 displays. -
line
The line number to move to, either 0 or 1 on 16x2 displays.
public void
hd44780_define_char
(uint8_t index,uint8_t * data)
Define a custom character.
Parameters
-
index
The index of the custom character to define, from 0 to 7. -
data
An array of 8 bytes containing the 5-bit row data of the character, where the first byte is the topmost row, and the least significant bit of each byte is the rightmost column.
public void
hd44780_putc
(char c)
Print a character to the display. The newline character will move the cursor to the start of the next line.
The exact character shown may depend on the ROM code of your particular display - refer to the datasheet for the full character set.
Parameters
c
The character to print.
public void
hd44780_puts
(const char * s)
Print a string of characters to the display.
Parameters
s
The string to print.
public void
hd44780_define_char_P
(uint8_t index,const uint8_t * data)
Define a custom character from PROGMEM.
On ARM devices, this function is simply an alias of hd44780_define_char().
Parameters
-
index
The index of the custom character to define, from 0 to 7. -
data
A PROGMEM array of 8 bytes containing the 5-bit row data of the character, where the first byte is the topmost row, and the least significant bit of each byte is the rightmost column.
public void
hd44780_puts_P
(const char * s)
Print a string of characters from PROGMEM to the display.
On ARM devices, this function is simply an alias of hd44780_puts().
Parameters
s
The PROGMEM string to print.