Uses the same fonts as the SPI_TFT_ILI9341 Library (I have many, and a html/php font editor for that)

Embed: (wiki syntax)

« Back to documentation index

TFT_22_ILI9225 Class Reference

TFT_22_ILI9225 Class Reference

Main and core class. More...

#include <SPI_TFT_ILI9225.h>

Public Member Functions

 TFT_22_ILI9225 (PinName sdi, PinName clk, PinName cs, PinName rs, PinName rst, PinName led, const char *name)
 Constructor.
void init (void)
 Initialization.
void cls (void)
 Clear the screen.
void fill (uint16_t color)
 Fill the screen with color.
void invert (bool flag)
 Invert screen.
void setBacklight (double brightness)
 Set backlight brightness.
void setBacklightOff (void)
 Switch backlight off.
void setBacklightOn (void)
 Switch backlight on.
void setDisplay (bool flag)
 Switch display on or off.
void setOrientation (uint8_t orientation)
 Set orientation.
uint8_t getOrientation (void)
 Get orientation.
void pixel (uint16_t x1, uint16_t y1, uint16_t color)
 Draw pixel.
void line (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
 Draw line, rectangle coordinates.
void hline (uint16_t x1, uint16_t x2, uint16_t y, uint16_t color)
 Draw hline, rectangle coordinates.
void vline (uint16_t x, uint16_t y1, uint16_t y2, uint16_t color)
 Draw vline, rectangle coordinates.
void rect (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
 Draw rectangle, rectangle coordinates.
void fillrect (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
 Draw solid rectangle, rectangle coordinates.
void circle (uint16_t x0, uint16_t y0, uint16_t radius, uint16_t color)
 Draw circle.
void fillcircle (uint8_t x0, uint8_t y0, uint8_t radius, uint16_t color)
 Draw solid circle.
void triangle (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t x3, uint16_t y3, uint16_t color)
 Draw triangle, triangle coordinates.
void filltriangle (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t x3, uint16_t y3, uint16_t color)
 Draw solid triangle, triangle coordinates.
void roundrect (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t rad, bool fill, uint16_t color)
 Draw line/filled rectangle, rectangle coordinates.
uint16_t maxX (void)
 Screen size, x-axis.
uint16_t maxY (void)
 Screen size, y-axis.
uint16_t width (void)
 Screen size, x-axis.
uint16_t height (void)
 Screen size, y-axis.
uint16_t setColor (uint8_t red, uint8_t green, uint8_t blue)
 Calculate 16-bit color from 8-bit Red-Green-Blue components.
void splitColor (uint16_t rgb, uint8_t &red, uint8_t &green, uint8_t &blue)
 Calculate 8-bit Red-Green-Blue components from 16-bit color.
void setFont (uint8_t *font)
 Set current font.
uint8_t fontX (void)
 Font size, x-axis.
uint8_t fontY (void)
 Font size, y-axis.
virtual int putc (int value)
 put a char on the screen
void character (int x, int y, int c)
 draw a character on given position out of the active font to the TFT
uint16_t getStringWidth (char *s)
 get string width
void foreground (uint16_t color)
 Set text foreground color.
void background (uint16_t color)
 Set text background color.
void locate (int x, int y)
 Set grapical cursor position.
void gotoxy (int x, int y)
 Set text cursor position.
void home (void)
 Set text cursor at 0,0.
void linespacing (int line_spacing)
 Set spacing in pixels between text lines.
virtual int columns (void)
 calculate the max number of char in a line
virtual int rows (void)
 calculate the max number of columns
void unicode2ascii (char *uni_str, char *ascii_str)
 Make an ascii string from an unicode string.
virtual bool claim (FILE *stream)
 Claim standard output.

Detailed Description

Main and core class.

Definition at line 106 of file SPI_TFT_ILI9225.h.


Constructor & Destructor Documentation

TFT_22_ILI9225 ( PinName  sdi,
PinName  clk,
PinName  cs,
PinName  rs,
PinName  rst,
PinName  led,
const char *  name 
)

Constructor.

Definition at line 26 of file SPI_TFT_ILI9225.cpp.


Member Function Documentation

void background ( uint16_t  color )

Set text background color.

Parameters:
color

Definition at line 685 of file SPI_TFT_ILI9225.cpp.

void character ( int  x,
int  y,
int  c 
)

draw a character on given position out of the active font to the TFT

Parameters:
xx-position of char (top left)
yy-position
cchar to print

Definition at line 606 of file SPI_TFT_ILI9225.cpp.

void circle ( uint16_t  x0,
uint16_t  y0,
uint16_t  radius,
uint16_t  color 
)

Draw circle.

Parameters:
x0center, point coordinate, x-axis
y0center, point coordinate, y-axis
radiusradius
color16-bit color

Definition at line 340 of file SPI_TFT_ILI9225.cpp.

bool claim ( FILE *  stream ) [virtual]

Claim standard output.

Definition at line 777 of file SPI_TFT_ILI9225.cpp.

void cls ( void   )

Clear the screen.

Definition at line 127 of file SPI_TFT_ILI9225.cpp.

int columns ( void   ) [virtual]

calculate the max number of char in a line

Returns:
max columns depends on actual font size

Definition at line 712 of file SPI_TFT_ILI9225.cpp.

void fill ( uint16_t  color )

Fill the screen with color.

Parameters:
color

Definition at line 142 of file SPI_TFT_ILI9225.cpp.

void fillcircle ( uint8_t  x0,
uint8_t  y0,
uint8_t  radius,
uint16_t  color 
)

Draw solid circle.

Parameters:
x0center, point coordinate, x-axis
y0center, point coordinate, y-axis
radiusradius
color16-bit color

Definition at line 374 of file SPI_TFT_ILI9225.cpp.

void fillrect ( uint16_t  x1,
uint16_t  y1,
uint16_t  x2,
uint16_t  y2,
uint16_t  color 
)

Draw solid rectangle, rectangle coordinates.

Parameters:
x1top left coordinate, x-axis
y1top left coordinate, y-axis
x2bottom right coordinate, x-axis
y2bottom right coordinate, y-axis
color16-bit color

Definition at line 330 of file SPI_TFT_ILI9225.cpp.

void filltriangle ( uint16_t  x1,
uint16_t  y1,
uint16_t  x2,
uint16_t  y2,
uint16_t  x3,
uint16_t  y3,
uint16_t  color 
)

Draw solid triangle, triangle coordinates.

Parameters:
x1corner 1 coordinate, x-axis
y1corner 1 coordinate, y-axis
x2corner 2 coordinate, x-axis
y2corner 2 coordinate, y-axis
x3corner 3 coordinate, x-axis
y3corner 3 coordinate, y-axis
color16-bit color

Definition at line 407 of file SPI_TFT_ILI9225.cpp.

uint8_t fontX ( void   )

Font size, x-axis.

Returns:
horizontal size of current font, in pixels

Definition at line 579 of file SPI_TFT_ILI9225.cpp.

uint8_t fontY ( void   )

Font size, y-axis.

Returns:
vertical size of current font, in pixels

Definition at line 584 of file SPI_TFT_ILI9225.cpp.

void foreground ( uint16_t  color )

Set text foreground color.

Parameters:
color

Definition at line 680 of file SPI_TFT_ILI9225.cpp.

uint8_t getOrientation ( void   )

Get orientation.

Returns:
orientation orientation, 0=portrait, 1=right rotated landscape, 2=reverse portrait, 3=left rotated landscape

Definition at line 229 of file SPI_TFT_ILI9225.cpp.

uint16_t getStringWidth ( char *  s )

get string width

Parameters:
string
Returns:
string width in pixels

Definition at line 657 of file SPI_TFT_ILI9225.cpp.

void gotoxy ( int  x,
int  y 
)

Set text cursor position.

Parameters:
x
y

Definition at line 696 of file SPI_TFT_ILI9225.cpp.

uint16_t height ( void   )

Screen size, y-axis.

Returns:
vertical size of the screen, in pixels
Note:
176 means 176 pixels and thus 0..175 coordinates (decimal)

Definition at line 551 of file SPI_TFT_ILI9225.cpp.

void hline ( uint16_t  x1,
uint16_t  x2,
uint16_t  y,
uint16_t  color 
)

Draw hline, rectangle coordinates.

Parameters:
x1top left coordinate, x-axis
x2bottom right coordinate, x-axis
ybottom right coordinate, y-axis
color16-bit color

Definition at line 288 of file SPI_TFT_ILI9225.cpp.

void home ( void   )

Set text cursor at 0,0.

Definition at line 702 of file SPI_TFT_ILI9225.cpp.

void init ( void   )

Initialization.

Definition at line 49 of file SPI_TFT_ILI9225.cpp.

void invert ( bool  flag )

Invert screen.

Parameters:
flagtrue to invert, false for normal screen

Definition at line 147 of file SPI_TFT_ILI9225.cpp.

void line ( uint16_t  x1,
uint16_t  y1,
uint16_t  x2,
uint16_t  y2,
uint16_t  color 
)

Draw line, rectangle coordinates.

Parameters:
x1top left coordinate, x-axis
y1top left coordinate, y-axis
x2bottom right coordinate, x-axis
y2bottom right coordinate, y-axis
color16-bit color

Definition at line 250 of file SPI_TFT_ILI9225.cpp.

void linespacing ( int  line_spacing )

Set spacing in pixels between text lines.

Parameters:
line_spacingspacing in pixels between text lines

Definition at line 707 of file SPI_TFT_ILI9225.cpp.

void locate ( int  x,
int  y 
)

Set grapical cursor position.

Parameters:
x
y

Definition at line 690 of file SPI_TFT_ILI9225.cpp.

uint16_t maxX ( void   )

Screen size, x-axis.

Returns:
horizontal size of the screen, in pixels
Note:
219 means 0..219 coordinates (decimal)

Definition at line 536 of file SPI_TFT_ILI9225.cpp.

uint16_t maxY ( void   )

Screen size, y-axis.

Returns:
vertical size of the screen, in pixels
Note:
175 means 0..175 coordinates (decimal)

Definition at line 541 of file SPI_TFT_ILI9225.cpp.

void pixel ( uint16_t  x1,
uint16_t  y1,
uint16_t  color 
)

Draw pixel.

Parameters:
x1point coordinate, x-axis
y1point coordinate, y-axis
color16-bit color

Definition at line 237 of file SPI_TFT_ILI9225.cpp.

int putc ( int  value ) [virtual]

put a char on the screen

Parameters:
valuechar to print
Returns:
printed char

Definition at line 589 of file SPI_TFT_ILI9225.cpp.

void rect ( uint16_t  x1,
uint16_t  y1,
uint16_t  x2,
uint16_t  y2,
uint16_t  color 
)

Draw rectangle, rectangle coordinates.

Parameters:
x1top left coordinate, x-axis
y1top left coordinate, y-axis
x2bottom right coordinate, x-axis
y2bottom right coordinate, y-axis
color16-bit color

Definition at line 322 of file SPI_TFT_ILI9225.cpp.

void roundrect ( uint16_t  x1,
uint16_t  y1,
uint16_t  x2,
uint16_t  y2,
uint16_t  rad,
bool  fill,
uint16_t  color 
)

Draw line/filled rectangle, rectangle coordinates.

Parameters:
x1top left coordinate, x-axis
y1top left coordinate, y-axis
x2bottom right coordinate, x-axis
y2bottom right coordinate, y-axis
raddefines the redius of the circle
fillfill yes or no
color16-bit color

Definition at line 481 of file SPI_TFT_ILI9225.cpp.

int rows ( void   ) [virtual]

calculate the max number of columns

Returns:
max column depends on actual font size

Definition at line 717 of file SPI_TFT_ILI9225.cpp.

void setBacklight ( double  brightness )

Set backlight brightness.

Parameters:
brightness

Definition at line 152 of file SPI_TFT_ILI9225.cpp.

void setBacklightOff ( void   )

Switch backlight off.

Definition at line 159 of file SPI_TFT_ILI9225.cpp.

void setBacklightOn ( void   )

Switch backlight on.

Definition at line 164 of file SPI_TFT_ILI9225.cpp.

uint16_t setColor ( uint8_t  red,
uint8_t  green,
uint8_t  blue 
)

Calculate 16-bit color from 8-bit Red-Green-Blue components.

Parameters:
redred component, 0x00..0xff
greengreen component, 0x00..0xff
blueblue component, 0x00..0xff
Returns:
16-bit color

Definition at line 556 of file SPI_TFT_ILI9225.cpp.

void setDisplay ( bool  flag )

Switch display on or off.

Parameters:
flagtrue=on, false=off

Definition at line 169 of file SPI_TFT_ILI9225.cpp.

void setFont ( uint8_t *  font )

Set current font.

Parameters:
fontFont name
void setOrientation ( uint8_t  orientation )

Set orientation.

Parameters:
orientationorientation: 0=ILI9225_PORTRAIT_L : SD card at the left side 1=ILI9225_LANDSCAPE_B : SD card at the bottom side 2=ILI9225_PORTRAIT_R : SD card at the right side 3=ILI9225_LANDSCAPE_T : SD card at the top side

Definition at line 187 of file SPI_TFT_ILI9225.cpp.

void splitColor ( uint16_t  rgb,
uint8_t &  red,
uint8_t &  green,
uint8_t &  blue 
)

Calculate 8-bit Red-Green-Blue components from 16-bit color.

Parameters:
rgb16-bit color
redred component, 0x00..0xff
greengreen component, 0x00..0xff
blueblue component, 0x00..0xff

Definition at line 562 of file SPI_TFT_ILI9225.cpp.

void triangle ( uint16_t  x1,
uint16_t  y1,
uint16_t  x2,
uint16_t  y2,
uint16_t  x3,
uint16_t  y3,
uint16_t  color 
)

Draw triangle, triangle coordinates.

Parameters:
x1corner 1 coordinate, x-axis
y1corner 1 coordinate, y-axis
x2corner 2 coordinate, x-axis
y2corner 2 coordinate, y-axis
x3corner 3 coordinate, x-axis
y3corner 3 coordinate, y-axis
color16-bit color

Definition at line 400 of file SPI_TFT_ILI9225.cpp.

void unicode2ascii ( char *  uni_str,
char *  ascii_str 
)

Make an ascii string from an unicode string.

Parameters:
uni_str
ascii_str

Definition at line 722 of file SPI_TFT_ILI9225.cpp.

void vline ( uint16_t  x,
uint16_t  y1,
uint16_t  y2,
uint16_t  color 
)

Draw vline, rectangle coordinates.

Parameters:
xtop left coordinate, x-axis
y1top left coordinate, y-axis
y2bottom right coordinate, y-axis
color16-bit color

Definition at line 305 of file SPI_TFT_ILI9225.cpp.

uint16_t width ( void   )

Screen size, x-axis.

Returns:
horizontal size of the screen, in pixels
Note:
220 means 220 pixels and thus 0..219 coordinates (decimal)

Definition at line 546 of file SPI_TFT_ILI9225.cpp.