UTFT
UTFT
Manual
Basic functionality of this library was origianlly based on the demo-code provided by ITead
studio (for the ITDB02 modules) and NKC Electronics (for the RGB GLCD module/shield).
This library supports a number of 8bit, 16bit and serial graphic displays, and will work with
both Arduino and chipKit boards. For a full list of tested display modules and controllers,
see the document UTFT_Supported_display_modules_&_controllers.pdf.
If you make any modifications or improvements to the code, I would appreciate that you share
the code with me so that I might include it in the next release. I can be contacted through
http://electronics.henningkarlsen.com/contact.php.
IMPORTANT:
When using 8bit and 16bit display modules there are some requirements you must adhere to.
These requirements can be found in the document UTFT_Requirements.pdf.
There are no special requirements when using serial displays.
Since most people have only one or possibly two different display modules a lot of memory has
been wasted to keep support for many unneeded controller chips.
As of v1.1 you now have the option to easily remove this unneeded code from the library. By
disabling the controllers you don't need you can reduce the memory footprint of the library by
several Kb. For more information, please refer to memorysaver.h.
If you are using the “AquaLEDSource All in One Super Screw Shield” on a chipKit Max32, please
read the comment in hardware/pic32/HW_PIC32_defines.h
If you are using the “CTE TFT LCD/SD Shield for Arduino Due”, please read the comment in
hardware/arm/HW_ARM_defines.h
8 bit display shields designed for use on Arduino Uno (and similarly sized boards) can now be
used on Arduino Megas. Please read the comment in hardware/avr/HW_AVR_defines.h
The 7” display modules have not been tested on the chipKit boards due to the high current
requirement for the LED backlight.
LEFT: 0
RIGHT: 9999
CENTER: 9998
Orientation
For use with InitLCD()
PORTRAIT: 0
LANDSCAPE: 1
VGA Colors
Predefined colors for use with setColor() and setBackColor()
Display model
For use with UTFT()
INCLUDED FONTS:
SmallFont
BigFont
SevenSegNumFont
Parameters: Model: See the separate document for the supported display modules
RS: Pin for Register Select
WR: Pin for Write
CS: Pin for Chip Select
RST: Pin for Reset
ALE: <optional> Only used for latched 16bit shields
Pin for Latch signal
Parameters: Model: See the separate document for the supported display modules
SDA: Pin for Serial Data
SCL: Pin for Serial Clock
CS: Pin for Chip Select
RST: Pin for Reset
RS: <optional> Only used for 5pin serial modules
Pin for Register Select
InitLCD([orientation]);
Initialize the LCD and set display orientation.
getDisplayXSize();
Get the width of the screen in the current orientation.
Parameters: None
Returns: Width of the screen in the current orientation in pixels
Usage: Xsize = myGLCD.getDisplayXSize(); // Get the width
getDisplayYSize();
Get the height of the screen in the current orientation.
Parameters: None
Returns: Height of the screen in the current orientation in pixels
Usage: Ysize = myGLCD.getDisplayYSize(); // Get the height
lcdOff();
Turn off the LCD. No commands will be executed until a lcdOn(); is sent.
Parameters: None
Usage: myGLCD.lcdOff(); // Turn off the lcd
Notes: This function is currently only supported on PCF8833-based displays
lcdOn();
Turn on the LCD after issuing a lcdOff()-command.
Parameters: None
Usage: myGLCD.lcdOn(); // Turn on the lcd
Notes: This function is currently only supported on PCF8833-based displays
setContrast(c);
Set the contrast of the display.
Parameters: None
Usage: myGLCD.clrScr(); // Clear the screen
fillScr(r, g, b);
Fill the screen with a specified color.
fillScr(color);
Fill the screen with a specified pre-calculated RGB565 color.
setColor(r, g, b);
Set the color to use for all draw*, fill* and print commands.
setColor(color);
Set the specified pre-calculated RGB565 color to use for all draw*, fill* and print commands.
getColor();
Get the currently selected color.
Parameters: None
Returns: Currently selected color as a RGB565 value (word)
Usage: Color = myGLCD.getColor(); // Get the current color
setBackColor(r, g, b);
Set the background color to use for all print commands.
setBackColor(color);
Set the specified pre-calculated RGB565 background color to use for all print commands.
getBackColor();
Get the currently selected background color.
Parameters: None
Returns: Currently selected background color as a RGB565 value (word)
Usage: BackColor = myGLCD.getBackColor(); // Get the current background color
drawCircle(x, y, radius);
Draw a circle with a specified radius.
fillCircle(x, y, radius);
Draw a filled circle with a specified radius.
setFont(fontname);
Select font to use with print(), printNumI() and printNumF().
Parameters: fontname: Name of the array containing the font you wish to use
Usage: myGLCD.setFont(BigFont); // Select the font called BigFont
Notes: You must declare the font-array as an external or include it in your sketch.
getFont();
Get the currently selected font.
Parameters: None
Returns: Currently selected font
Usage: CurrentFont = myGLCD.getFont(); // Get the current font
getFontXsize();
Get the width of the currently selected font.
Parameters: None
Returns: Width of the currently selected font in pixels
Usage: Xsize = myGLCD.getFontXsize (); // Get font width
getFontYsize();
Get the height of the currently selected font.
Parameters: None
Returns: Height of the currently selected font in pixels
Usage: Ysize = myGLCD.getFontYsize (); // Get font height