Phoenard
Files | Namespaces | Classes | Macros | Typedefs | Variables
Display

The display module includes everything needed to make use of the TFT-LCD screen. More...

Files

file  PHNDisplay.h
 Contains the PHN_Display used for drawing, touch input and widgets.
 
file  PHNDisplayHardware.h
 Low-level utility functions for working with the display.
 

Namespaces

 PHNDisplayHW
 Main display hardware functions are contained here.
 
 PHNDisplay8Bit
 8-bit display (drawing) logic for size and speed optimization freaks
 
 PHNDisplay16Bit
 16-bit display (drawing) logic for full color
 

Classes

struct  Viewport
 Struct to hold the viewport information. More...
 
struct  PressPoint
 Struct to hold the touch screen input information. More...
 
struct  TextOptions
 Struct to hold the screen text drawing options. More...
 
struct  TextBounds
 Struct to hold the information for drawing text inside an area. More...
 
struct  Imageheader_LCD
 Struct to hold the header information of the LCD image format. More...
 
struct  Imageheader_BMP
 Struct to hold the header information of the Bitmap image format. More...
 
struct  Color_ARGB
 Struct to hold ARGB 32-bit color information used in bitmaps. More...
 
class  PHN_Display
 Simplifies the use of the display with drawing, touch input and widgets . More...
 

Macros

#define TFTLCD_TOUCH_PRESSURE_THRESHOLD   90
 
#define TFTLCD_TOUCH_PRESSDELAY   30
 
#define WRAPMODE_DOWN   0x0
 
#define WRAPMODE_UP   0x4
 
#define TFTLCD_TOUCH_SMOOTH(x)   (0.01 * abs(x) * x)
 
#define LCD_AUTO_INITIALIZE   0
 
#define LCD_OUTPUT_SERIAL   0
 
#define COLOR8TO16(color)   ((uint16_t) ((color & 0xFF) | ((color) << 8)))
 Macro to turn 8-bit color into 16-bit color.
 

Typedefs

typedef struct TextBounds TextBounds
 Struct to hold the information for drawing text inside an area.
 
typedef uint16_t color_t
 Definition of the 16-bit 565 color type.
 

Variables

PHN_Display display
 Global variable from which the display functions can be accessed.
 
const unsigned char phn_font_5x7[] PROGMEM
 The default 5x7 font that is stored in program memory.
 

LCD Hardware Commands

All commands that can be written out to the display

#define LCD_CMD_START_OSC   0x00
 
#define LCD_CMD_DRIV_OUT_CTRL   0x01
 
#define LCD_CMD_DRIV_WAV_CTRL   0x02
 
#define LCD_CMD_ENTRY_MOD   0x03
 
#define LCD_CMD_RESIZE_CTRL   0x04
 
#define LCD_CMD_DISP_CTRL1   0x07
 
#define LCD_CMD_DISP_CTRL2   0x08
 
#define LCD_CMD_DISP_CTRL3   0x09
 
#define LCD_CMD_DISP_CTRL4   0x0A
 
#define LCD_CMD_RGB_DISP_IF_CTRL1   0x0C
 
#define LCD_CMD_FRM_MARKER_POS   0x0D
 
#define LCD_CMD_RGB_DISP_IF_CTRL2   0x0F
 
#define LCD_CMD_POW_CTRL1   0x10
 
#define LCD_CMD_POW_CTRL2   0x11
 
#define LCD_CMD_POW_CTRL3   0x12
 
#define LCD_CMD_POW_CTRL4   0x13
 
#define LCD_CMD_GRAM_HOR_AD   0x20
 
#define LCD_CMD_GRAM_VER_AD   0x21
 
#define LCD_CMD_RW_GRAM   0x22
 
#define LCD_CMD_POW_CTRL7   0x29
 
#define LCD_CMD_FRM_RATE_COL_CTRL   0x2B
 
#define LCD_CMD_GAMMA_CTRL1   0x30
 
#define LCD_CMD_GAMMA_CTRL2   0x31
 
#define LCD_CMD_GAMMA_CTRL3   0x32
 
#define LCD_CMD_GAMMA_CTRL4   0x35
 
#define LCD_CMD_GAMMA_CTRL5   0x36
 
#define LCD_CMD_GAMMA_CTRL6   0x37
 
#define LCD_CMD_GAMMA_CTRL7   0x38
 
#define LCD_CMD_GAMMA_CTRL8   0x39
 
