TFT 16-bit Library
Thin film transistor liquid crystal display (TFT-LCD) is a variant of liquid crystal display (LCD) which uses thin-film transistor (TFT) technology to improve image quality (e.g., addressability, contrast).
TFT LCD is one type of active matrix LCD, though all LCD-screens are based on TFT active matrix addressing.
TFT LCDs are used in television sets, computer monitors, mobile phones, handheld video game systems, personal digital assistants, navigation systems, projectors, etc.
The mikroC PRO for AVR provides a library for working with the following display controllers :
- Himax HX8347D and HX8352A,
- Solomon Systech SSD1963,
- Sitronix ST7789V,
- Ilitek ILI9340, ILI9342 and ILI9481.

- When connecting the TFT display to the MCU use voltage translators from 5V to 3.3V (if MCU is a 5V device). In any other case you can damage the TFT!
- All display controllers are initialized with 65,536 colors (R(5),G(6),B(5)) and require two full ports for operation (due to the 16-bit interface).
External dependencies of TFT 16-bit Library
The following variables must be defined in all projects using TFT 16-bit Library: | Description : | Example : |
---|---|---|
extern sfr char TFT_16bit_DataPort_Lo; |
TFT Data Port Low. | char TFT_16bit_DataPort_Lo at PORTB; |
extern sfr char TFT_16bit_DataPort_Hi; |
TFT Data Port High. | char TFT_16bit_DataPort_Hi at PORTC; |
extern sfr char TFT_16bit_DataPort_Lo_Direction; |
Direction of the TFT Data Port Low . | char TFT_16bit_DataPort_Lo_Direction at DDRC; |
extern sfr char TFT_16bit_DataPort_Hi_Direction; |
Direction of the TFT Data Port High. | char TFT_16bit_DataPort_Hi_Direction at DDRB; |
extern sfr sbit TFT_16bit_WR; |
Write signal. | sbit TFT_16bit_WR at PORTE1_bit; |
extern sfr sbit TFT_16bit_RD; |
Read signal. | sbit TFT_16bit_RD at PORTE0_bit; |
extern sfr sbit TFT_16bit_CS; |
Chip Select signal. | sbit TFT_16bit_CS at PORTE3_bit; |
extern sfr sbit TFT_16bit_RS; |
Command/Register Select signal. | sbit TFT_16bit_RS at PORTE6_bit; |
extern sfr sbit TFT_16bit_RST; |
Reset signal. | sbit TFT_16bit_RST at PORTE4_bit; |
extern sfr sbit TFT_16bit_WR_Direction; |
Direction of the Write pin. | sbit TFT_16bit_WR_Direction at DDE1_bit; |
extern sfr sbit TFT_16bit_RD_Direction; |
Direction of the Read pin. | sbit TFT_16bit_RD_Direction at DDE0_bit; |
extern sfr sbit TFT_16bit_CS_Direction; |
Direction of the Chip Select pin. | sbit TFT_16bit_CS_Direction at DDE3_bit; |
extern sfr sbit TFT_16bit_RS_Direction; |
Direction of the Register Select pin. | sbit TFT_16bit_RS_Direction at DDE6_bit; |
extern sfr sbit TFT_16bit_RST_Direction; |
Direction of the Reset pin. | sbit TFT_16bit_RST_Direction at DDE4_bit; |
Library Routines
- TFT_Init_HX8347D
- TFT_Init_HX8352A
- TFT_Init_SSD1963
- TFT_Init_ILI9340
- TFT_Init_ILI9342
- TFT_Init_ILI9481
- TFT_Init_ILI9341_16bit
- TFT_Init_ST7789V_16bit
- TFT_Init_HX8347G_16bit
- TFT_16bit_Set_Index
- TFT_16bit_Write_Command
- TFT_16bit_Write_Data
- TFT_16bit_Set_Reg
- TFT_16bit_Set_Ext_Buffer
- TFT_16bit_Set_Active
- TFT_16bit_Set_Default_Mode
- TFT_16bit_Set_Font
- TFT_16bit_Set_Ext_Font
- TFT_16bit_Write_Char
- TFT_16bit_Write_Text
- TFT_16bit_Write_Const_Text
- TFT_16bit_Fill_Screen
- TFT_16bit_Set_Pen
- TFT_16bit_Set_Brush
- TFT_16bit_Dot
- TFT_16bit_Line
- TFT_16bit_H_Line
- TFT_16bit_V_Line
- TFT_16bit_Rectangle
- TFT_16bit_Rectangle_Round_Edges
- TFT_16bit_Circle
- TFT_16bit_Image
- TFT_16bit_Ext_Image
- TFT_16bit_Partial_Image
- TFT_16bit_Ext_Partial_Image
- TFT_16bit_Image_Jpeg
- TFT_16bit_RGBToColor16bit
- TFT_16bit_Color16bitToRGB
- TFT_16bit_Rotate_180
TFT_Init_HX8347D
Prototype |
void TFT_Init_HX8347D(unsigned int display_width, unsigned char display_height); |
---|---|
Returns |
Nothing. |
Description |
Initializes HX8347D display controller in 16-bit working mode. Parameters :
|
Requires |
Global variables :
|
Example |
// TFT display connections char TFT_16bit_DataPort_Lo at PORTB; char TFT_16bit_DataPort_Hi at PORTC; sbit TFT_16bit_WR at PORTE1_bit; sbit TFT_16bit_RD at PORTE0_bit; sbit TFT_16bit_CS at PORTE3_bit; sbit TFT_16bit_RS at PORTE6_bit; sbit TFT_16bit_RST at PORTE4_bit; char TFT_16bit_DataPort_Lo_Direction at DDRB; char TFT_16bit_DataPort_Hi_Direction at DDRC; sbit TFT_16bit_WR_Direction : at DDE1_bit; sbit TFT_16bit_RD_Direction at DDE0_bit; sbit TFT_16bit_CS_Direction at DDE3_bit; sbit TFT_16bit_RS_Direction at DDE6_bit; sbit TFT_16bit_RST_Direction at DDE4_bit; // End of TFT display connections // Initialize 240x320 TFT display TFT_Init_HX8347D(240, 320); |
TFT_Init_HX8352A
Prototype |
void TFT_Init_HX8352A(unsigned int display_width, unsigned char display_height); |
---|---|
Returns |
Nothing. |
Description |
Initializes HX8352A display controller in 16-bit working mode. Parameters :
|
Requires |
Global variables :
|
Example |
// TFT display connections char TFT_16bit_DataPort_Lo at PORTB; char TFT_16bit_DataPort_Hi at PORTC; sbit TFT_16bit_WR at PORTE1_bit; sbit TFT_16bit_RD at PORTE0_bit; sbit TFT_16bit_CS at PORTE3_bit; sbit TFT_16bit_RS at PORTE6_bit; sbit TFT_16bit_RST at PORTE4_bit; char TFT_16bit_DataPort_Lo_Direction at DDRB; char TFT_16bit_DataPort_Hi_Direction at DDRC; sbit TFT_16bit_WR_Direction : at DDE1_bit; sbit TFT_16bit_RD_Direction at DDE0_bit; sbit TFT_16bit_CS_Direction at DDE3_bit; sbit TFT_16bit_RS_Direction at DDE6_bit; sbit TFT_16bit_RST_Direction at DDE4_bit; // End of TFT display connections // Initialize 240x320 TFT display TFT_Init_HX8352A(240, 320); |
TFT_Init_SSD1963
Prototype |
void TFT_Init_SSD1963(unsigned int display_width, unsigned char display_height); |
---|---|
Returns |
Nothing. |
Description |
Initializes SSD1963 display controller in 16-bit working mode. Parameters :
|
Requires |
Global variables :
|
Example |
// TFT display connections char TFT_16bit_DataPort_Lo at PORTB; char TFT_16bit_DataPort_Hi at PORTC; sbit TFT_16bit_WR at PORTE1_bit; sbit TFT_16bit_RD at PORTE0_bit; sbit TFT_16bit_CS at PORTE3_bit; sbit TFT_16bit_RS at PORTE6_bit; sbit TFT_16bit_RST at PORTE4_bit; char TFT_16bit_DataPort_Lo_Direction at DDRB; char TFT_16bit_DataPort_Hi_Direction at DDRC; sbit TFT_16bit_WR_Direction : at DDE1_bit; sbit TFT_16bit_RD_Direction at DDE0_bit; sbit TFT_16bit_CS_Direction at DDE3_bit; sbit TFT_16bit_RS_Direction at DDE6_bit; sbit TFT_16bit_RST_Direction at DDE4_bit; // End of TFT display connections // Initialize 240x320 TFT display TFT_Init_SSD1963(240, 320); |
TFT_Init_ILI9340
Prototype |
void TFT_Init_ILI9340(unsigned int display_width, unsigned char display_height); |
---|---|
Returns |
Nothing. |
Description |
Initializes ILI9340 display controller in 16-bit working mode. Parameters :
|
Requires |
Global variables :
|
Example |
// TFT display connections char TFT_16bit_DataPort_Lo at PORTB; char TFT_16bit_DataPort_Hi at PORTC; sbit TFT_16bit_WR at PORTE1_bit; sbit TFT_16bit_RD at PORTE0_bit; sbit TFT_16bit_CS at PORTE3_bit; sbit TFT_16bit_RS at PORTE6_bit; sbit TFT_16bit_RST at PORTE4_bit; char TFT_16bit_DataPort_Lo_Direction at DDRB; char TFT_16bit_DataPort_Hi_Direction at DDRC; sbit TFT_16bit_WR_Direction : at DDE1_bit; sbit TFT_16bit_RD_Direction at DDE0_bit; sbit TFT_16bit_CS_Direction at DDE3_bit; sbit TFT_16bit_RS_Direction at DDE6_bit; sbit TFT_16bit_RST_Direction at DDE4_bit; // End of TFT display connections // Initialize 240x320 TFT display TFT_Init_ILI9340(240, 320); |
TFT_Init_ILI9342
Prototype |
void TFT_Init_ILI9342(unsigned int display_width, unsigned char display_height); |
---|---|
Returns |
Nothing. |
Description |
Initializes ILI9342 display controller in 16-bit working mode. Parameters :
|
Requires |
Global variables :
|
Example |
// TFT display connections char TFT_16bit_DataPort_Lo at PORTB; char TFT_16bit_DataPort_Hi at PORTC; sbit TFT_16bit_WR at PORTE1_bit; sbit TFT_16bit_RD at PORTE0_bit; sbit TFT_16bit_CS at PORTE3_bit; sbit TFT_16bit_RS at PORTE6_bit; sbit TFT_16bit_RST at PORTE4_bit; char TFT_16bit_DataPort_Lo_Direction at DDRB; char TFT_16bit_DataPort_Hi_Direction at DDRC; sbit TFT_16bit_WR_Direction : at DDE1_bit; sbit TFT_16bit_RD_Direction at DDE0_bit; sbit TFT_16bit_CS_Direction at DDE3_bit; sbit TFT_16bit_RS_Direction at DDE6_bit; sbit TFT_16bit_RST_Direction at DDE4_bit; // End of TFT display connections // Initialize 240x320 TFT display TFT_Init_ILI9342(240, 320); |
TFT_Init_ILI9341_16bit
Prototype |
void TFT_Init_ILI9341_16bit(unsigned int display_width, unsigned char display_height); |
---|---|
Returns |
Nothing. |
Description |
Initializes ILI9341 display controller in 16-bit working mode. Parameters :
|
Requires |
Global variables :
|
Example |
// TFT display connections char TFT_16bit_DataPort_Lo at PORTB; char TFT_16bit_DataPort_Hi at PORTC; sbit TFT_16bit_WR at PORTE1_bit; sbit TFT_16bit_RD at PORTE0_bit; sbit TFT_16bit_CS at PORTE3_bit; sbit TFT_16bit_RS at PORTE6_bit; sbit TFT_16bit_RST at PORTE4_bit; char TFT_16bit_DataPort_Lo_Direction at DDRB; char TFT_16bit_DataPort_Hi_Direction at DDRC; sbit TFT_16bit_WR_Direction : at DDE1_bit; sbit TFT_16bit_RD_Direction at DDE0_bit; sbit TFT_16bit_CS_Direction at DDE3_bit; sbit TFT_16bit_RS_Direction at DDE6_bit; sbit TFT_16bit_RST_Direction at DDE4_bit; // End of TFT display connections // Initialize 240x320 TFT display TFT_Init_ILI9341_16bit(240, 320); |
TFT_Init_ST7789V_16bit
Prototype |
void TFT_Init_ST7789V_16bit(unsigned int display_width, unsigned char display_height); |
---|---|
Returns |
Nothing. |
Description |
Initializes ST7789V display controller in 16-bit working mode. Parameters :
|
Requires |
Global variables :
|
Example |
// TFT display connections char TFT_16bit_DataPort_Lo at PORTB; char TFT_16bit_DataPort_Hi at PORTC; sbit TFT_16bit_WR at PORTE1_bit; sbit TFT_16bit_RD at PORTE0_bit; sbit TFT_16bit_CS at PORTE3_bit; sbit TFT_16bit_RS at PORTE6_bit; sbit TFT_16bit_RST at PORTE4_bit; char TFT_16bit_DataPort_Lo_Direction at DDRB; char TFT_16bit_DataPort_Hi_Direction at DDRC; sbit TFT_16bit_WR_Direction : at DDE1_bit; sbit TFT_16bit_RD_Direction at DDE0_bit; sbit TFT_16bit_CS_Direction at DDE3_bit; sbit TFT_16bit_RS_Direction at DDE6_bit; sbit TFT_16bit_RST_Direction at DDE4_bit; // End of TFT display connections // Initialize 240x320 TFT display TFT_Init_ST7789V_16bit(240, 320); |
TFT_Init_ILI9481
Prototype |
void TFT_Init_ILI9481(unsigned int display_width, unsigned char display_height); |
---|---|
Returns |
Nothing. |
Description |
Initializes ILI9481 display controller in 16-bit working mode. Parameters :
|
Requires |
Global variables :
|
Example |
// TFT display connections char TFT_16bit_DataPort_Lo at PORTB; char TFT_16bit_DataPort_Hi at PORTC; sbit TFT_16bit_WR at PORTE1_bit; sbit TFT_16bit_RD at PORTE0_bit; sbit TFT_16bit_CS at PORTE3_bit; sbit TFT_16bit_RS at PORTE6_bit; sbit TFT_16bit_RST at PORTE4_bit; char TFT_16bit_DataPort_Lo_Direction at DDRB; char TFT_16bit_DataPort_Hi_Direction at DDRC; sbit TFT_16bit_WR_Direction : at DDE1_bit; sbit TFT_16bit_RD_Direction at DDE0_bit; sbit TFT_16bit_CS_Direction at DDE3_bit; sbit TFT_16bit_RS_Direction at DDE6_bit; sbit TFT_16bit_RST_Direction at DDE4_bit; // End of TFT display connections // Initialize 240x320 TFT display TFT_Init_ILI9481(240, 320); |
TFT_Init_HX8347G_16bit
Prototype |
void TFT_Init_HX8347G_16bit(unsigned int display_width, unsigned char display_height); |
---|---|
Returns |
Nothing. |
Description |
Initializes HX8347G display controller in 16-bit working mode. Parameters :
|
Requires |
Global variables :
|
Example |
// TFT display connections char TFT_16bit_DataPort_Lo at PORTB; char TFT_16bit_DataPort_Hi at PORTC; sbit TFT_16bit_WR at PORTE1_bit; sbit TFT_16bit_RD at PORTE0_bit; sbit TFT_16bit_CS at PORTE3_bit; sbit TFT_16bit_RS at PORTE6_bit; sbit TFT_16bit_RST at PORTE4_bit; char TFT_16bit_DataPort_Lo_Direction at DDRB; char TFT_16bit_DataPort_Hi_Direction at DDRC; sbit TFT_16bit_WR_Direction : at DDE1_bit; sbit TFT_16bit_RD_Direction at DDE0_bit; sbit TFT_16bit_CS_Direction at DDE3_bit; sbit TFT_16bit_RS_Direction at DDE6_bit; sbit TFT_16bit_RST_Direction at DDE4_bit; // End of TFT display connections // Initialize 240x320 TFT display TFT_Init_HX8347G_16bit(240, 320); |
TFT_16bit_Set_Index
Prototype |
void TFT_16bit_Set_Index(unsigned short index); |
---|---|
Returns |
Nothing. |
Description |
Accesses register space of the controller and sets the desired register. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
// Access register at the location 0x02 TFT_16bit_Set_Index(0x02); |
TFT_16bit_Write_Command
Prototype |
void TFT_16bit_Write_Command(unsigned short cmd); |
---|---|
Returns |
Nothing. |
Description |
Accesses data space and writes a command. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
// Write a command TFT_16bit_Write_Command(0x02); |
TFT_16bit_Write_Data
Prototype |
void TFT_16bit_Write_Data(unsigned int _data); |
---|---|
Returns |
Nothing. |
Description |
Writes date into display memory. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
// Send data TFT_16bit_Write_Data(0x02); |
TFT_16bit_Set_Reg
Prototype |
void TFT_16bit_Set_Reg(unsigned short index, unsigned short value); |
---|---|
Returns |
Nothing. |
Description |
Accesses register space of the controller and writes a value in the desired register. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
// 65K Color Selection TFT_16bit_Set_Reg(0x17, 0x05); |
TFT_16bit_Set_Ext_Buffer
Prototype |
void TFT_16bit_Set_Ext_Buffer(char* (*getExtDataPtr)(unsigned long offset, unsigned long count, unsigned long* num)); |
---|---|
Returns |
Nothing. |
Description |
Function sets pointer to the user function which manipulates the external resource. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
char* ReadExternalBuffer(unsigned long offset, unsigned int count, unsigned int *num){ unsigned long start_sector; unsigned int pos; start_sector = Mmc_Get_File_Write_Sector() + offset/512; pos = (unsigned long)offset%512; if(start_sector == currentSector+1){ Mmc_Multi_Read_Buffer(EXT_BUFFER); currentSector = start_sector; }else if(start_sector != currentSector){ Mmc_Multi_Read_Stop(); Mmc_Multi_Read_Start(start_sector); Mmc_Multi_Read_Buffer(EXT_BUFFER); currentSector = start_sector; } if(count>512-pos){ *num = 512-pos; } else *num = count; return EXT_BUFFER+pos; } TFT_16bit_Set_Ext_Buffer(ReadExternalBuffer); |
TFT_16bit_Set_Active
Prototype |
void TFT_16bit_Set_Active(void (*Set_Index_Ptr)(unsigned short), void (*Write_Command_Ptr)(unsigned short), void (*Write_Data_Ptr)(unsigned int)); |
---|---|
Returns |
Nothing. |
Description |
This function sets appropriate pointers to a user-defined basic routines in order to enable multiple working modes. Parameters :
|
Requires |
None. |
Example |
Please see controller's datasheet for working mode descriptions. void Set_Index(unsigned short index) { // Set Index } void Write_Command(unsigned short cmd) { // Write Command } void Write_Data(unsigned int _data) { // Write Data } void main(){ ... TFT_Set_Active(Set_Index,Write_Command,Write_Data); TFT_Init_HX8352A (320, 240); ... } |
TFT_16bit_Set_Default_Mode
Prototype |
void TFT_16bit_Set_Default_Mode(); |
---|---|
Returns |
Nothing. |
Description |
This function sets TFT in default working mode. Parameters :
|
Requires |
None. |
Example |
TFT_16bit_Set_Default_Mode(); TFT_Init_HX8352A(320, 240); |
TFT_16bit_Set_Font
Prototype |
void TFT_16bit_Set_Font(const char far *activeFont, unsigned int font_color, char font_orientation); |
||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||||||||||||||||||||||||||||||||||
Description |
Sets font, its color and font orientation. Parameters :
|
||||||||||||||||||||||||||||||||||||||||||
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
||||||||||||||||||||||||||||||||||||||||||
Example |
TFT_16bit_Set_Font(TFT_16bit_defaultFont, CL_BLACK_16bit, FO_HORIZONTAL_16bit); |
TFT_16bit_Set_Ext_Font
Prototype |
void TFT_16bit_Set_Ext_Font(unsigned long *activeFont, unsigned int font_color, char font_orientation); |
||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||||||||||||||||||||||||||||||||||
Description |
Sets font, its color and font orientation. Font is located in an external resource Parameters :
|
||||||||||||||||||||||||||||||||||||||||||
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
||||||||||||||||||||||||||||||||||||||||||
Example |
TFT_16bit_Set_Ext_Font(173296, CL_BLACK_16bit, FO_HORIZONTAL_16bit); |
TFT_16bit_Write_Char
Prototype |
void TFT_16bit_Write_Char(unsigned int c, unsigned int x, unsigned int y); |
---|---|
Returns |
Nothing. |
Description |
Writes a char on the TFT at coordinates (x, y).
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Write_Char('A',22,23); |
TFT_16bit_Write_Text
Prototype |
void TFT_16bit_Write_Text(unsigned char *text, unsigned int x, unsigned int y); |
---|---|
Returns |
Nothing. |
Description |
Writes text on the TFT at coordinates (x, y). Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Write_Text("TFT 16-bit Library DEMO, WELCOME !", 0, 0); |
TFT_16bit_Write_Const_Text
Prototype |
void TFT_16bit_Write_Const_Text(const far char *text, unsigned int x, unsigned int y); |
---|---|
Returns |
Nothing. |
Description |
Writes text located in the program memory on the TFT at coordinates (x, y). Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
const char ctext[] = "mikroElektronika"; ... TFT_16bit_Write_Const_Text(ctext, 0, 0); |
TFT_16bit_Fill_Screen
Prototype |
void TFT_16bit_Fill_Screen(unsigned int color); |
||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||||||||||||||||||||||||||
Description |
Fills screen memory block with given color. Parameters :
|
||||||||||||||||||||||||||||||||||
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
||||||||||||||||||||||||||||||||||
Example |
TFT_16bit_Fill_Screen(CL_BLACK_16bit); |
TFT_16bit_Dot
Prototype |
void TFT_16bit_Dot(int x, int y, unsigned int color); |
||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||||||||||||||||||||||||||
Description |
Draws a dot on the TFT at coordinates (x, y). Parameters :
|
||||||||||||||||||||||||||||||||||
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
||||||||||||||||||||||||||||||||||
Example |
TFT_16bit_Dot(50, 50, CL_BLACK_16bit); |
TFT_16bit_Set_Pen
Prototype |
void TFT_16bit_Set_Pen(unsigned int pen_color, char pen_width); |
||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||||||||||||||||||||||||||
Description |
Sets color and thickness parameter for drawing line, circle and rectangle elements. Parameters :
|
||||||||||||||||||||||||||||||||||
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
||||||||||||||||||||||||||||||||||
Example |
TFT_16bit_Set_Pen(CL_BLACK_16bit, 10); |
TFT_16bit_Set_Brush
Prototype |
void TFT_16bit_Set_Brush(char brush_enabled, unsigned int brush_color, char gradient_enabled, char gradient_orientation, unsigned int gradient_color_from, unsigned int gradient_color_to); |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description |
Sets color and gradient which will be used to fill circles or rectangles. Parameters :
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Example |
// Enable gradient from black to white color, left-right orientation TFT_16bit_Set_Brush(0, 0, 1, LEFT_TO_RIGHT_16bit, CL_BLACK_16bit, CL_WHITE_16bit); |
TFT_16bit_Line
Prototype |
void TFT_16bit_Line(int x1, int y1, int x2, int y2); |
---|---|
Returns |
Nothing. |
Description |
Draws a line from (x1, y1) to (x2, y2). Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Line(0, 0, 239, 127); |
TFT_16bit_H_Line
Prototype |
void TFT_16bit_H_Line(int x_start, int x_end, int y_pos); |
---|---|
Returns |
Nothing. |
Description |
Draws a horizontal line on TFT. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
// Draw a horizontal line between dots (10,20) and (50,20) TFT_16bit_H_Line(10, 50, 20); |
TFT_16bit_V_Line
Prototype |
void TFT_16bit_V_Line(int y_start, int y_end, int x_pos); |
---|---|
Returns |
Nothing. |
Description |
Draws a vertical line on TFT. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
// Draw a vertical line between dots (10,5) and (10,25) TFT_16bit_V_Line(5, 25, 10); |
TFT_16bit_Rectangle
Prototype |
void TFT_16bit_Rectangle(int x_upper_left, int y_upper_left, int x_bottom_right, int y_bottom_right); |
---|---|
Returns |
Nothing. |
Description |
Draws a rectangle on TFT. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Rectangle(20, 20, 219, 107); |
TFT_16bit_Rectangle_Round_Edges
Prototype |
void TFT_16bit_Rectangle_Round_Edges(unsigned int x_upper_left, unsigned int y_upper_left, unsigned int x_bottom_right, unsigned int y_bottom_right, unsigned int round_radius); |
---|---|
Returns |
Nothing. |
Description |
Draws a rounded edge rectangle on TFT. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Rectangle_Round_Edges(20, 20, 219, 107, 12); |
TFT_16bit_Circle
Prototype |
void TFT_16bit_Circle(int x_center, int y_center, int radius); |
---|---|
Returns |
Nothing. |
Description |
Draws a circle on TFT. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Circle(120, 64, 110); |
TFT_16bit_Image
Prototype |
void TFT_16bit_Image(unsigned int left, unsigned int top, code const far unsigned short * image, unsigned short stretch); |
---|---|
Returns |
Nothing. |
Description |
Displays an image on a desired location. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Image(0, 0, image, 1); |
TFT_16bit_Ext_Image
Prototype |
void TFT_16bit_Ext_Image(unsigned int left, unsigned int top, unsigned long image, unsigned short stretch); |
---|---|
Returns |
Nothing. |
Description |
Displays an image from an external resource on a desired address. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Image(0, 0, 153608, 1); |
TFT_16bit_Partial_Image
Prototype |
void TFT_16bit_Partial_Image(unsigned int left, unsigned int top, unsigned int width, unsigned int height, code const far unsigned short * image, unsigned short stretch); |
---|---|
Returns |
Nothing. |
Description |
Displays a partial area of the image on a desired location. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
// Draws a 10x15 part of the image starting from the upper left corner on the coordinate (10,12) TFT_16bit_Partial_Image(10, 12, 10, 15, image, 1); |
TFT_16bit_Ext_Partial_Image
Prototype |
void TFT_16bit_Ext_Partial_Image(unsigned int left, unsigned int top, unsigned int width, unsigned int height, unsigned long image, unsigned short stretch); |
---|---|
Returns |
Nothing. |
Description |
Displays a partial area of the image, located on an external resource, on a desired location of the screen. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Ext_Partial_Image(159,0,160,120,0,1); |
TFT_16bit_Image_Jpeg
Prototype |
char TFT_16bit_Image_Jpeg(unsigned int left, unsigned int top, code const far unsigned short *image); |
---|---|
Returns |
|
Description |
Displays a JPEG image on a desired location. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Image_Jpeg(0, 0, image); |
TFT_16bit_RGBToColor16bit
Prototype |
unsigned int TFT_16bit_RGBToColor16bit(char rgb_red, char rgb_green, char rgb_blue); |
---|---|
Returns |
Returns a color value in the following bit-order : 5 bits red, 6 bits green and 5 bits blue color. |
Description |
Converts 5:6:5 RGB format into true color format. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
color16 = TFT_16bit_RGBToColor16bit(150, 193, 65); |
TFT_16bit_Color16bitToRGB
Prototype |
void TFT_16bit_Color16bitToRGB(unsigned int color, char *rgb_red, char *rgb_green, char *rgb_blue); |
---|---|
Returns |
Nothing. |
Description |
Converts true color into 5:6:5 RGB format. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
TFT_16bit_Color16bitToRGB(start_color, &red_start, &green_start, &blue_start); |
TFT_16bit_Rotate_180
Prototype |
void TFT_16bit_Rotate_180(char rotate); |
---|---|
Returns |
Nothing. |
Description |
Rotates the TFT display. Parameters :
|
Requires |
TFT module needs to be initialized. Please, see appropriate TFT initialization routine. |
Example |
// Rotate TFT display for 180 degrees TFT_16bit_Rotate_180(1); // Initialize TFT display TFT_Init_HX8352A(240, 320); |
What do you think about this topic ? Send us feedback!