ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts  1.0
ESP8266ILI9341DisplayProject
Macros | Functions | Variables
ili9341.c File Reference

ili9341 driver inspired by Adafruit ili9341 code All code in this file has been rewritten by Mike Gore More...

#include "user_config.h"
#include <stdint.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include "display/font.h"
#include "display/ili9341.h"
#include "3rd_party/ili9341_adafruit.h"

Go to the source code of this file.

Macros

#define XYSTACK   64
 X,Y point stack. More...
 
#define MAXVEC   24
 find beginning and end of all non-matching color transitions in a line FIXME: not tested yet More...
 
#define HSPI_PIX   ((HSPI_FIFO_SIZE-2)/3)
 Read Rectangle and return 16bit color array in 565 RGB format We clip the window to the current view Note: TFT Chip Select must be asserted for each block read As soon as chip select goes high the read aborts! We break up the data into chunks with a Memory Read, followed by Memory Read Continue So we use Memory Read and Memory Read Continue. More...
 
#define USE_OPTIMIZATION_DRAWLINE
 

Functions

void tft_Cmd (uint8_t cmd)
 Transmit 8 bit command. More...
 
uint8_t tft_Data (uint8_t data)
 Transmit 8 bit data amd read 8bit data. More...
 
void tft_Cmd_Data_TX (uint8_t cmd, uint8_t *data, int bytes)
 Transmit 8 bit command and optionally send data buffer. More...
 
int32_t tft_abs_window (window *win, int16_t x, int16_t y, int16_t w, int16_t h)
 ============================================================= More...
 
int32_t tft_rel_window (window *win, int16_t x, int16_t y, int16_t w, int16_t h)
 Set the ili9341 working window by relative position and size Note: Function clips x,y,w,y. More...
 
MEMSPACE uint32_t tft_readRegister (uint8_t command, uint8_t parameter)
 ==================================== More...
 
MEMSPACE uint32_t tft_readId (void)
 Read ILI9341 device ID should be 9341 This does not work for really high SPI clock speeds Make sure that when called the clock speed in reduced. More...
 
void tft_bit_blit (window *win, uint8_t *ptr, int16_t x, int16_t y, int16_t w, int16_t h)
 

BLIT functions

More...
 
void tft_fillWin (window *win, uint16_t color)
 

Fill functions

More...
 
void tft_flood (window *win, int16_t x, int16_t y, uint16_t border, uint16_t fill)
 Flood fill. More...
 
int tft_push_xy (int16_t x, int16_t y)
 point push More...
 
int tft_pop_xy (int16_t *x, int16_t *y)
 point push More...
 
int tft_floodline (window *win, int16_t x, int16_t y, uint16_t border, uint16_t fill)
 Flood using line fill method. More...
 
int tft_FillPolyLine (window *win, int16_t x, int16_t y, int w, uint16_t color)
 