#define LCD_CMD_GAMMA_CTRL9   0x3C
 
#define LCD_CMD_GAMMA_CTRL10   0x3D
 
#define LCD_CMD_HOR_START_AD   0x50
 
#define LCD_CMD_HOR_END_AD   0x51
 
#define LCD_CMD_VER_START_AD   0x52
 
#define LCD_CMD_VER_END_AD   0x53
 
#define LCD_CMD_GATE_SCAN_CTRL1   0x60
 
#define LCD_CMD_GATE_SCAN_CTRL2   0x61
 
#define LCD_CMD_GATE_SCAN_CTRL3   0x6A
 
#define LCD_CMD_PART_IMG1_DISP_POS   0x80
 
#define LCD_CMD_PART_IMG1_START_AD   0x81
 
#define LCD_CMD_PART_IMG1_END_AD   0x82
 
#define LCD_CMD_PART_IMG2_DISP_POS   0x83
 
#define LCD_CMD_PART_IMG2_START_AD   0x84
 
#define LCD_CMD_PART_IMG2_END_AD   0x85
 
#define LCD_CMD_PANEL_IF_CTRL1   0x90
 
#define LCD_CMD_PANEL_IF_CTRL2   0x92
 
#define LCD_CMD_PANEL_IF_CTRL3   0x93
 
#define LCD_CMD_PANEL_IF_CTRL4   0x95
 
#define LCD_CMD_PANEL_IF_CTRL5   0x97
 
#define LCD_CMD_PANEL_IF_CTRL6   0x98
 

16-bit Color constants

Color constants for use in (default) 16-bit drawing functions

#define BLACK   0x0000
 
#define WHITE   0xFFFF
 
#define GRAY   0x8410
 
#define GRAY_DARK   0x4208
 
#define GRAY_LIGHT   0xC618
 
#define BLUE   0x001F
 
#define RED   0xF800
 
#define GREEN   0x07E0
 
#define CYAN   0x07FF
 
#define MAGENTA   0xF81F
 
#define YELLOW   0xFFE0
 
#define ORANGE   0xFC00
 

8-bit Color constants

Color constants for use in 8-bit drawing functions

#define BLACK_8BIT   0x00
 
#define WHITE_8BIT   0xFF
 
#define GRAY_8BIT   0xD5
 
#define GRAY_LIGHT_8BIT   0xF6
 
#define YELLOW_8BIT   0xEE
 
#define ORANGE_8BIT   0xE4
 
#define RED_8BIT   0xE0
 
#define GREEN_8BIT   0xC7
 
#define BLUE_8BIT   0x9E
 
#define CYAN_8BIT   0xDF
 
#define PURPLE_8BIT   0xDC
 

Display cursor direction constants

Specifies in what direction to draw pixels

#define DIR_RIGHT_WRAP_DOWN   0x08
 
#define DIR_DOWN_WRAP_DOWN   0x20
 
#define DIR_LEFT_WRAP_DOWN   0x38
 
#define DIR_UP_WRAP_DOWN   0x10
 
#define DIR_RIGHT_WRAP_UP   0x18
 
#define DIR_DOWN_WRAP_UP   0x00
 
#define DIR_LEFT_WRAP_UP   0x28
 
#define DIR_UP_WRAP_UP   0x30
 
#define DIR_RIGHT   DIR_RIGHT_WRAP_DOWN
 
#define DIR_DOWN   DIR_DOWN_WRAP_DOWN
 
#define DIR_LEFT   DIR_LEFT_WRAP_DOWN
 
#define DIR_UP   DIR_UP_WRAP_DOWN
 

Detailed Description

The display module includes everything needed to make use of the TFT-LCD screen.

You can make use of the global display to work with widgets or to perform manual drawing to the screen. It also features an automated system for reading touch input, with screen calibration all set up behind the scenes.

If all of this abstraction is too much for you, for example because you need to reduce code size, you can instead make use of the hardware variant of the display. This is the low-level logic the display makes use of, which is less user-friendly but does enable minimal code size approaches.

Macro Definition Documentation

#define LCD_AUTO_INITIALIZE   0

When set to 1, the screen will be re-initialized every time the sketch makes first use of the screen. If the firmware of the device fails to initialize the screen, or non-standard firmware is used, this option is used to resolve such problems.

#define LCD_OUTPUT_SERIAL   0

When set to 1, will output screen updates through Serial at BAUD 115200 With the toolkit the screen output can then be monitored