YALI
Yet Another LCD Interface
|
YALI (Yet Another LCD Interface) library. More...
#include "unilcd.h"
Macros | |
#define | LINE1_OFFSET 0x80 |
#define | LINE2_OFFSET (LINE1_OFFSET + 0x40) |
#define | LINE3_OFFSET 0x94 |
#define | LINE4_OFFSET (LINE3_OFFSET + 0x40) |
#define | LCD_CONFIG_BACKLIGHT 0x80 |
Functions | |
VOID | writeLCDInterface (UCHAR *data) |
VOID | initLCDInterface (VOID) |
Initialize LCD interface. More... | |
VOID | sendLCDInstruction (UCHAR data, UCHAR mode) |
Send instructions or data to the HD44780 controller. More... | |
VOID | initLCD (VOID) |
Initialize HD44780 controller. More... | |
VOID | printStringLen (const CHAR *str, UCHAR maxLength) |
Print string on LCD. More... | |
VOID | gotoLCDPosition (UCHAR x, UCHAR y) |
Move the cursor to the given coordinates. More... | |
VOID | setDisplayState (UCHAR onState) |
Control LCD screen. More... | |
VOID | setCursorState (UCHAR cursorState) |
Set cursor display mode. More... | |
VOID | setCursorBlinkState (UCHAR blinkState) |
Set cursor blinking mode. More... | |
VOID | setCustomChar (UCHAR addr, UCHAR *buffer) |
Load custom character to the LCD RAM. More... | |
VOID | setBacklightState (UCHAR backLightState) |
Turn on or off the LCD backlight. More... | |
YALI (Yet Another LCD Interface) library.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Move the cursor to the given coordinates.
Set the current cursor position to the given row and column.
x | Horizontal (row) position starting from 0. |
y | Vertical (column) position. |
Initialize HD44780 controller.
Initialize the LCD controller and clear the screen. This function initializes the LCD controller into the following configuration.
Initialize LCD interface.
This function initializes the MCU's I/O pins used by the LCD interface. The I/O pins used in this function are defined in the platform configuration header file (e.g: arduino-conf.h).
Print string on LCD.
Print the content of the specified string buffer on the LCD screen. This function print contents starting from the current cursor position.
str | String buffer. |
maxLength | Length of the string buffer. |
Send instructions or data to the HD44780 controller.
This function sends instructions or data to the HD44780 controller. The transfer type (such as instructions or data) can select using the mode
parameter. This function support all WRITE instructions provided by the HD44780 controller.
data | 8-bit data or instruction code. |
mode | Transfer mode, such as INSTRUCTION_MODE_CMD or INSTRUCTION_MODE_CHAR . |
Turn on or off the LCD backlight.
This function can turn on or off (LED) backlight.
backLightState | Set 1 to turn on the LCD backlight. Set 0 to turn off the LCD backlight. |
Set cursor blinking mode.
This function can switch the cursor between blinking and static modes.
blinkState | Set 1 for blinking, or 0 for the static cursor. |
Set cursor display mode.
This function can turn on or off the cursor.
cursorState | Set 1 to turn on the cursor. Set 0 to turn off the cursor. |
Load custom character to the LCD RAM.
Load 5×8 custom character to the specified address of the CGRAM.
Make sure to call the clearLCD
function after loading all custom characters. Without this function call, the custom characters will not be displayed on the LCD.
To display the custom characters, call the printChar
function with the appropriate address.
addr | RAM address, ranges from 0 to 7. |
buffer | 8-byte long custom character buffer. |