TFT 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 ARM provides a library for working with the following display controllers :


  Note :

External dependencies of TFT Library

Stellaris

The following variables must be defined in all projects using TFT library: Description : Example :
extern sfr char TFT_DataPort; TFT Data Port. char TFT_DataPort at GPIO_PORTJ_DATA;
extern sfr char TFT_DataPort_Direction; Direction of the TFT Data Port. char TFT_DataPort_Direction at GPIO_PORTJ_DIR;
extern sfr sbit TFT_WR; Write signal. sbit TFT_WR at GPIO_PORTH_DATA4_bit;
extern sfr sbit TFT_RD; Read signal. sbit TFT_RD at GPIO_PORTC_DATA5_bit;
extern sfr sbit TFT_CS; Chip Select signal. sbit TFT_CS at GPIO_PORTH_DATA6_bit;
extern sfr sbit TFT_RS; Command/Register Select signal. sbit TFT_RS at GPIO_PORTG_DATA7_bit;
extern sfr sbit TFT_RST; Reset signal. sbit TFT_RST at GPIO_PORTH_DATA5_bit;
extern sfr sbit TFT_WR_Direction; Direction of the Write pin. sbit TFT_WR_Direction at GPIO_PORTH_DIR4_bit;
extern sfr sbit TFT_RD_Direction; Direction of the Read pin. sbit TFT_RD_Direction at GPIO_PORTC_DIR5_bit;
extern sfr sbit TFT_CS_Direction; Direction of the Chip Select pin. sbit TFT_CS_Direction at GPIO_PORTH_DIR6_bit;
extern sfr sbit TFT_RS_Direction; Direction of the Register Select pin. sbit TFT_RS_Direction at GPIO_PORTG_DIR7_bit;
extern sfr sbit TFT_RST_Direction; Direction of the Reset pin. sbit TFT_RST_Direction at GPIO_PORTH_DIR5_bit;

MSP432

The following variables must be defined in all projects using TFT library: Description : Example :
extern sfr char TFT_DataPort; TFT Data Port. char TFT_DataPort at DIO_P5OUT;
extern sfr char TFT_DataPort_Direction; Direction of the TFT Data Port. char TFT_DataPort_Direction at DIO_P5DIR;
extern sfr sbit TFT_WR; Write signal. sbit TFT_WR at DIO_P6OUT.B0;
extern sfr sbit TFT_RD; Read signal. sbit TFT_RD at DIO_P6OUT.B1;
extern sfr sbit TFT_CS; Chip Select signal. sbit TFT_CS at DIO_P6OUT.B2;
extern sfr sbit TFT_RS; Command/Register Select signal. sbit TFT_RS at DIO_P6OUT.B3;
extern sfr sbit TFT_RST; Reset signal. sbit TFT_RST at DIO_P6OUT.B4;
extern sfr sbit TFT_WR_Direction; Direction of the Write pin. sbit TFT_WR_Direction at DIO_P6DIR.B0;
extern sfr sbit TFT_RD_Direction; Direction of the Read pin. sbit TFT_RD_Direction at DIO_P6DIR.B1;
extern sfr sbit TFT_CS_Direction; Direction of the Chip Select pin. sbit TFT_CS_Direction at DIO_P6DIR.B2;
extern sfr sbit TFT_RS_Direction; Direction of the Register Select pin. sbit TFT_RS_Direction at DIO_P6DIR.B3;
extern sfr sbit TFT_RST_Direction; Direction of the Reset pin. sbit TFT_RST_Direction at DIO_P6DIR.B4;

STM32

The following variables must be defined in all projects using TFT Library: Description : Example :
extern sfr unsigned int TFT_DataPort; TFT Data Port. unsigned int TFT_DataPort at GPIOE_ODR;
extern sfr sbit TFT_WR; Write signal. sbit TFT_WR at GPIOE_ODR.B8;
extern sfr sbit TFT_RD; Read signal. sbit TFT_RD at GPIOE_ODR.B12;
extern sfr sbit TFT_CS; Chip Select signal. sbit TFT_CS at GPIOE_ODR.B15;
extern sfr sbit TFT_RS; Command/Register Select signal. sbit TFT_RS at GPIOE_ODR.B12;
extern sfr sbit TFT_RST; Reset signal. sbit TFT_RST at GPIOE_ODR.B8;

CEC1x02

The following variables must be defined in all projects using TFT Library: Description : Example :
extern sfr unsigned int TFT_DataPort; TFT Data Port. unsigned int TFT_DataPort at GPIO_OUTPUT_010_017;
extern sfr sbit TFT_WR; Write signal. sbit TFT_WR at GPIO_OUTPUT_PIN_001_bit;
extern sfr sbit TFT_RD; Read signal. sbit TFT_RD at GPIO_OUTPUT_PIN_002_bit;
extern sfr sbit TFT_CS; Chip Select signal. sbit TFT_CS at GPIO_OUTPUT_PIN_003_bit;
extern sfr sbit TFT_RS; Command/Register Select signal. sbit TFT_RS at GPIO_OUTPUT_PIN_004_bit;
extern sfr sbit TFT_RST; Reset signal. sbit TFT_RST at GPIO_OUTPUT_PIN_006_bit;

Library Routines

TFT_Init

Prototype

void TFT_Init(unsigned int display_width, unsigned int display_height);

Returns

Nothing.

Description

Initializes HX8347-D display controller display in the 8-bit working mode for CEC1x02, Stellaris and MSP432 devices and 16-bit working mode for STM32 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example

Stellaris

// TFT module connections
char TFT_DataPort at GPIO_PORTJ_DATA;
sbit TFT_RST at GPIO_PORTH_DATA5_bit;
sbit TFT_RS at GPIO_PORTG_DATA7_bit;
sbit TFT_CS at GPIO_PORTH_DATA6_bit;
sbit TFT_RD at GPIO_PORTC_DATA5_bit;
sbit TFT_WR at GPIO_PORTH_DATA4_bit;
char TFT_DataPort_Direction at GPIO_PORTJ_DIR;
sbit TFT_RST_Direction at GPIO_PORTH_DIR5_bit;
sbit TFT_RS_Direction at GPIO_PORTG_DIR7_bit;
sbit TFT_CS_Direction at GPIO_PORTH_DIR6_bit;
sbit TFT_RD_Direction at GPIO_PORTC_DIR5_bit;
sbit TFT_WR_Direction at GPIO_PORTH_DIR4_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init(240, 320);

MSP432

// TFT module connections
char TFT_DataPort at DIO_P5OUT;
sbit TFT_RST at DIO_P6OUT.B0;
sbit TFT_RS at DIO_P6OUT.B1;
sbit TFT_CS at DIO_P6OUT.B2;
sbit TFT_RD at DIO_P6OUT.B3;
sbit TFT_WR at DIO_P6OUT.B4;
char TFT_DataPort_Direction at DIO_P5DIR;
sbit TFT_RST_Direction at DIO_P6DIR.B0;
sbit TFT_RS_Direction at DIO_P6DIR.B1;
sbit TFT_CS_Direction at DIO_P6DIR.B2;
sbit TFT_RD_Direction at DIO_P6DIR.B3;
sbit TFT_WR_Direction at DIO_P6DIR.B4;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init(240, 320);

STM32

// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init(240, 320);

CEC1x02