void tft_fillRectWH (window *win, int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 Partial window Fill with color We clip the window to the current view. More...
 
void tft_fillRectXY (window *win, int16_t x, int16_t y, int16_t xl, int16_t yl, uint16_t color)
 Fill rectangle with color We clip the window to the current view. More...
 
void tft_drawPixel (window *win, int16_t x, int16_t y, int16_t color)
 

Pixel functions

More...
 
void tft_writeRect (window *win, int16_t x, int16_t y, int16_t w, int16_t h, uint16_t *color)
 Write a rectangle pixel array. More...
 
void tft_readRect (window *win, int16_t x, int16_t y, int16_t w, int16_t h, uint16_t *color)
 
void tft_Vscroll (window *win, int dir)
 Scroll window up by dir lines We start at the top of the window and move down. More...
 
uint16_t tft_readPixel (window *win, int16_t x, int16_t y)
 Read one pixel and return color in 1bit 565 RGB format We clip the window to the current view Note: Read Memory must be done in a continious write/read operation Chip select can not be deactivated for the transaction. More...
 
MEMSPACE void tft_setRotation (uint8_t m)
 Set Display rotation, applies to the master window only Set hardware display rotation and memory fill option bits Update software display limits FIXME Work in progress. More...
 
void tft_565toRGB (uint16_t color, uint8_t *r, uint8_t *g, uint8_t *b)
 

Color conversions

More...
 
MEMSPACE void tft_invertDisplay (int flag)
 Invert the display. More...
 
MEMSPACE int tft_window_clip (window *win)
 Clip window structure to TFT limits. More...
 
MEMSPACE void tft_clip_xy (window *win, int16_t *X, int16_t *Y)
 Clip X,Y to fix inside specifiied window. More...
 
MEMSPACE int tft_window_clip_args (window *win, int16_t *x, int16_t *y, int16_t *w, int16_t *h)
 clip arguments to window limits Arguments position x,y width w and height h to be clipped More...
 
MEMSPACE void tft_window_init (window *win, int16_t x, int16_t y, int16_t w, int16_t h)
 Initialize window structure we default values FIXME check x+w, y+h absolute limits against TFT limuts. More...
 
MEMSPACE void tft_setTextColor (window *win, uint16_t fg, uint16_t bg)
 ==================================== More...
 
MEMSPACE void tft_setpos (window *win, int16_t x, int16_t y)
 Set current window text pointer in pixels (per current rotation) More...
 
MEMSPACE void tft_set_textpos (window *win, int16_t x, int16_t y)
 Set current window text pointer in characters (per current rotation) - overall font bounding box. More...
 
MEMSPACE void tft_set_font (window *win, uint16_t index)
 Set current font size (per current rotation) More...
 
MEMSPACE void tft_font_fixed (window *win)
 
MEMSPACE void tft_font_var (window *win)
 Set current font type to variable. More...
 
int tft_get_font_height (window *win)
 Get font height. More...
 
void tft_drawFastVLine (window *win, int16_t x, int16_t y, int16_t h, uint16_t color)
 Fast virtical line drawing. More...
 
void tft_drawFastHLine (window *win, int16_t x, int16_t y, int16_t w, uint16_t color)
 Fast virtical line drawing. More...
 
void tft_drawLine (window *win, int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 Draw line From my blit test code testit.c 1984 - 1985 Mike Gore. More...
 
int tft_Bezier2 (window *win, p2_int16_t S, p2_int16_t C, p2_int16_t T, int steps, uint16_t color)
 Draw lines between points along Quadratic Bézier curve Quadratic Bézier with respect to t, see https://en.wikipedia.org/wiki/Bézier_curve B(t) = (1-t)*(1-t)*S + 2*(1-t)*t*C + t*t*T, 0 <= t <= 1. More...
 
int tft_Bezier3 (window *win, p2_int16_t S, p2_int16_t C1, p2_int16_t C2, p2_int16_t T, int steps, uint16_t color)
 Draw lines between points along Cubic Bézier curve Quadratic Bézier with respect to t, see https://en.wikipedia.org/wiki/Bézier_curve B(t) = (1-t)(1-t)*(1-t)*S + 3*(1-t)(1-t)*t*C1 + 3(1-t)*t*t*C2 + t*t*t*T, 0 <= t <= 1. More...
 
MEMSPACE void tft_cleareol (window *win)
 

Character and String functions

More...
 
MEMSPACE void tft_clearline (window *win)
 Clear display text line. More...
 
void tft_putch (window *win, int c)
 put character in current winoow More...
 

Variables

window tftwin
 
windowtft = &tftwin
 
struct {
   int16_t   x [XYSTACK+2]
 
   int16_t   y [XYSTACK+2]
 
   int   ind
 
xy
 

Detailed Description

ili9341 driver inspired by Adafruit ili9341 code All code in this file has been rewritten by Mike Gore

Copyright © 2015 Mike Gore, GPL License
You are free to use this code under the terms of GPL
please retain a copy of this notice in any code you use it in.
Copyright © 2013 Adafruit Industries. All rights reserved.
See also
https://github.com/adafruit/Adafruit-GFX-Library
Line drawing function CERTS
See also
https://github.com/CHERTS/esp8266-devkit/tree/master/Espressif/examples/esp8266_ili9341

This is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file ili9341.c.

Macro Definition Documentation

#define HSPI_PIX   ((HSPI_FIFO_SIZE-2)/3)

Read Rectangle and return 16bit color array in 565 RGB format We clip the window to the current view Note: TFT Chip Select must be asserted for each block read As soon as chip select goes high the read aborts! We break up the data into chunks with a Memory Read, followed by Memory Read Continue So we use Memory Read and Memory Read Continue.

Parameters
[in]win*window structure
[in]xX offset
[in]yY offset
[in]wWidth
[in]hHeight
[in]*colorpixel array in 565 format Number of pixels FIFO can hold We also include the 2 byte Memory Read / Continue opcodes;

Definition at line 835 of file ili9341.c.

#define MAXVEC   24

find beginning and end of all non-matching color transitions in a line FIXME: not tested yet

Parameters
[in]win*window structure
[in]xX position to start scan
[in]yY line to scan
[in]*vecstart and end of transition offsets
[in]countmaximum size of transitions to save
[in]colormatch color @ return true count of saved transitions

Definition at line 509 of file ili9341.c.

Referenced by tft_FillPolyLine().

#define USE_OPTIMIZATION_DRAWLINE
#define XYSTACK   64

X,Y point stack.

Definition at line 369 of file ili9341.c.

Referenced by tft_push_xy().

Function Documentation

void tft_565toRGB ( uint16_t  color,
uint8_t r,
uint8_t g,
uint8_t b 
)

Color conversions

====================================Convert 16bit colr into 8-bit (each) R,G,B ILI9341 defaults to MSB/LSB data so we have to reverse it

Parameters
[in]color16bit color
[out]*rred data
[out]*bblue data
[out]*ggreen data

Definition at line 1033 of file ili9341.c.

int32_t tft_abs_window ( window win,
int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h 
)

=============================================================

====================================

window limits

Set the ili9341 working window by absolute position and size Note: Function clips x,y,w,y

Parameters
[in]xStarting X offset
[in]yStarting Y offset
[in]wWidth
[in]hHeight
Returns
(w * h) after clipping

Definition at line 101 of file ili9341.c.

Referenced by tft_rel_window().

int tft_Bezier2 ( window win,
p2_int16_t  S,
p2_int16_t  C,
p2_int16_t  T,
int  steps,
uint16_t  color 
)

Draw lines between points along Quadratic Bézier curve Quadratic Bézier with respect to t, see https://en.wikipedia.org/wiki/Bézier_curve B(t) = (1-t)*(1-t)*S + 2*(1-t)*t*C + t*t*T, 0 <= t <= 1.

====================================

Interpolation functions

The path traced by the function B(t), given points S, C, and T, S = initial points C = control points T = target points

Derivative of the Bézier curve with respect to t B'(t) = 2*(1-t)*(C-S) + 2*t*(T-C)

Second derivative of the Bézier curve with respect to t is B"(t) = 2*(T-2*C+S)

As t increases from 0 to 1, the curve departs from S in the direction of C, then bends to arrive at T from the direction of C. The tangents to the curve at S and T intersect at C.

Parameters
[in]*winWindow Structure of active window
[in]SStart
[in]CControl
[in]TTarget
[in]stepsline segments along curve (1..N)
[in]colorLine color
Returns
count of line segments

Definition at line 1474 of file ili9341.c.

int tft_Bezier3 ( window win,
p2_int16_t  S,
p2_int16_t  C1,
p2_int16_t  C2,
p2_int16_t  T,
int  steps,
uint16_t  color 
)

Draw lines between points along Cubic Bézier curve Quadratic Bézier with respect to t, see https://en.wikipedia.org/wiki/Bézier_curve B(t) = (1-t)(1-t)*(1-t)*S + 3*(1-t)(1-t)*t*C1 + 3(1-t)*t*t*C2 + t*t*t*T, 0 <= t <= 1.

The path traced by the function B(t), given points S, C, and T, S = initial points C1 = control point 1 C2 = control point 2 T = target points

Derivative of the Bézier curve with respect to t B'(t) = 3(1-t)*(1-t)*(C1-S) + 6*(1-t)*t*(C2-C1) + 3*t*t*(T-C2)

Second derivative of the Bézier curve with respect to t is B"(t) = 6*(1-t)*(C2-2*C1+S) + 6*t*(T-2*C2+C1)

The curve starts at S and moves toward C1 and on to T from the direction of C2. Points C1 and C2 provide directional information and the distance between them determines "how far" and "how fast" the curve moves towards C1 before turning towards C2.

Parameters
[in]*winWindow Structure of active window
[in]SStart
[in]C1Control 1
[in]C2Control 2
[in]TTarget
[in]stepsline segments along curve (1..N)
[in]colorLine color
Returns
count of line segments

Definition at line 1545 of file ili9341.c.

void tft_bit_blit ( window win,
uint8_t ptr,
int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h 
)

BLIT functions

BLIT a bit array to the display

Parameters
[in]win*window structure
[in]*ptrbit array w * h in size
[in]xBLITX offset
[in]yBLIT Y offset
[in]wBLIT Width
[in]hBLIT Height
Returns
void TODO CLIP window - depends on blit array

Definition at line 234 of file ili9341.c.

Referenced by tft_drawChar().

MEMSPACE void tft_cleareol ( window win)

Character and String functions

====================================Clear display to end of line

Parameters
[in]win*window structure return: void, win->x = win->w

Definition at line 1601 of file ili9341.c.

Referenced by tft_putch(), and user_loop().

MEMSPACE void tft_clearline ( window win)

Clear display text line.

Parameters
[in]win*window structure return: void, win->x = 0

Definition at line 1621 of file ili9341.c.

MEMSPACE void tft_clip_xy ( window win,
int16_t *  X,
int16_t *  Y 
)

Clip X,Y to fix inside specifiied window.

Parameters
[in]*winwindow structure
[in]*XX position in window
[in]*YY position is window return: void

Definition at line 1114 of file ili9341.c.

void tft_Cmd ( uint8_t  cmd)

Transmit 8 bit command.

=============================================================

Parameters
[in]cmddisplay command return: void status is in data array - bytes in size

Definition at line 53 of file ili9341.c.

Referenced by tft_bit_blit(), tft_Cmd_Data_TX(), tft_FillPolyLine(), tft_fillRectWH(), tft_invertDisplay(), tft_readPixel(), tft_readRect(), tft_readRegister(), and tft_writeRect().

void tft_Cmd_Data_TX ( uint8_t  cmd,
uint8_t data,
int  bytes 
)

Transmit 8 bit command and optionally send data buffer.

Parameters
[in]cmddisplay command
[in]*datadata buffer to send after command
[in]bytesdata buffer size return: void status is in data array - bytes in size

Definition at line 72 of file ili9341.c.

Referenced by tft_abs_window(), tft_configRegister(), tft_drawPixel(), and tft_setRotation().

uint8_t tft_Data ( uint8_t  data)

Transmit 8 bit data amd read 8bit data.

Parameters
[in]datadisplay command return: read result

Definition at line 61 of file ili9341.c.

Referenced by tft_readRegister().

void tft_drawFastHLine ( window win,
int16_t  x,
int16_t  y,
int16_t  w,
uint16_t  color 
)

Fast virtical line drawing.

Parameters
[in]*winwindow structure
[in]xX offset
[in]yY offset
[in]wWidth of line
[in]colorColor
Returns
void

Definition at line 1329 of file ili9341.c.

Referenced by tft_drawRect(), tft_drawRoundRect(), tft_FillPolyLine(), and tft_fillTriangle().

void tft_drawFastVLine ( window win,
int16_t  x,
int16_t  y,
int16_t  h,
uint16_t  color 
)

Fast virtical line drawing.

Parameters
[in]*winwindow structure
[in]xX offset
[in]yY offset
[in]hHeight of line
[in]colorColor
Returns
void

Definition at line 1314 of file ili9341.c.

Referenced by tft_drawRect(), tft_drawRoundRect(), tft_fillCircle(), and tft_fillCircleHelper().

void tft_drawLine ( window win,
int16_t  x0,
int16_t  y0,
int16_t  x1,
int16_t  y1,
uint16_t  color 
)

Draw line From my blit test code testit.c 1984 - 1985 Mike Gore.

Parameters
[in]win*window structure
[in]x0X Start
[in]y0Y Start
[in]x1X End
[in]y1Y End
[in]colorcolor to set
Returns
void Draw line Draw line from CERTS https://github.com/CHERTS/esp8266-devkit/tree/master/Espressif/examples/esp8266_ili9341
Parameters
[in]win*window structure
[in]x0X Start
[in]y0Y Start
[in]x1X End
[in]y1Y End
[in]colorcolor to set
Returns
void

Definition at line 1389 of file ili9341.c.

Referenced by tft_Bezier2(), tft_Bezier3(), tft_drawFastHLine(), tft_drawTriangle(), and wire_draw().

void tft_drawPixel ( window win,
int16_t  x,
int16_t  y,
int16_t  color 
)

Pixel functions

====================================Draw one pixel set to color in 16bit 565 RGB format We clip the window to the current view

Parameters
[in]win*window structure
[in]xX Start
[in]yY Start
[in]colorcolor to set
Returns
void

Definition at line 717 of file ili9341.c.

Referenced by tft_bit_blit(), tft_drawCircle(), tft_drawCircleHelper(), tft_drawFastHLine(), tft_flood(), tft_floodline(), tft_writeRect(), and user_tests().

int tft_FillPolyLine ( window win,
int16_t  x,
int16_t  y,
int  w,
uint16_t  color 
)

Definition at line 510 of file ili9341.c.

void tft_fillRectWH ( window win,
int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
uint16_t  color 
)

Partial window Fill with color We clip the window to the current view.

Parameters
[in]win*window structure
[in]xX Start
[in]yY Start
[in]wWidth
[in]hHeight
[in]colorFill color
Returns
void

Definition at line 627 of file ili9341.c.

Referenced by tft_cleareol(), tft_clearline(), tft_drawChar(), tft_drawFastHLine(), tft_drawFastVLine(), tft_fillRectXY(), tft_fillRoundRect(), tft_fillWin(), tft_putch(), and tft_Vscroll().

void tft_fillRectXY ( window win,
int16_t  x,
int16_t  y,
int16_t  xl,
int16_t  yl,
uint16_t  color 
)

Fill rectangle with color We clip the window to the current view.

Parameters
[in]win*window structure
[in]xX Start
[in]yY Start
[in]xlX End
[in]ylY End
[in]colorFill color
Returns
void

Definition at line 690 of file ili9341.c.

Referenced by tft_drawFastHLine().

void tft_fillWin ( window win,
uint16_t  color 
)

Fill functions

====================================Fill window

Parameters
[in]win*window structure
[in]colorFill color

Definition at line 334 of file ili9341.c.

Referenced by test_types(), tft_init(), and tft_putch().

void tft_flood ( window win,
int16_t  x,
int16_t  y,
uint16_t  border,
uint16_t  fill 
)

Flood fill.

See also
https://en.wikipedia.org/wiki/Flood_fill This method can eat all your ram with "busy" images and could crash
Parameters
[in]win*window structure
[in]borderborder color
[in]fillFill color

Definition at line 346 of file ili9341.c.

Referenced by tft_flood().

int tft_floodline ( window win,
int16_t  x,
int16_t  y,
uint16_t  border,
uint16_t  fill 
)

Flood using line fill method.

See also
https://en.wikipedia.org/wiki/Flood_fill FIXME: not tested yet
Parameters
[in]win*window structure
[in]xX position to fill from
[in]yY position to fill from
[in]borderborder color
[in]fillFill color @ return true one success, 0 of stack overflow

Definition at line 416 of file ili9341.c.

MEMSPACE void tft_font_fixed ( window win)

Only works if font is proportional type

Parameters
[in]win*window structure return: void

Definition at line 1278 of file ili9341.c.

Referenced by user_loop().

MEMSPACE void tft_font_var ( window win)

Set current font type to variable.

Parameters
[in]win*window structure return: void

Definition at line 1288 of file ili9341.c.

Referenced by test_types().

int tft_get_font_height ( window win)

Get font height.

Parameters
[in]win*window structure return: font Height or zero on error

Definition at line 1296 of file ili9341.c.

MEMSPACE void tft_invertDisplay ( int  flag)

Invert the display.

Parameters
[in]flagtrue or false
Returns
void

Definition at line 1045 of file ili9341.c.

int tft_pop_xy ( int16_t *  x,
int16_t *  y 
)

point push

Parameters
[in]xX
[in]yY @ return true if data exists, 0 of none

Definition at line 397 of file ili9341.c.

Referenced by tft_floodline().

int tft_push_xy ( int16_t  x,
int16_t  y 
)

point push

Parameters
[in]xX
[in]yY @ return true on success, 0 of stack overflow

Definition at line 380 of file ili9341.c.

Referenced by tft_floodline().

void tft_putch ( window win,
int  c 
)

put character in current winoow

Parameters
[in]win*window structure
[in]ccharacter return: void

Definition at line 1643 of file ili9341.c.

Referenced by _putc_win(), and _putc_win_len().

MEMSPACE uint32_t tft_readId ( void  )

Read ILI9341 device ID should be 9341 This does not work for really high SPI clock speeds Make sure that when called the clock speed in reduced.

See also
tft_init
Returns
32bit value with DIPLAY ID

Paramter 0 is unused See Read ID4 Command ( 0xd3 ) for a description of the parameters

Definition at line 206 of file ili9341.c.

Referenced by tft_init().

uint16_t tft_readPixel ( window win,
int16_t  x,
int16_t  y 
)

Read one pixel and return color in 1bit 565 RGB format We clip the window to the current view Note: Read Memory must be done in a continious write/read operation Chip select can not be deactivated for the transaction.

Parameters
[in]win*window structure
[in]xX Start
[in]yY Start
Returns
color in 565 format

Definition at line 952 of file ili9341.c.

Referenced by tft_flood(), tft_floodline(), and user_tests().

void tft_readRect ( window win,
int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
uint16_t color 
)

Definition at line 837 of file ili9341.c.

Referenced by loop(), and tft_Vscroll().

MEMSPACE uint32_t tft_readRegister ( uint8_t  command,
uint8_t  parameter 
)

====================================

====================================================================== SPIRead parameters on SPI bus ILI9341 displays For those displays that do not have the EXTC pin asserted. This undocumented command overrides the restriction for reading command parameters. Notes: SPI configurations See M:[0-3] control bits in ILI9341 documenation

  • Refer to interface I and II modes. Most ILI9341 displays are using interface I, (Rather the interface II mode)
    Parameters
    [in]commandcommand whose parameters we want to read
    [in]parameterparameter number
    Returns
    16bit value

Definition at line 166 of file ili9341.c.

Referenced by tft_readId().

int32_t tft_rel_window ( window win,
int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h 
)

Set the ili9341 working window by relative position and size Note: Function clips x,y,w,y.

Parameters
[in]win*window structure
[in]xStarting X offset
[in]yStarting Y offset
[in]wWidth
[in]hHeight
Returns
bytes w * h after clipping, 0 on error

Definition at line 140 of file ili9341.c.

Referenced by tft_bit_blit(), tft_drawPixel(), tft_FillPolyLine(), tft_fillRectWH(), tft_readPixel(), tft_readRect(), and tft_writeRect().

MEMSPACE void tft_set_font ( window win,
uint16_t  index 
)

Set current font size (per current rotation)

Parameters
[in]win*window structure
[in]indexfont index (for array of fonts) return: void

Definition at line 1267 of file ili9341.c.

Referenced by test_types(), and user_loop().

MEMSPACE void tft_set_textpos ( window win,
int16_t  x,
int16_t  y 
)

Set current window text pointer in characters (per current rotation) - overall font bounding box.

Parameters
[in]win*window structure
[in]xx offset
[in]yy oofset return: void

Definition at line 1254 of file ili9341.c.

Referenced by test_types(), and user_loop().

MEMSPACE void tft_setpos ( window win,
int16_t  x,
int16_t  y 
)

Set current window text pointer in pixels (per current rotation)

Parameters
[in]win*window structure
[in]xx offset
[in]yy oofset return: void

Definition at line 1241 of file ili9341.c.

MEMSPACE void tft_setRotation ( uint8_t  m)

Set Display rotation, applies to the master window only Set hardware display rotation and memory fill option bits Update software display limits FIXME Work in progress.

  • do we want to handle exchanging min/max values - rather then set them ?
    Returns
    void

Definition at line 982 of file ili9341.c.

Referenced by test_types(), tft_init(), and user_tests().

MEMSPACE void tft_setTextColor ( window win,
uint16_t  fg,
uint16_t  bg 
)

====================================

Set text forground and background color

Parameters
[in]win*window structure
[in]fgforground color
[in]bgbackground color
Returns
void

Definition at line 1228 of file ili9341.c.

Referenced by test_types().

void tft_Vscroll ( window win,
int  dir 
)

Scroll window up by dir lines We start at the top of the window and move down.

Parameters
[in]win*window structure
[in]dirdirection and count TODO +/- scroll direction TODO +/- Horizontal scroll functions

Definition at line 903 of file ili9341.c.

Referenced by tft_drawChar().

MEMSPACE int tft_window_clip ( window win)

Clip window structure to TFT limits.

Parameters
[in]win*window structure
Returns
0 - or - count of clipped values FIXME check negitive offsets, etc

Definition at line 1059 of file ili9341.c.

MEMSPACE int tft_window_clip_args ( window win,
int16_t *  x,
int16_t *  y,
int16_t *  w,
int16_t *  h 
)

clip arguments to window limits Arguments position x,y width w and height h to be clipped

Parameters
[in]*winwindow structure we will use to clip arguments to.
[in]*xX argument offset
[in]*yY argument offset
[in]*wW argument width
[in]*hH argument height
Returns
void FIXME check negitive offsets, etc

Definition at line 1145 of file ili9341.c.

Referenced by tft_abs_window(), tft_bit_blit(), and tft_window_init().

MEMSPACE void tft_window_init ( window win,
int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h 
)

Initialize window structure we default values FIXME check x+w, y+h absolute limits against TFT limuts.

Parameters
[in]win*window structure
[in]xX offset to window start - absolute
[in]yY offset to window start - absolute
[in]wWindow width
[in]hWindow Height
Returns
void

Definition at line 1198 of file ili9341.c.

Referenced by test_types(), and tft_init().

void tft_writeRect ( window win,
int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
uint16_t color 
)

Write a rectangle pixel array.

Parameters
[in]win*window structure
[in]xX offset
[in]yY offset
[in]wWidth
[in]hHeight
[in]*colorpixel array in 565 format
Returns
void

Definition at line 745 of file ili9341.c.

Referenced by tft_drawBitmap(), and tft_Vscroll().

Variable Documentation

int ind
window* tft = &tftwin

Definition at line 45 of file ili9341.c.

window tftwin

Definition at line 44 of file ili9341.c.

int16_t x[XYSTACK+2]
struct { ... } xy
int16_t y[XYSTACK+2]