TFT_eSPI CLASS - Ambercroft/TFT_eSPI GitHub Wiki
TFT_eSPI CLASS
Display Settings
int32_t h=height(void); ?? int32 or int16
Return the pixel height of the display.
Ref: setRotation(); getRotation();
int32_t w=width(void); ?? int32 or int16
Return the pixel width of the display.
Ref: setRotation(); getRotation();
Functions
setRotation(uint8_t N);
Rotate the screen orientation
- N >> 0 - 3 Clockwise rotation 90 degree steps
- N >> 4 - 7 BMP drawing ?? separate for BMP Note: This will always do the entire screen even if viewport is set. REF: setViewport();
getRotation(void);
Returns rotation value N
- N >> 0 - 3 Clockwise rotation 90 degree steps
- N >> 4 - 7 BMP drawing ?? separate for BMP
- Return uint_8 orientation.
Ref: setRotation()
invertDisplay(bool i);
Inverts the display colours.
- i >> 0 normal, 1 invert ( can use TRUE / FALSE )
setAddrWindow(int32_t X0,int32_t Y0, int32_t W, int32_t H);
Define an area to receive a a stream of pixels
- X0,Y0 >> origin
- W, H >> Width, Height in pixels
setWindow(int32_t X0,int32_t Y0, int32_t X1, int32_t Y1);
Define an area to receive a a stream of pixels
- X0,Y0 >> origin
- X1,Y1 >> end point
Viewport
Viewports have a number of potential uses:
- create a "virtual" TFT screen smaller than the actual TFT screen
- render GUI items (menus etc) in a viewport, erase GUI item by redrawing whole screen,
- this will be fast because only the viewport will be refreshed (e.g. clearing menu)
- limit screen refresh to a particular area, e.g. changing numbers, icons or graph plotting
- showing a small portion of a larger image or sprite, this allows panning and scrolling
Ref: Viewport_Demo.ino Viewport_commands.ino
setViewport(uint_16 X0, uint_16 Y0, uint_16 X1, uint_16 Y1, bool DATUM);
Constrains the drawings to described window. ( ?? limitations ))
- X0,Y0 >> origin
- X1,Y1 >> end point
- DATUM >> Optional. FALSE = datum stays at TFT top left.
- DATUM >> Default. TRUE = datum is set to Viewport origin.
resetViewport(void);
Viewport is reset to the whole screen.
getViewportX(void);
Always returns Viewport X coordinate relative to screen left edge.
- Return uint32_t X
getViewportY(void);
Always returns Viewport Y coordinate relative to screen top edge.
- Return uint32_t Y
getViewportWidth(void);
Always returns width of viewport.
- Return uint32_t W
getViewportHeight(void);
Always returns height of viewport.
- Return uint32_t H
getViewportDatum(void);
Datum of the viewport (false = TFT corner, true = viewport corner)
- Return bool P
frameViewport(uint_16 COLOUR, int16_t WD); ?? type for the WD
Set a frame around the viewport. Set a fame inside the viewport of width WD. Outside if WD is negative.
- COLOUR >> Standard colours.
- WD >> Width of frame in pixels.
SORT ME
Put function here if uncertain the position to be placed on page.