// TFT module connections
unsigned char TFT_DataPort at GPIO_OUTPUT_010_017;
sbit TFT_WR at GPIO_OUTPUT_PIN_001_bit;
sbit TFT_RD at GPIO_OUTPUT_PIN_002_bit;
sbit TFT_CS at GPIO_OUTPUT_PIN_003_bit;
sbit TFT_RS at GPIO_OUTPUT_PIN_004_bit;
sbit TFT_RST at GPIO_OUTPUT_PIN_005_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init(240, 320);

TFT_Init_HX8347G

Prototype

void TFT_Init_HX8347G(unsigned int display_width, unsigned int display_height);

Returns

Nothing.

Description

Initializes HX8347-G display controller display in the 8-bit working mode for CEC1x02, Stellaris, STM32 and MSP432 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example

Stellaris

// TFT module connections
char TFT_DataPort at GPIO_PORTJ_DATA;
sbit TFT_RST at GPIO_PORTH_DATA5_bit;
sbit TFT_RS at GPIO_PORTG_DATA7_bit;
sbit TFT_CS at GPIO_PORTH_DATA6_bit;
sbit TFT_RD at GPIO_PORTC_DATA5_bit;
sbit TFT_WR at GPIO_PORTH_DATA4_bit;
char TFT_DataPort_Direction at GPIO_PORTJ_DIR;
sbit TFT_RST_Direction at GPIO_PORTH_DIR5_bit;
sbit TFT_RS_Direction at GPIO_PORTG_DIR7_bit;
sbit TFT_CS_Direction at GPIO_PORTH_DIR6_bit;
sbit TFT_RD_Direction at GPIO_PORTC_DIR5_bit;
sbit TFT_WR_Direction at GPIO_PORTH_DIR4_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_HX8347G(240, 320);

MSP432

// TFT module connections
char TFT_DataPort at DIO_P5OUT;
sbit TFT_RST at DIO_P6OUT.B0;
sbit TFT_RS at DIO_P6OUT.B1;
sbit TFT_CS at DIO_P6OUT.B2;
sbit TFT_RD at DIO_P6OUT.B3;
sbit TFT_WR at DIO_P6OUT.B4;
char TFT_DataPort_Direction at DIO_P5DIR;
sbit TFT_RST_Direction at DIO_P6DIR.B0;
sbit TFT_RS_Direction at DIO_P6DIR.B1;
sbit TFT_CS_Direction at DIO_P6DIR.B2;
sbit TFT_RD_Direction at DIO_P6DIR.B3;
sbit TFT_WR_Direction at DIO_P6DIR.B4;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_HX8347G(240, 320);

STM32

// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_HX8347G(240, 320);

CEC1x02

// TFT module connections
unsigned char TFT_DataPort at GPIO_OUTPUT_010_017;
sbit TFT_WR at GPIO_OUTPUT_PIN_001_bit;
sbit TFT_RD at GPIO_OUTPUT_PIN_002_bit;
sbit TFT_CS at GPIO_OUTPUT_PIN_003_bit;
sbit TFT_RS at GPIO_OUTPUT_PIN_004_bit;
sbit TFT_RST at GPIO_OUTPUT_PIN_005_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_HX8347G(240, 320);

TFT_Init_R61526

Prototype

void TFT_Init_R61526(unsigned int display_width, unsigned int display_height);

Returns

Nothing.

Description

Initializes R61526 display controller display in the 8-bit working mode for CEC1x02, Stellaris and MSP432 devices and 16-bit working mode for STM32 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example

Stellaris

// TFT module connections
char TFT_DataPort at GPIO_PORTJ_DATA;
sbit TFT_RST at GPIO_PORTH_DATA5_bit;
sbit TFT_RS at GPIO_PORTG_DATA7_bit;
sbit TFT_CS at GPIO_PORTH_DATA6_bit;
sbit TFT_RD at GPIO_PORTC_DATA5_bit;
sbit TFT_WR at GPIO_PORTH_DATA4_bit;
char TFT_DataPort_Direction at GPIO_PORTJ_DIR;
sbit TFT_RST_Direction at GPIO_PORTH_DIR5_bit;
sbit TFT_RS_Direction at GPIO_PORTG_DIR7_bit;
sbit TFT_CS_Direction at GPIO_PORTH_DIR6_bit;
sbit TFT_RD_Direction at GPIO_PORTC_DIR5_bit;
sbit TFT_WR_Direction at GPIO_PORTH_DIR4_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_R61526(240, 320);

MSP432

// TFT module connections
char TFT_DataPort at DIO_P5OUT;
sbit TFT_RST at DIO_P6OUT.B0;
sbit TFT_RS at DIO_P6OUT.B1;
sbit TFT_CS at DIO_P6OUT.B2;
sbit TFT_RD at DIO_P6OUT.B3;
sbit TFT_WR at DIO_P6OUT.B4;
char TFT_DataPort_Direction at DIO_P5DIR;
sbit TFT_RST_Direction at DIO_P6DIR.B0;
sbit TFT_RS_Direction at DIO_P6DIR.B1;
sbit TFT_CS_Direction at DIO_P6DIR.B2;
sbit TFT_RD_Direction at DIO_P6DIR.B3;
sbit TFT_WR_Direction at DIO_P6DIR.B4;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_R61526(240, 320);

STM32

// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_R61526(240, 320);

CEC1x02

// TFT module connections
unsigned char TFT_DataPort at GPIO_OUTPUT_010_017;
sbit TFT_WR at GPIO_OUTPUT_PIN_001_bit;
sbit TFT_RD at GPIO_OUTPUT_PIN_002_bit;
sbit TFT_CS at GPIO_OUTPUT_PIN_003_bit;
sbit TFT_RS at GPIO_OUTPUT_PIN_004_bit;
sbit TFT_RST at GPIO_OUTPUT_PIN_005_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_R61526(240, 320);

TFT_Init_SST7715R

Prototype

void TFT_Init_SST7715R(unsigned int display_width, unsigned int display_height);

Returns

Nothing.

Description

Initializes SST7715R display controller display in the 8-bit working mode for CEC1x02, Stellaris and MSP432 devices and 16-bit working mode for STM32 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example

Stellaris

// TFT module connections
char TFT_DataPort at GPIO_PORTJ_DATA;
sbit TFT_RST at GPIO_PORTH_DATA5_bit;
sbit TFT_RS at GPIO_PORTG_DATA7_bit;
sbit TFT_CS at GPIO_PORTH_DATA6_bit;
sbit TFT_RD at GPIO_PORTC_DATA5_bit;
sbit TFT_WR at GPIO_PORTH_DATA4_bit;
char TFT_DataPort_Direction at GPIO_PORTJ_DIR;
sbit TFT_RST_Direction at GPIO_PORTH_DIR5_bit;
sbit TFT_RS_Direction at GPIO_PORTG_DIR7_bit;
sbit TFT_CS_Direction at GPIO_PORTH_DIR6_bit;
sbit TFT_RD_Direction at GPIO_PORTC_DIR5_bit;
sbit TFT_WR_Direction at GPIO_PORTH_DIR4_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_SST7715R(240, 320);

MSP432

