Differential pressure meter
Dependencies: TFT_Touch_WaveShare
SPI_TFT Class Reference
Display control class, based on GraphicsDisplay and TextDisplay. More...
#include <SPI_TFT.h>
Inherits GraphicsDisplay.
Public Member Functions | |
SPI_TFT (PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset, const char *name="TFT") | |
Create a SPI_TFT object connected to SPI and two pins. | |
virtual int | width () |
Get the width of the screen in pixel. | |
virtual int | height () |
Get the height of the screen in pixel. | |
virtual void | pixel (int x, int y, int colour) |
Draw a pixel at x,y with color. | |
void | circle (int x, int y, int r, int colour) |
draw a circle | |
void | fillcircle (int x, int y, int r, int colour) |
draw a filled circle | |
void | line (int x0, int y0, int x1, int y1, int colour) |
draw a 1 pixel line | |
void | rect (int x0, int y0, int x1, int y1, int colour) |
draw a rect | |
void | fillrect (int x0, int y0, int x1, int y1, int colour) |
draw a filled rect | |
void | locate (int column, int row) |
setup cursor position | |
virtual void | cls (void) |
Fill the screen with _backgroun color. | |
int | columns (void) |
calculate the max number of char in a line | |
int | rows (void) |
calculate the max number of columns | |
int | _putc (int value) |
put a char on the screen | |
virtual void | character (int col, int row, int c) |
draw a character on given position out of the active font to the TFT | |
void | Bitmap (unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned char *bitmap) |
paint a bitmap on the TFT | |
void | set_font (unsigned char *f) |
select the font to use | |
void | set_orientation (unsigned int o) |
Set the orientation of the screen x,y: 0,0 is always top left. | |
virtual bool | claim (FILE *stream) |
redirect output from a stream (stoud, sterr) to display | |
Protected Member Functions | |
void | hline (int x0, int x1, int y, int colour) |
draw a horizontal line | |
void | vline (int y0, int y1, int x, int colour) |
draw a vertical line | |
void | window (unsigned int x, unsigned int y, unsigned int w, unsigned int h) |
Set draw window region. | |
void | WindowMax (void) |
Set draw window region to whole screen. | |
void | tft_reset () |
Init the HX8347D controller. | |
void | wr_dat (int value) |
Write data to the LCD controller. | |
void | wr_cmd (int value) |
Write a command the LCD controller. | |
void | wr_dat_start () |
Start data sequence to the LCD controller. | |
void | wr_dat_stop () |
Stop of data writing to the LCD controller. | |
void | wr_dat_only (unsigned short dat) |
write data to the LCD controller | |
unsigned short | rd_dat (void) |
Read data from the LCD controller. | |
void | wr_reg (unsigned char reg, unsigned short val) |
Write a value to the to a LCD register. | |
unsigned short | rd_reg (unsigned char reg) |
Read a LCD register. |
Detailed Description
Display control class, based on GraphicsDisplay and TextDisplay.
Example:
#include "stdio.h" #include "mbed.h" #include "SPI_TFT.h" #include "string" #include "Arial12x12.h" #include "Arial24x23.h" // the TFT is connected to SPI pin 5-7 SPI_TFT TFT(p5, p6, p7, p8, p15,"TFT"); // mosi, miso, sclk, cs, reset int main() { TFT.claim(stdout); // send stdout to the TFT display //TFT.claim(stderr); // send stderr to the TFT display TFT.background(Black); // set background to black TFT.foreground(White); // set chars to white TFT.cls(); // clear the screen TFT.set_font((unsigned char*) Arial12x12); // select the font TFT.set_orientation(0); TFT.locate(0,0); printf(" Hello Mbed 0"); TFT.set_font((unsigned char*) Arial24x23); // select font 2 TFT.locate(2,5); TFT.printf("Bigger Font"); }
Definition at line 81 of file SPI_TFT.h.
Constructor & Destructor Documentation
SPI_TFT | ( | PinName | mosi, |
PinName | miso, | ||
PinName | sclk, | ||
PinName | cs, | ||
PinName | reset, | ||
const char * | name = "TFT" |
||
) |
Create a SPI_TFT object connected to SPI and two pins.
- Parameters:
-
mosi,miso,sclk SPI cs pin connected to CS of display reset pin connected to RESET of display
Definition at line 21 of file SPI_TFT.cpp.
Member Function Documentation
int _putc | ( | int | value ) |
put a char on the screen
- Parameters:
-
value char to print
- Returns:
- printed char
Definition at line 557 of file SPI_TFT.cpp.
void Bitmap | ( | unsigned int | x, |
unsigned int | y, | ||
unsigned int | w, | ||
unsigned int | h, | ||
unsigned char * | bitmap | ||
) |
paint a bitmap on the TFT
- Parameters:
-
x,y : upper left corner w width of bitmap h high of bitmap *bitmap pointer to the bitmap data
bitmap format: 16 bit R5 G6 B5
use Gimp to create / load , save as BMP, option 16 bit R5 G6 B5 use winhex to load this file and mark data stating at offset 0x46 to end use edit -> copy block -> C Source to export C array paste this array into your program
Definition at line 634 of file SPI_TFT.cpp.
void character | ( | int | col, |
int | row, | ||
int | c | ||
) | [virtual] |
draw a character on given position out of the active font to the TFT
- Parameters:
-
col column row row c char to print
Definition at line 575 of file SPI_TFT.cpp.
void circle | ( | int | x, |
int | y, | ||
int | r, | ||
int | colour | ||
) |
draw a circle
- Parameters:
-
x0,y0 center r radius color 16 bit color *
Definition at line 277 of file SPI_TFT.cpp.
bool claim | ( | FILE * | stream ) | [virtual, inherited] |
redirect output from a stream (stoud, sterr) to display
- Parameters:
-
stream stream that shall be redirected to the TextDisplay
Definition at line 65 of file TextDisplay.cpp.
void cls | ( | void | ) | [virtual] |
Fill the screen with _backgroun color.
Definition at line 264 of file SPI_TFT.cpp.
int columns | ( | void | ) |
calculate the max number of char in a line
- Returns:
- max columns depends on actual font size
Definition at line 545 of file SPI_TFT.cpp.
void fillcircle | ( | int | x, |
int | y, | ||
int | r, | ||
int | colour | ||
) |
draw a filled circle
- Parameters:
-
x0,y0 center r radius color 16 bit color *
use circle with different radius, can miss some pixel
Definition at line 384 of file SPI_TFT.cpp.
void fillrect | ( | int | x0, |
int | y0, | ||
int | x1, | ||
int | y1, | ||
int | colour | ||
) |
draw a filled rect
- Parameters:
-
x0,y0 top left corner x1,y1 down right corner color 16 bit color
Definition at line 518 of file SPI_TFT.cpp.
int height | ( | ) | [virtual] |
Get the height of the screen in pixel.
- Returns:
- height of screen in pixel
Definition at line 34 of file SPI_TFT.cpp.
void hline | ( | int | x0, |
int | x1, | ||
int | y, | ||
int | colour | ||
) | [protected] |
draw a horizontal line
- Parameters:
-
x0 horizontal start x1 horizontal stop y vertical position color 16 bit color
Definition at line 392 of file SPI_TFT.cpp.
void line | ( | int | x0, |
int | y0, | ||
int | x1, | ||
int | y1, | ||
int | colour | ||
) |
draw a 1 pixel line
- Parameters:
-
x0,y0 start point x1,y1 stop point color 16 bit color
Definition at line 426 of file SPI_TFT.cpp.
void locate | ( | int | column, |
int | row | ||
) |
setup cursor position
- Parameters:
-
column 0 to max row 0 to max max depend on font size
Definition at line 537 of file SPI_TFT.cpp.
void pixel | ( | int | x, |
int | y, | ||
int | colour | ||
) | [virtual] |
Draw a pixel at x,y with color.
- Parameters:
-
x horizontal position y vertical position color 16 bit pixel color
Definition at line 234 of file SPI_TFT.cpp.
unsigned short rd_dat | ( | void | ) | [protected] |
Read data from the LCD controller.
- Returns:
- data from LCD controller
Definition at line 103 of file SPI_TFT.cpp.
unsigned short rd_reg | ( | unsigned char | reg ) | [protected] |
Read a LCD register.
- Parameters:
-
reg register to be read
- Returns:
- value of the register
Definition at line 126 of file SPI_TFT.cpp.
void rect | ( | int | x0, |
int | y0, | ||
int | x1, | ||
int | y1, | ||
int | colour | ||
) |
draw a rect
- Parameters:
-
x0,y0 top left corner x1,y1 down right corner color 16 bit color *
Definition at line 499 of file SPI_TFT.cpp.
int rows | ( | void | ) |
calculate the max number of columns
- Returns:
- max column depends on actual font size
Definition at line 551 of file SPI_TFT.cpp.
void set_font | ( | unsigned char * | f ) |
select the font to use
- Parameters:
-
f pointer to font array
font array can created with GLCD Font Creator from http://www.mikroe.com you have to add 4 parameter at the beginning of the font array to use:
- the number of byte / char
- the vertial size in pixel
- the horizontal size in pixel
- the number of byte per vertical line you also have to change the array to char[]
Definition at line 628 of file SPI_TFT.cpp.
void set_orientation | ( | unsigned int | o ) |
Set the orientation of the screen x,y: 0,0 is always top left.
- Parameters:
-
o direction to use the screen (0-3) 90� Steps
Definition at line 41 of file SPI_TFT.cpp.
void tft_reset | ( | ) | [protected] |
Init the HX8347D controller.
Definition at line 134 of file SPI_TFT.cpp.
void vline | ( | int | y0, |
int | y1, | ||
int | x, | ||
int | colour | ||
) | [protected] |
draw a vertical line
- Parameters:
-
x horizontal position y0 vertical start y1 vertical stop color 16 bit color
Definition at line 409 of file SPI_TFT.cpp.
int width | ( | ) | [virtual] |
Get the width of the screen in pixel.
- Parameters:
-
@returns width of screen in pixel
Definition at line 28 of file SPI_TFT.cpp.
void window | ( | unsigned int | x, |
unsigned int | y, | ||
unsigned int | w, | ||
unsigned int | h | ||
) | [protected] |
Set draw window region.
- Parameters:
-
x horizontal position y vertical position w window width in pixel h window height in pixels
Definition at line 246 of file SPI_TFT.cpp.
void WindowMax | ( | void | ) | [protected] |
Set draw window region to whole screen.
Definition at line 259 of file SPI_TFT.cpp.
void wr_cmd | ( | int | value ) | [protected] |
Write a command the LCD controller.
- Parameters:
-
cmd,: command to be written
Definition at line 61 of file SPI_TFT.cpp.
void wr_dat | ( | int | value ) | [protected] |
Write data to the LCD controller.
- Parameters:
-
dat data written to LCD controller
Definition at line 70 of file SPI_TFT.cpp.
void wr_dat_only | ( | unsigned short | dat ) | [protected] |
write data to the LCD controller
- Parameters:
-
data to be written *
Definition at line 94 of file SPI_TFT.cpp.
void wr_dat_start | ( | void | ) | [protected] |
Start data sequence to the LCD controller.
Definition at line 81 of file SPI_TFT.cpp.
void wr_dat_stop | ( | void | ) | [protected] |
Stop of data writing to the LCD controller.
Definition at line 88 of file SPI_TFT.cpp.
void wr_reg | ( | unsigned char | reg, |
unsigned short | val | ||
) | [protected] |
Write a value to the to a LCD register.
- Parameters:
-
reg register to be written val data to be written
Definition at line 118 of file SPI_TFT.cpp.
Generated on Tue Jul 19 2022 13:55:32 by 1.7.2