// TFT module connections
char TFT_DataPort at DIO_P5OUT;
sbit TFT_RST at DIO_P6OUT.B0;
sbit TFT_RS at DIO_P6OUT.B1;
sbit TFT_CS at DIO_P6OUT.B2;
sbit TFT_RD at DIO_P6OUT.B3;
sbit TFT_WR at DIO_P6OUT.B4;
char TFT_DataPort_Direction at DIO_P5DIR;
sbit TFT_RST_Direction at DIO_P6DIR.B0;
sbit TFT_RS_Direction at DIO_P6DIR.B1;
sbit TFT_CS_Direction at DIO_P6DIR.B2;
sbit TFT_RD_Direction at DIO_P6DIR.B3;
sbit TFT_WR_Direction at DIO_P6DIR.B4;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_SST7715R(240, 320);

STM32

// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_SST7715R(240, 320);

CEC1x02

// TFT module connections
unsigned char TFT_DataPort at GPIO_OUTPUT_010_017;
sbit TFT_WR at GPIO_OUTPUT_PIN_001_bit;
sbit TFT_RD at GPIO_OUTPUT_PIN_002_bit;
sbit TFT_CS at GPIO_OUTPUT_PIN_003_bit;
sbit TFT_RS at GPIO_OUTPUT_PIN_004_bit;
sbit TFT_RST at GPIO_OUTPUT_PIN_005_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_SST7715R(240, 320);

TFT_Init_HX8352A

Prototype

void TFT_Init_HX8352A(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes HX8352A display controller display in the 16-bit working mode for STM32 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_HX8352A(240, 320);

TFT_Init_ILI9340

Prototype

void TFT_Init_ILI9340(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes ILI9340 display controller display in the 16-bit working mode for STM32 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ILI9340(240, 320);

TFT_Init_ILI9341_16bit

Prototype

void TFT_Init_ILI9341_16bit(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes ILI9341 display controller display in the 16-bit working mode for STM32 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module 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 int display_height) ;

Returns

Nothing.

Description

Initializes ST7789V display controller display in the 16-bit working mode for STM32 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ST7789V_16bit(240, 320);

TFT_Init_ILI9342

Prototype

void TFT_Init_ILI9342(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes ILI9342 display controller display in the 16-bit working mode for STM32 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ILI9342(240, 320);

TFT_Init_ILI9481

Prototype

void TFT_Init_ILI9481(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes ILI9481 display controller display in the 16-bit working mode for STM32 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ILI9481(240, 320);

TFT_Init_SSD1963

Prototype

void TFT_Init_SSD1963(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes SSD1963 display controller display in the 16-bit working mode for STM32 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_SSD1963(240, 320);

TFT_Init_SSD1963_7Inch_800x480

Prototype

void TFT_Init_SSD1963_7Inch_800x480 (unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes SSD1963 display controller for 7" inch displays in the 16-bit working mode.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example

Stellaris

// TFT module connections
char TFT_DataPort at GPIO_PORTJ_DATA;
sbit TFT_RST at GPIO_PORTH_DATA5_bit;
sbit TFT_RS at GPIO_PORTG_DATA7_bit;
sbit TFT_CS at GPIO_PORTH_DATA6_bit;
sbit TFT_RD at GPIO_PORTC_DATA5_bit;
sbit TFT_WR at GPIO_PORTH_DATA4_bit;
char TFT_DataPort_Direction at GPIO_PORTJ_DIR;
sbit TFT_RST_Direction at GPIO_PORTH_DIR5_bit;
sbit TFT_RS_Direction at GPIO_PORTG_DIR7_bit;
sbit TFT_CS_Direction at GPIO_PORTH_DIR6_bit;
sbit TFT_RD_Direction at GPIO_PORTC_DIR5_bit;
sbit TFT_WR_Direction at GPIO_PORTH_DIR4_bit;
// End TFT module connections

// Initialize 800x480 TFT display
TFT_Init_SSD1963_7Inch_800x480(800, 480);

MSP432

// TFT module connections
char TFT_DataPort at DIO_P5OUT;
sbit TFT_RST at DIO_P6OUT.B0;
sbit TFT_RS at DIO_P6OUT.B1;
sbit TFT_CS at DIO_P6OUT.B2;
sbit TFT_RD at DIO_P6OUT.B3;
sbit TFT_WR at DIO_P6OUT.B4;
char TFT_DataPort_Direction at DIO_P5DIR;
sbit TFT_RST_Direction at DIO_P6DIR.B0;
sbit TFT_RS_Direction at DIO_P6DIR.B1;
sbit TFT_CS_Direction at DIO_P6DIR.B2;
sbit TFT_RD_Direction at DIO_P6DIR.B3;
sbit TFT_WR_Direction at DIO_P6DIR.B4;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_SSD1963_7Inch_800x480(240, 320);

STM32

// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 800x480 TFT display
TFT_Init_SSD1963_7Inch_800x480(800, 480);

TFT_Init_HX8347G_16bit

Prototype

void TFT_Init_HX8347G_16bit(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes HX8347G display controller display in the 16-bit working mode for STM32 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_HX8347G_16bit(240, 320);

TFT_Init_SSD1963_8bit

Prototype

void TFT_Init_SSD1963_8bit(unsigned int display_width, unsigned int display_height);

Returns

Nothing.

Description

Initializes SSD1963 display controller display in the 8-bit working mode for CEC1x02, Stellaris, STM32 and MSP432 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example

Stellaris

// TFT module connections
char TFT_DataPort at GPIO_PORTJ_DATA;
sbit TFT_RST at GPIO_PORTH_DATA5_bit;
sbit TFT_RS at GPIO_PORTG_DATA7_bit;
sbit TFT_CS at GPIO_PORTH_DATA6_bit;
sbit TFT_RD at GPIO_PORTC_DATA5_bit;
sbit TFT_WR at GPIO_PORTH_DATA4_bit;
char TFT_DataPort_Direction at GPIO_PORTJ_DIR;
sbit TFT_RST_Direction at GPIO_PORTH_DIR5_bit;
sbit TFT_RS_Direction at GPIO_PORTG_DIR7_bit;
sbit TFT_CS_Direction at GPIO_PORTH_DIR6_bit;
sbit TFT_RD_Direction at GPIO_PORTC_DIR5_bit;
sbit TFT_WR_Direction at GPIO_PORTH_DIR4_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_SSD1963_8bit(240, 320);

MSP432

// TFT module connections
char TFT_DataPort at DIO_P5OUT;
sbit TFT_RST at DIO_P6OUT.B0;
sbit TFT_RS at DIO_P6OUT.B1;
sbit TFT_CS at DIO_P6OUT.B2;
sbit TFT_RD at DIO_P6OUT.B3;
sbit TFT_WR at DIO_P6OUT.B4;
char TFT_DataPort_Direction at DIO_P5DIR;
sbit TFT_RST_Direction at DIO_P6DIR.B0;
sbit TFT_RS_Direction at DIO_P6DIR.B1;
sbit TFT_CS_Direction at DIO_P6DIR.B2;
sbit TFT_RD_Direction at DIO_P6DIR.B3;
sbit TFT_WR_Direction at DIO_P6DIR.B4;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_SSD1963_8bit(240, 320);

STM32

// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_SSD1963_8bit(240, 320);

CEC1x02

// TFT module connections
unsigned char TFT_DataPort at GPIO_OUTPUT_010_017;
sbit TFT_WR at GPIO_OUTPUT_PIN_001_bit;
sbit TFT_RD at GPIO_OUTPUT_PIN_002_bit;
sbit TFT_CS at GPIO_OUTPUT_PIN_003_bit;
sbit TFT_RS at GPIO_OUTPUT_PIN_004_bit;
sbit TFT_RST at GPIO_OUTPUT_PIN_005_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_SSD1963_8bit(240, 320);

TFT_Init_ILI9340_8bit

Prototype

void TFT_Init_ILI9340_8bit(unsigned int display_width, unsigned int display_height);

Returns

Nothing.

Description

Initializes ILI9340 display controller display in the 8-bit working mode for CEC1x02, Stellaris, STM32 and MSP432 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example

Stellaris

// TFT module connections
char TFT_DataPort at GPIO_PORTJ_DATA;
sbit TFT_RST at GPIO_PORTH_DATA5_bit;
sbit TFT_RS at GPIO_PORTG_DATA7_bit;
sbit TFT_CS at GPIO_PORTH_DATA6_bit;
sbit TFT_RD at GPIO_PORTC_DATA5_bit;
sbit TFT_WR at GPIO_PORTH_DATA4_bit;
char TFT_DataPort_Direction at GPIO_PORTJ_DIR;
sbit TFT_RST_Direction at GPIO_PORTH_DIR5_bit;
sbit TFT_RS_Direction at GPIO_PORTG_DIR7_bit;
sbit TFT_CS_Direction at GPIO_PORTH_DIR6_bit;
sbit TFT_RD_Direction at GPIO_PORTC_DIR5_bit;
sbit TFT_WR_Direction at GPIO_PORTH_DIR4_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ILI9340_8bit(240, 320);

MSP432

// TFT module connections
char TFT_DataPort at DIO_P5OUT;
sbit TFT_RST at DIO_P6OUT.B0;
sbit TFT_RS at DIO_P6OUT.B1;
sbit TFT_CS at DIO_P6OUT.B2;
sbit TFT_RD at DIO_P6OUT.B3;
sbit TFT_WR at DIO_P6OUT.B4;
char TFT_DataPort_Direction at DIO_P5DIR;
sbit TFT_RST_Direction at DIO_P6DIR.B0;
sbit TFT_RS_Direction at DIO_P6DIR.B1;
sbit TFT_CS_Direction at DIO_P6DIR.B2;
sbit TFT_RD_Direction at DIO_P6DIR.B3;
sbit TFT_WR_Direction at DIO_P6DIR.B4;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ILI9340_8bit(240, 320);

STM32

// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ILI9340_8bit(240, 320);

CEC1x02

// TFT module connections
unsigned char TFT_DataPort at GPIO_OUTPUT_010_017;
sbit TFT_WR at GPIO_OUTPUT_PIN_001_bit;
sbit TFT_RD at GPIO_OUTPUT_PIN_002_bit;
sbit TFT_CS at GPIO_OUTPUT_PIN_003_bit;
sbit TFT_RS at GPIO_OUTPUT_PIN_004_bit;
sbit TFT_RST at GPIO_OUTPUT_PIN_005_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ILI9340_8bit(240, 320);

TFT_Init_ILI9341_8bit

Prototype

void TFT_Init_ILI9341_8bit(unsigned int display_width, unsigned int display_height);

Returns

Nothing.

Description

Initializes ILI9341 display controller display in the 8-bit working mode for CEC1x02, Stellaris, STM32 and MSP432 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example

Stellaris

// TFT module connections
char TFT_DataPort at GPIO_PORTJ_DATA;
sbit TFT_RST at GPIO_PORTH_DATA5_bit;
sbit TFT_RS at GPIO_PORTG_DATA7_bit;
sbit TFT_CS at GPIO_PORTH_DATA6_bit;
sbit TFT_RD at GPIO_PORTC_DATA5_bit;
sbit TFT_WR at GPIO_PORTH_DATA4_bit;
char TFT_DataPort_Direction at GPIO_PORTJ_DIR;
sbit TFT_RST_Direction at GPIO_PORTH_DIR5_bit;
sbit TFT_RS_Direction at GPIO_PORTG_DIR7_bit;
sbit TFT_CS_Direction at GPIO_PORTH_DIR6_bit;
sbit TFT_RD_Direction at GPIO_PORTC_DIR5_bit;
sbit TFT_WR_Direction at GPIO_PORTH_DIR4_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ILI9341_8bit(240, 320);

MSP432

// TFT module connections
char TFT_DataPort at DIO_P5OUT;
sbit TFT_RST at DIO_P6OUT.B0;
sbit TFT_RS at DIO_P6OUT.B1;
sbit TFT_CS at DIO_P6OUT.B2;
sbit TFT_RD at DIO_P6OUT.B3;
sbit TFT_WR at DIO_P6OUT.B4;
char TFT_DataPort_Direction at DIO_P5DIR;
sbit TFT_RST_Direction at DIO_P6DIR.B0;
sbit TFT_RS_Direction at DIO_P6DIR.B1;
sbit TFT_CS_Direction at DIO_P6DIR.B2;
sbit TFT_RD_Direction at DIO_P6DIR.B3;
sbit TFT_WR_Direction at DIO_P6DIR.B4;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ILI9341_8bit(240, 320);

STM32

// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ILI9341_8bit(240, 320);

CEC1x02

// TFT module connections
unsigned char TFT_DataPort at GPIO_OUTPUT_010_017;
sbit TFT_WR at GPIO_OUTPUT_PIN_001_bit;
sbit TFT_RD at GPIO_OUTPUT_PIN_002_bit;
sbit TFT_CS at GPIO_OUTPUT_PIN_003_bit;
sbit TFT_RS at GPIO_OUTPUT_PIN_004_bit;
sbit TFT_RST at GPIO_OUTPUT_PIN_005_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ILI9341_8bit(240, 320);

TFT_Init_ST7789V_8bit

Prototype

void TFT_Init_ST7789V_8bit(unsigned int display_width, unsigned int display_height);

Returns

Nothing.

Description

Initializes ST7789V display controller display in the 8-bit working mode for CEC1x02, Stellaris, STM32 and MSP432 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example

Stellaris

// TFT module connections
char TFT_DataPort at GPIO_PORTJ_DATA;
sbit TFT_RST at GPIO_PORTH_DATA5_bit;
sbit TFT_RS at GPIO_PORTG_DATA7_bit;
sbit TFT_CS at GPIO_PORTH_DATA6_bit;
sbit TFT_RD at GPIO_PORTC_DATA5_bit;
sbit TFT_WR at GPIO_PORTH_DATA4_bit;
char TFT_DataPort_Direction at GPIO_PORTJ_DIR;
sbit TFT_RST_Direction at GPIO_PORTH_DIR5_bit;
sbit TFT_RS_Direction at GPIO_PORTG_DIR7_bit;
sbit TFT_CS_Direction at GPIO_PORTH_DIR6_bit;
sbit TFT_RD_Direction at GPIO_PORTC_DIR5_bit;
sbit TFT_WR_Direction at GPIO_PORTH_DIR4_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ST7789V_8bit(240, 320);

MSP432

// TFT module connections
char TFT_DataPort at DIO_P5OUT;
sbit TFT_RST at DIO_P6OUT.B0;
sbit TFT_RS at DIO_P6OUT.B1;
sbit TFT_CS at DIO_P6OUT.B2;
sbit TFT_RD at DIO_P6OUT.B3;
sbit TFT_WR at DIO_P6OUT.B4;
char TFT_DataPort_Direction at DIO_P5DIR;
sbit TFT_RST_Direction at DIO_P6DIR.B0;
sbit TFT_RS_Direction at DIO_P6DIR.B1;
sbit TFT_CS_Direction at DIO_P6DIR.B2;
sbit TFT_RD_Direction at DIO_P6DIR.B3;
sbit TFT_WR_Direction at DIO_P6DIR.B4;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ST7789V_8bit(240, 320);

STM32

// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ST7789V_8bit(240, 320);

CEC1x02

// TFT module connections
unsigned char TFT_DataPort at GPIO_OUTPUT_010_017;
sbit TFT_WR at GPIO_OUTPUT_PIN_001_bit;
sbit TFT_RD at GPIO_OUTPUT_PIN_002_bit;
sbit TFT_CS at GPIO_OUTPUT_PIN_003_bit;
sbit TFT_RS at GPIO_OUTPUT_PIN_004_bit;
sbit TFT_RST at GPIO_OUTPUT_PIN_005_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ST7789V_8bit(240, 320);

TFT_Init_ILI9481_8bit

Prototype

void TFT_Init_ILI9481_8bit(unsigned int display_width, unsigned int display_height);

Returns

Nothing.

Description

Initializes ILI9481 display controller display in the 8-bit working mode for CEC1x02, Stellaris, STM32 and MSP432 devices.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example

Stellaris

// TFT module connections
char TFT_DataPort at GPIO_PORTJ_DATA;
sbit TFT_RST at GPIO_PORTH_DATA5_bit;
sbit TFT_RS at GPIO_PORTG_DATA7_bit;
sbit TFT_CS at GPIO_PORTH_DATA6_bit;
sbit TFT_RD at GPIO_PORTC_DATA5_bit;
sbit TFT_WR at GPIO_PORTH_DATA4_bit;
char TFT_DataPort_Direction at GPIO_PORTJ_DIR;
sbit TFT_RST_Direction at GPIO_PORTH_DIR5_bit;
sbit TFT_RS_Direction at GPIO_PORTG_DIR7_bit;
sbit TFT_CS_Direction at GPIO_PORTH_DIR6_bit;
sbit TFT_RD_Direction at GPIO_PORTC_DIR5_bit;
sbit TFT_WR_Direction at GPIO_PORTH_DIR4_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ILI9481_8bit(240, 320);

MSP432

// TFT module connections
char TFT_DataPort at DIO_P5OUT;
sbit TFT_RST at DIO_P6OUT.B0;
sbit TFT_RS at DIO_P6OUT.B1;
sbit TFT_CS at DIO_P6OUT.B2;
sbit TFT_RD at DIO_P6OUT.B3;
sbit TFT_WR at DIO_P6OUT.B4;
char TFT_DataPort_Direction at DIO_P5DIR;
sbit TFT_RST_Direction at DIO_P6DIR.B0;
sbit TFT_RS_Direction at DIO_P6DIR.B1;
sbit TFT_CS_Direction at DIO_P6DIR.B2;
sbit TFT_RD_Direction at DIO_P6DIR.B3;
sbit TFT_WR_Direction at DIO_P6DIR.B4;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ILI9481_8bit(240, 320);

STM32

// TFT module connections
unsigned int TFT_DataPort at GPIOD_ODR; 
sbit TFT_WR at GPIOE_ODR.B9; 
sbit TFT_RD at GPIOE_ODR.B10; 
sbit TFT_CS at GPIOE_ODR.B12; 
sbit TFT_RS at GPIOE_ODR.B8; 
sbit TFT_RST at GPIOE_ODR.B13; 
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ILI9481_8bit(240, 320);

CEC1x02

// TFT module connections
unsigned char TFT_DataPort at GPIO_OUTPUT_010_017;
sbit TFT_WR at GPIO_OUTPUT_PIN_001_bit;
sbit TFT_RD at GPIO_OUTPUT_PIN_002_bit;
sbit TFT_CS at GPIO_OUTPUT_PIN_003_bit;
sbit TFT_RS at GPIO_OUTPUT_PIN_004_bit;
sbit TFT_RST at GPIO_OUTPUT_PIN_005_bit;
// End TFT module connections

// Initialize 240x320 TFT display
TFT_Init_ILI9481_8bit(240, 320);

TFT_Init_Custom

Prototype

void TFT_Init_Custom(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes HX8347-D display controller display in the 8-bit working mode for CEC1x02, Stellaris and MSP432 devices and 16-bit working mode for STM32 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_Custom(240, 320);

TFT_Init_HX8347G_Custom

Prototype

void TFT_Init_HX8347G_Custom(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes HX8347-G display controller display in the 8-bit working mode for CEC1x02, Stellaris, STM32 and MSP432 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_HX8347G_Custom(240, 320);

TFT_Init_R61526_Custom

Prototype

void TFT_Init_R61526_Custom(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes R61526 display controller display in the 8-bit working mode for CEC1x02, Stellaris and MSP432 devices and 16-bit working mode for STM32 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_R61526_Custom(240, 320);

TFT_Init_SST7715R_Custom

Prototype

void TFT_Init_SST7715R_Custom(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes SST7715R display controller display in the 8-bit working mode for CEC1x02, Stellaris and MSP432 devices and 16-bit working mode for STM32 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_SST7715R_Custom(240, 320);

TFT_Init_HX8352A_Custom

Prototype

void TFT_Init_HX8352A_Custom(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes HX8352A display controller display in the 16-bit working mode for STM32 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_HX8352A_Custom(240, 320);

TFT_Init_ILI9340_Custom

Prototype

void TFT_Init_ILI9340_Custom(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes ILI9340 display controller display in the 16-bit working mode for STM32 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_ILI9340_Custom(240, 320);

TFT_Init_ILI9341_16bit_Custom

Prototype

void TFT_Init_ILI9341_16bit_Custom(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes ILI9341 display controller display in the 16-bit working mode for STM32 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_ILI9341_16bit_Custom(240, 320);

TFT_Init_ST7789V_16bit_Custom

Prototype

void TFT_Init_ST7789V_16bit_Custom(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes ST7789V display controller display in the 16-bit working mode for STM32 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_ST7789V_16bit_Custom(240, 320);

TFT_Init_ILI9342_Custom

Prototype

void TFT_Init_ILI9342_Custom(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes ILI9342 display controller display in the 16-bit working mode for STM32 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_ILI9342_Custom(240, 320);

TFT_Init_ILI9481_Custom

Prototype

void TFT_Init_ILI9481_Custom(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes ILI9481 display controller display in the 16-bit working mode for STM32 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_ILI9481_Custom(240, 320);

TFT_Init_SSD1963_Custom

Prototype

void TFT_Init_SSD1963_Custom(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes SSD1963 display controller display in the 16-bit working mode for STM32 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_SSD1963_Custom(240, 320);

TFT_Init_SSD1963_7Inch_800x480_Custom

Prototype

void TFT_Init_SSD1963_7Inch_800x480_Custom (unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes SSD1963 display controller for 7" inch displays in the 16-bit working mode without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 800x480 TFT display
TFT_Init_SSD1963_7Inch_800x480_Custom(800, 480);

TFT_Init_HX8347G_16bit_Custom

Prototype

void TFT_Init_HX8347G_16bit_Custom(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes HX8347G display controller display in the 16-bit working mode for STM32 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_HX8347G_16bit_Custom(240, 320);

TFT_Init_SSD1963_8bit_Custom

Prototype

void TFT_Init_SSD1963_8bit_Custom(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes SSD1963 display controller display in the 8-bit working mode CEC1x02, Stellaris, STM32 and MSP432 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_SSD1963_8bit_Custom(240, 320);

TFT_Init_ILI9340_8bit_Custom

Prototype

void TFT_Init_ILI9340_8bit_Custom(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes ILI9340 display controller display in the 8-bit working mode for CEC1x02, Stellaris, STM32 and MSP432 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_ILI9340_8bit_Custom(240, 320);

TFT_Init_ILI9341_8bit_Custom

Prototype

void TFT_Init_ILI9341_8bit_Custom(unsigned int display_width, unsigned int display_height);

Returns

Nothing.

Description

Initializes ILI9341 display controller display in the 8-bit working mode for CEC1x02, Stellaris, STM32 and MSP432 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_ILI9341_8bit_Custom(240, 320);

TFT_Init_ST7789V_8bit_Custom

Prototype

void TFT_Init_ST7789V_8bit_Custom(unsigned int display_width, unsigned int display_height);

Returns

Nothing.

Description

Initializes ST7789V display controller display in the 8-bit working mode for CEC1x02, Stellaris, STM32 and MSP432 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_ST7789V_8bit_Custom(240, 320);

TFT_Init_ILI9481_8bit_Custom

Prototype

void TFT_Init_ILI9481_8bit_Custom(unsigned int display_width, unsigned int display_height) ;

Returns

Nothing.

Description

Initializes ILI9481 display controller display in the 8-bit working mode for CEC1x02, Stellaris, STM32 and MSP432 devices without setting TFT_DataPort direction.
This routine should be used when calls to custom TFT routines are used, must be used with TFT_Set_Active routine.

Parameters :

  • width: width of the TFT panel
  • height: height of the TFT panel
Requires

External dependencies of the library from the top of the page must be defined before using this function.

Example
// Set custom working mode
TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

// Initialize 240x320 TFT display
TFT_Init_ILI9481_8bit_Custom(240, 320);

TFT_Set_Index

Prototype

void TFT_Set_Index(unsigned short index);

Returns

Nothing.

Description

Accesses register space of the controller and sets the desired register.

Parameters :

  • index: desired register number.
Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
// Access register at the location 0x02
TFT_Set_Index(0x02);

TFT_SSD1963_8bit_Set_Index

Prototype

void TFT_SSD1963_8bit_Set_Index(unsigned short index);

Returns

Nothing.

Description

Accesses register space of the SSD1963 controller and sets the desired register.

Parameters :

  • index: desired register number.
Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
// Access register at the location 0x02
TFT_SSD1963_8bit_Set_Index(0x02);

TFT_Write_Command

Prototype

void TFT_Write_Command(unsigned short cmd);

Returns

Nothing.

Description

Accesses data space and writes a command.

Parameters :

  • cmd: command to be written.

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
// Write a command
TFT_Write_Command(0x02);

TFT_SSD1963YT_8bit_Write_Command

Prototype

void TFT_SSD1963YT_8bit_Write_Command(unsigned short cmd);

Returns

Nothing.

Description

Accesses data space of SSD1963YT and writes a command.

Parameters :

  • cmd: command to be written.

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
// Write a command
TFT_SSD1963YT_8bit_Write_Command(0x02);

TFT_Write_Data

Prototype

void TFT_Write_Data(unsigned int _data);

Returns

Nothing.

Description

Writes date into display memory.

Parameters :

  • _data:data to be written.

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
// Send data
TFT_Write_Data(0x02);

TFT_SSD1963_8bit_Write_Data

Prototype

void TFT_SSD1963_8bit_Write_Data(unsigned int _data);

Returns

Nothing.

Description

Writes date into display memory of SSD1963.

Parameters :

  • _data:data to be written.

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
// Send data
TFT_SSD1963_8bit_Write_Data(0x02);

TFT_Set_Reg

Prototype

void TFT_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 :

  • index: desired register.
  • value: value to be written.

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
// 65K Color Selection
TFT_Set_Reg(0x17, 0x05);

TFT_SSD1963_8bit_Set_Reg

Prototype

void TFT_SSD1963_8bit_Set_Reg(unsigned short index, unsigned short value);

Returns

Nothing.

Description

Accesses register space of the SSD1963 controller and writes a value in the desired register.

Parameters :

  • index: desired register.
  • value: value to be written.

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
// 65K Color Selection
TFT_SSD1963_8bit_Set_Reg(0x17, 0x05);

TFT_Set_DBC_SSD1963

Prototype

void TFT_Set_DBC_SSD1963(unsigned char value);

Returns

Nothing.

Description

This function sets duty ratio of SSD1963's internal PWM backlight generator.

Parameters :

  • value: internal PWM backlight generator duty value. Range should be 0-255, where 0 is dimmest and 255 brightest backlight.

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
// Set SSD1963 backlight
TFT_Set_DBC_SSD1963(0xFF);

TFT_Set_Ext_Buffer

Prototype

void TFT_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 :

  • offset - offset from the beginning of the resource from where the data is requested.
  • count - requested number of bytes.
  • num - variable for holding the returned number of bytes (less or equal to the number of acquired bytes).
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_Set_Ext_Buffer(ReadExternalBuffer);

TFT_Set_Active

Prototype

void TFT_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 :

  • Set_Index_Ptr: Set_Index handler.
  • Write_Command_Ptr: _Write_Command handler.
  • Write_Data_Ptr: Write_Data handler.
Requires

None.

Example

Stellaris 8-bit

void TFT_Set_Index_Custom(unsigned short index) {
  TFT_RS = 0;
  
  // Write to port
  TFT_DataPort = index;
  
  // Strobe
  TFT_WR = 0;
  asm nop;
  TFT_WR = 1;
}

void TFT_Write_Command_Custom(unsigned short cmd) {
  TFT_RS = 1;
  
  // Write to port
  TFT_DataPort = cmd;
  
  // Strobe
  TFT_WR = 0;
  asm nop;
  TFT_WR = 1;
}

void TFT_Write_Data_Custom(unsigned int _data) {
  TFT_RS = 1;
  
  // Write to port
  TFT_DataPort = Hi(_data);
  
  // Strobe
  TFT_WR = 0;
  asm nop;
  TFT_WR = 1;

  // Write to port
  TFT_DataPort = Lo(_data);
  
  // Strobe
  TFT_WR = 0;
  asm nop;
  TFT_WR = 1;
}

TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

STM32 8-bit

void TFT_Set_Index_Custom(unsigned short index) {
unsigned int temp;
  TFT_RS = 0;

  // Write to port
  temp = TFT_DataPort;
  temp &= 0xFF00;
  TFT_DataPort = index | temp;
  
  // Strobe
  TFT_WR = 0;
  asm nop;
  TFT_WR = 1;
}

void TFT_Write_Command_Custom(unsigned short cmd) {
unsigned int temp;
  TFT_RS = 1;
  
  // Write to port
  temp = TFT_DataPort;
  temp &= 0xFF00;
  TFT_DataPort = cmd | temp;
  
  // Strobe
  TFT_WR = 0;
  asm nop;
  TFT_WR = 1;
}

void TFT_Write_Data_Custom(unsigned int _data) {
unsigned int temp;
  TFT_RS = 1;

  // Write to port  
  temp = TFT_DataPort;
  temp &= 0xFF00;
  TFT_DataPort = Hi(_data) | temp;

  // Strobe
  TFT_WR = 0;
  asm nop;
  TFT_WR = 1;
  
  // Write to port
  temp = TFT_DataPort;
  temp &= 0xFF00;
  TFT_DataPort = Lo(_data) | temp;
  
  // Strobe
  TFT_WR = 0;
  asm nop;
  TFT_WR = 1;
}

TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_Custom);

STM32 16-bit

void TFT_Set_Index_Custom(unsigned short index) {
unsigned int temp;
  TFT_RS = 0;

  // Write to port
  temp = TFT_DataPort;
  temp &= 0xFF00;
  TFT_DataPort = index | temp;
  
  // Strobe
  TFT_WR = 0;
  asm nop;
  TFT_WR = 1;
}

void TFT_Write_Command_Custom(unsigned short cmd) {
unsigned int temp;
  TFT_RS = 1;
  
  // Write to port
  temp = TFT_DataPort;
  temp &= 0xFF00;
  TFT_DataPort = cmd | temp;

  // Strobe
  TFT_WR = 0;
  asm nop;
  TFT_WR = 1;
}

void TFT_Write_Data_16bit_Custom(unsigned int _data) {
  TFT_RS = 1;

  // Write to 16-bit port
  TFT_DataPort = _data;
  
  // Strobe
  TFT_WR = 0;
  asm nop;
  TFT_WR = 1;
}

TFT_Set_Active(&TFT_Set_Index_Custom, &TFT_Write_Command_Custom, &TFT_Write_Data_16bit_Custom);

TFT_Set_Default_Mode

Prototype

void TFT_Set_Default_Mode();

Returns

Nothing.

Description

This procedure sets TFT in default working mode.

Parameters :

  • None.
Requires

None.

Example
TFT_Set_Default_Mode();
TFT_Init(320, 240);

TFT_Set_Font

Prototype

void TFT_Set_Font(const char far *activeFont, unsigned int font_color, char font_orientation);

Returns

Nothing.

Description

Sets font, its color and font orientation.

Parameters :

  • activeFont: desired font. Currently, only TFT_defaultFont (Tahoma14x16) is supported.
  • font_color: sets font color :

    Value Description
    CL_AQUA Aqua color
    CL_BLACK Black color
    CL_BLUE Blue color
    CL_FUCHSIA Fuchsia color
    CL_GRAY Gray color
    CL_GREEN Green color
    CL_LIME Lime color
    CL_MAROON Maroon color
    CL_NAVY Navy color
    CL_OLIVE Olive color
    CL_PURPLE Purple color
    CL_RED Red color
    CL_SILVER Silver color
    CL_TEAL Teal color
    CL_WHITE White color
    CL_YELLOW Yellow color

  • font_orientation: sets font orientation :

    Value Description
    FO_HORIZONTAL Horizontal orientation
    FO_VERTICAL Vertical orientation
    FO_VERTICAL_COLUMN Vertical column orientation

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
TFT_Set_Font(TFT_defaultFont, CL_BLACK, FO_HORIZONTAL);

TFT_Set_Ext_Font

Prototype

void TFT_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 :

  • activeFont: desired font. This parameter represents the address in the exteral resource from where the font data begins.
  • font_color: sets font color :

    Value Description
    CL_AQUA Aqua color
    CL_BLACK Black color
    CL_BLUE Blue color
    CL_FUCHSIA Fuchsia color
    CL_GRAY Gray color
    CL_GREEN Green color
    CL_LIME Lime color
    CL_MAROON Maroon color
    CL_NAVY Navy color
    CL_OLIVE Olive color
    CL_PURPLE Purple color
    CL_RED Red color
    CL_SILVER Silver color
    CL_TEAL Teal color
    CL_WHITE White color
    CL_YELLOW Yellow color

  • font_orientation: sets font orientation :

    Value Description
    FO_HORIZONTAL Horizontal orientation
    FO_VERTICAL Vertical orientation
    FO_VERTICAL_COLUMN Vertical column orientation

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
TFT_Set_Ext_Font(173296,CL_BLACK,FO_HORIZONTAL);

TFT_Write_Char

Prototype

void TFT_Write_Char(unsigned int c, unsigned int x, unsigned int y);

Returns

Nothing.

Description

Writes a char on the TFT at coordinates (x, y).

  • c: char to be written.
  • x: char position on x-axis.
  • y: char position on y-axis.
Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
TFT_Write_Char('A',22,23);

TFT_Write_Text

Prototype

void TFT_Write_Text(unsigned char *text, unsigned int x, unsigned int y);

Returns

Nothing.

Description

Writes text on the TFT at coordinates (x, y).

Parameters :

  • text: text to be written.
  • x: text position on x-axis.
  • y: text position on y-axis.
Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
TFT_Write_Text("TFT LIBRARY DEMO, WELCOME !", 0, 0);	

TFT_Fill_Screen

Prototype

void TFT_Fill_Screen(unsigned int color);

Returns

Nothing.

Description

Fills screen memory block with given color.

Parameters :

  • color: color to be filled :

    Value Description
    CL_AQUA Aqua color
    CL_BLACK Black color
    CL_BLUE Blue color
    CL_FUCHSIA Fuchsia color
    CL_GRAY Gray color
    CL_GREEN Green color
    CL_LIME Lime color
    CL_MAROON Maroon color
    CL_NAVY Navy color
    CL_OLIVE Olive color
    CL_PURPLE Purple color
    CL_RED Red color
    CL_SILVER Silver color
    CL_TEAL Teal color
    CL_WHITE White color
    CL_YELLOW Yellow color

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
TFT_Fill_Screen(CL_BLACK);

TFT_Dot

Prototype

void TFT_Dot(int x, int y, unsigned int color);

Returns

Nothing.

Description

Draws a dot on the TFT at coordinates (x, y).

Parameters :

  • x: dot position on x-axis.
  • y: dot position on y-axis.
  • color: color parameter. Valid values :

    Value Description
    CL_AQUA Aqua color
    CL_BLACK Black color
    CL_BLUE Blue color
    CL_FUCHSIA Fuchsia color
    CL_GRAY Gray color
    CL_GREEN Green color
    CL_LIME Lime color
    CL_MAROON Maroon color
    CL_NAVY Navy color
    CL_OLIVE Olive color
    CL_PURPLE Purple color
    CL_RED Red color
    CL_SILVER Silver color
    CL_TEAL Teal color
    CL_WHITE White color
    CL_YELLOW Yellow color

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
TFT_Dot(50, 50, CL_BLACK);

TFT_Set_Pen

Prototype

void TFT_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 :

  • pen_color: Sets color.

    Value Description
    CL_AQUA Aqua color
    CL_BLACK Black color
    CL_BLUE Blue color
    CL_FUCHSIA Fuchsia color
    CL_GRAY Gray color
    CL_GREEN Green color
    CL_LIME Lime color
    CL_MAROON Maroon color
    CL_NAVY Navy color
    CL_OLIVE Olive color
    CL_PURPLE Purple color
    CL_RED Red color
    CL_SILVER Silver color
    CL_TEAL Teal color
    CL_WHITE White color
    CL_YELLOW Yellow color

  • pen_width: sets thickness.

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
TFT_Set_Pen(CL_BLACK, 10);

TFT_Set_Brush

Prototype

void TFT_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 :

  • brush_enabled: enable brush fill.

    Value Description
    1 Enable brush fill.
    0 Disable brush fill.

  • brush_color: set brush fill color.

    Value Description
    CL_AQUA Aqua color
    CL_BLACK Black color
    CL_BLUE Blue color
    CL_FUCHSIA Fuchsia color
    CL_GRAY Gray color
    CL_GREEN Green color
    CL_LIME Lime color
    CL_MAROON Maroon color
    CL_NAVY Navy color
    CL_OLIVE Olive color
    CL_PURPLE Purple color
    CL_RED Red color
    CL_SILVER Silver color
    CL_TEAL Teal color
    CL_WHITE White color
    CL_YELLOW Yellow color

  • gradient_enabled: enable gradient

    Value Description
    1 Enable gradient.
    0 Disable gradient.

  • gradient_orientation: sets gradient orientation :

    Value Description
    LEFT_TO_RIGHT Left to right gradient orientation
    TOP_TO_BOTTOM Top to bottom gradient orientation

  • gradient_color_from: sets the starting gradient color.

    Value Description
    CL_AQUA Aqua color
    CL_BLACK Black color
    CL_BLUE Blue color
    CL_FUCHSIA Fuchsia color
    CL_GRAY Gray color
    CL_GREEN Green color
    CL_LIME Lime color
    CL_MAROON Maroon color
    CL_NAVY Navy color
    CL_OLIVE Olive color
    CL_PURPLE Purple color
    CL_RED Red color
    CL_SILVER Silver color
    CL_TEAL Teal color
    CL_WHITE White color
    CL_YELLOW Yellow color

  • gradient_color_to: sets the ending gradient color.

    Value Description
    CL_AQUA Aqua color
    CL_BLACK Black color
    CL_BLUE Blue color
    CL_FUCHSIA Fuchsia color
    CL_GRAY Gray color
    CL_GREEN Green color
    CL_LIME Lime color
    CL_MAROON Maroon color
    CL_NAVY Navy color
    CL_OLIVE Olive color
    CL_PURPLE Purple color
    CL_RED Red color
    CL_SILVER Silver color
    CL_TEAL Teal color
    CL_WHITE White color
    CL_YELLOW Yellow color

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_Set_Brush(0, 0, 1, LEFT_TO_RIGHT, CL_BLACK, CL_WHITE);

TFT_Line

Prototype

void TFT_Line(int x1, int y1, int x2, int y2);

Returns

Nothing.

Description

Draws a line from (x1, y1) to (x2, y2).

Parameters :

  • x1: x coordinate of the line start.
  • y1: y coordinate of the line end.
  • x2: x coordinate of the line start.
  • y2: y coordinate of the line end.

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
TFT_Line(0, 0, 239, 127);

TFT_H_Line

Prototype

void TFT_H_Line(int x_start, int x_end, int y_pos);

Returns

Nothing.

Description

Draws a horizontal line on TFT.

Parameters :

  • x_start: x coordinate of the line start.
  • x_end: x coordinate of the line end.
  • y_pos: y coordinate of horizontal line.

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_H_Line(10, 50, 20);

TFT_V_Line

Prototype

void TFT_V_Line(int y_start, int y_end, int x_pos);

Returns

Nothing.

Description

Draws a vertical line on TFT.

Parameters :

  • y_start: y coordinate of the line start.
  • y_end: y coordinate of the line end.
  • x_pos: x coordinate of vertical line.

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_V_Line(5, 25, 10);

TFT_Rectangle

Prototype

void TFT_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 :

  • x_upper_left: x coordinate of the upper left rectangle corner.
  • y_upper_left: y coordinate of the upper left rectangle corner.
  • x_bottom_right: x coordinate of the lower right rectangle corner.
  • y_bottom_right: y coordinate of the lower right rectangle corner.

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
TFT_Rectangle(20, 20, 219, 107);

TFT_Rectangle_Round_Edges

Prototype

void TFT_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 :

  • x_upper_left: x coordinate of the upper left rectangle corner.
  • y_upper_left: y coordinate of the upper left rectangle corner.
  • x_bottom_right: x coordinate of the lower right rectangle corner.
  • y_bottom_right: y coordinate of the lower right rectangle corner.
  • round_radius: radius of the rounded edge.

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
TFT_Rectangle_Round_Edges(20, 20, 219, 107, 12);

TFT_Circle

Prototype

void TFT_Circle(int x_center, int y_center, int radius);

Returns

Nothing.

Description

Draws a circle on TFT.

Parameters :

  • x: x coordinate of the circle center.
  • y: y coordinate of the circle center.
  • r: radius size.

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
TFT_Circle(120, 64, 110);

TFT_Image

Prototype

void TFT_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 :

  • left: position of the image's left edge.
  • top:position of the image's top edge.
  • image: image to be displayed. Bitmap array is located in code memory.
  • stretch: stretches image by a given factor (if 2, it will double the image.).
Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
TFT_Image(0, 0, image, 1);

TFT_Ext_Image

Prototype

void TFT_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 :

  • left: position of the image's left edge.
  • top:position of the image's top edge.
  • image: image to be displayed. This parameter represents the address in the exteral resource from where the image data begins.
  • stretch: stretches image by a given factor (if 2, it will double the image.).
Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
TFT_Image(0, 0, 153608, 1);

TFT_Partial_Image

Prototype

void TFT_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 :

  • left: left coordinate of the image.
  • top: top coordinate of the image.
  • width: desired image width.
  • height: desired image height.
  • image: image to be displayed. Bitmap array is located in code memory.
  • stretch: stretches image by a given factor (if 2, it will double the image.).

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_Partial_Image(10, 12, 10, 15, image, 1);

TFT_Ext_Partial_Image

Prototype

void TFT_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 :

  • left: left coordinate of the image.
  • top: top coordinate of the image.
  • width: desired image width.
  • height: desired image height.
  • image: image to be displayed. This parameter represents the address in the exteral resource from where the image data begins.
  • stretch: stretches image by a given factor (if 2, it will double the image.).

Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
TFT_Ext_Partial_Image(159,0,160,120,0,1);

TFT_Image_Jpeg

Prototype

char TFT_Image_Jpeg(unsigned int left, unsigned int top, code const far unsigned short *image);

Returns
  • 0 - if image is loaded and displayed successfully.
  • 1 - if error occured.
Description

Displays a JPEG image on a desired location.

Parameters :

  • left: left coordinate of the image.
  • top: top coordinate of the image.
  • image: image to be displayed. Bitmap array is located in code memory.
Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
TFT_Image_Jpeg(0, 0, image);

TFT_RGBToColor16bit

Prototype

unsigned int TFT_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 :

  • rgb_red: red component of the image.
  • rgb_green: green component of the image.
  • rgb_blue: blue component of the image.
Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
color16 = TFT_RGBToColor16bit(150, 193, 65);

TFT_Color16bitToRGB

Prototype

void TFT_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 :

  • color: true color to be converted.
  • rgb_red: red component of the input color.
  • rgb_green: green component of the input color.
  • rgb_blue: blue component of the input color.
Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
TFT_Color16bitToRGB(start_color, &red_start, &green_start, &blue_start);

TFT_Rotate_180

Prototype

void TFT_Rotate_180(char rotate);

Returns

Nothing.

Description

Rotates the TFT display.

Parameters :

  • rotate: parameter for rotating display. Valid values :
    • 0 - display will not be rotated.
    • 1 - display will be rotated for 180 degrees.
Requires

TFT module needs to be initialized. Please, see appropriate TFT initialization routine.

Example
// Rotate TFT display for 180 degrees
TFT_Rotate_180(1);

// Initialize TFT display
TFT_Init(240, 320);
Copyright (c) 2002-2019 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code