ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts  1.0
ESP8266ILI9341DisplayProject
Data Structures | Macros | Functions
ili9341_adafruit.h File Reference
#include "font.h"
#include "ili9341.h"
#include "ili9341_adafruit.h"

Go to the source code of this file.

Data Structures

union  uint32_t_bytes
 

Macros

#define MEMSPACE
 
#define WEAK_ATR   __attribute__((weak))
 
#define MIN_TFT_Y   0
 
#define MAX_TFT_Y   319
 
#define MIN_TFT_X   0
 
#define MAX_TFT_X   239
 
#define MADCTL_MY   0x80
 
#define MADCTL_MX   0x40
 
#define MADCTL_MV   0x20
 
#define MADCTL_ML   0x10
 
#define MADCTL_BGR   0x08
 
#define MADCTL_RGB   0x00
 
#define MADCTL_MH   0x04
 
#define ILI9341_NOP   0x00
 
#define ILI9341_SWRESET   0x01
 
#define ILI9341_RDDID   0x04
 
#define ILI9341_RDDST   0x09
 
#define ILI9341_SLPIN   0x10
 
#define ILI9341_SLPOUT   0x11
 
#define ILI9341_PTLON   0x12
 
#define ILI9341_NORON   0x13
 
#define ILI9341_RDMODE   0x0A
 
#define ILI9341_RDMADCTL   0x0B
 
#define ILI9341_RDPIXFMT   0x0C
 
#define ILI9341_RDIMGFMT   0x0A
 
#define ILI9341_RDSELFDIAG   0x0F
 
#define ILI9341_INVOFF   0x20
 
#define ILI9341_INVON   0x21
 
#define ILI9341_GAMMASET   0x26
 
#define ILI9341_DISPOFF   0x28
 
#define ILI9341_DISPON   0x29
 
#define ILI9341_CASET   0x2A
 
#define ILI9341_PASET   0x2B
 
#define ILI9341_RAMWR   0x2C
 
#define ILI9341_RAMRD   0x2E
 
#define ILI9341_PTLAR   0x30
 
#define ILI9341_MADCTL   0x36
 
#define ILI9341_PIXFMT   0x3A
 
#define ILI9341_FRMCTR1   0xB1
 
#define ILI9341_FRMCTR2   0xB2
 
#define ILI9341_FRMCTR3   0xB3
 
#define ILI9341_INVCTR   0xB4
 
#define ILI9341_DFUNCTR   0xB6
 
#define ILI9341_PWCTR1   0xC0
 
#define ILI9341_PWCTR2   0xC1
 
#define ILI9341_PWCTR3   0xC2
 
#define ILI9341_PWCTR4   0xC3
 
#define ILI9341_PWCTR5   0xC4
 
#define ILI9341_VMCTR1   0xC5
 
#define ILI9341_VMCTR2   0xC7
 
#define ILI9341_RDID1   0xDA
 
#define ILI9341_RDID2   0xDB
 
#define ILI9341_RDID3   0xDC
 
#define ILI9341_RDID4   0xDD
 
#define ILI9341_GMCTRP1   0xE0
 
#define ILI9341_GMCTRN1   0xE1
 
#define ILI9341_BLACK   0x0000 /, 0, 0 */
 
#define ILI9341_NAVY   0x000F /* 0, 0, 128 */
 
#define ILI9341_DARKGREEN   0x03E0 /* 0, 128, 0 */
 
#define ILI9341_DARKCYAN   0x03EF /* 0, 128, 128 */
 
#define ILI9341_MAROON   0x7800 /* 128, 0, 0 */
 
#define ILI9341_PURPLE   0x780F /* 128, 0, 128 */
 
#define ILI9341_OLIVE   0x7BE0 /* 128, 128, 0 */
 
#define ILI9341_LIGHTGREY   0xC618 /* 192, 192, 192 */
 
#define ILI9341_DARKGREY   0x7BEF /* 128, 128, 128 */
 
#define ILI9341_BLUE   0x001F /* 0, 0, 255 */
 
#define ILI9341_GREEN   0x07E0 /* 0, 255, 0 */
 
#define ILI9341_CYAN   0x07FF /* 0, 255, 255 */
 
#define ILI9341_RED   0xF800 /* 255, 0, 0 */
 
#define ILI9341_MAGENTA   0xF81F /* 255, 0, 255 */
 
#define ILI9341_YELLOW   0xFFE0 /* 255, 255, 0 */
 
#define ILI9341_WHITE   0xFFFF /* 255, 255, 255 */
 
#define ILI9341_ORANGE   0xFD20 /* 255, 165, 0 */
 
#define ILI9341_GREENYELLOW   0xAFE5 /* 173, 255, 47 */
 
#define ILI9341_PINK   0xF81F
 

Functions

MEMSPACE void tft_configRegister (void)
 Initialize ILI9341 display. More...
 
MEMSPACE void tft_drawBitmap (window *win, int16_t x, int16_t y, const uint16_t *bitmap, int16_t w, int16_t h)
 Draw bitmap Replaced by tft_writeRect() More...
 
MEMSPACE void tft_drawCircle (window *win, int16_t x0, int16_t y0, int16_t r, uint16_t color)
 Draw a circle outline. More...
 
MEMSPACE void tft_drawCircleHelper (window *win, int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color)
 Draw a circle helper. More...
 
MEMSPACE void tft_fillCircleHelper (window *win, int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color)
 Fill circle helper. More...
 
MEMSPACE void tft_fillCircle (window *win, int16_t x0, int16_t y0, int16_t r, uint16_t color)
 Fill circle. More...
 
MEMSPACE void tft_drawRect (window *win, int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 Draw a rectangle. More...
 
MEMSPACE void tft_drawRoundRect (window *win, int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, uint16_t color)
 Draw a rounded rectangle. More...
 
MEMSPACE void tft_fillRoundRect (window *win, int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, uint16_t color)
 Fill a rounded rectangle. More...
 
MEMSPACE void tft_drawTriangle (window *win, int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 Draw a triangle. More...
 
MEMSPACE void tft_fillTriangle (window *win, int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 Fill a triangle. More...
 

Detailed Description

Copyright (c) 2013 Adafruit Industries. All rights reserved.
Minor Revisions by 2015 Mike Gore to add multiple window support
See also
https://github.com/adafruit/Adafruit-GFX-Library

Definition in file ili9341_adafruit.h.

Macro Definition Documentation

#define ILI9341_BLACK   0x0000 /, 0, 0 */

Definition at line 146 of file ili9341_adafruit.h.

#define ILI9341_BLUE   0x001F /* 0, 0, 255 */

Definition at line 155 of file ili9341_adafruit.h.

Referenced by test_types().

#define ILI9341_CASET   0x2A

Definition at line 109 of file ili9341_adafruit.h.

#define ILI9341_CYAN   0x07FF /* 0, 255, 255 */

Definition at line 157 of file ili9341_adafruit.h.

#define ILI9341_DARKCYAN   0x03EF /* 0, 128, 128 */

Definition at line 149 of file ili9341_adafruit.h.

#define ILI9341_DARKGREEN   0x03E0 /* 0, 128, 0 */

Definition at line 148 of file ili9341_adafruit.h.

#define ILI9341_DARKGREY   0x7BEF /* 128, 128, 128 */

Definition at line 154 of file ili9341_adafruit.h.

#define ILI9341_DFUNCTR   0xB6

Definition at line 122 of file ili9341_adafruit.h.

#define ILI9341_DISPOFF   0x28

Definition at line 106 of file ili9341_adafruit.h.

#define ILI9341_DISPON   0x29

Definition at line 107 of file ili9341_adafruit.h.

#define ILI9341_FRMCTR1   0xB1

Definition at line 118 of file ili9341_adafruit.h.

#define ILI9341_FRMCTR2   0xB2

Definition at line 119 of file ili9341_adafruit.h.

#define ILI9341_FRMCTR3   0xB3

Definition at line 120 of file ili9341_adafruit.h.

#define ILI9341_GAMMASET   0x26

Definition at line 105 of file ili9341_adafruit.h.

#define ILI9341_GMCTRN1   0xE1

Definition at line 138 of file ili9341_adafruit.h.

#define ILI9341_GMCTRP1   0xE0

Definition at line 137 of file ili9341_adafruit.h.

#define ILI9341_GREEN   0x07E0 /* 0, 255, 0 */

Definition at line 156 of file ili9341_adafruit.h.

#define ILI9341_GREENYELLOW   0xAFE5 /* 173, 255, 47 */

Definition at line 163 of file ili9341_adafruit.h.

#define ILI9341_INVCTR   0xB4

Definition at line 121 of file ili9341_adafruit.h.

#define ILI9341_INVOFF   0x20

Definition at line 103 of file ili9341_adafruit.h.

Referenced by tft_invertDisplay().

#define ILI9341_INVON   0x21

Definition at line 104 of file ili9341_adafruit.h.

Referenced by tft_invertDisplay().

#define ILI9341_LIGHTGREY   0xC618 /* 192, 192, 192 */

Definition at line 153 of file ili9341_adafruit.h.

#define ILI9341_MADCTL   0x36

Definition at line 115 of file ili9341_adafruit.h.

Referenced by tft_setRotation().

#define ILI9341_MAGENTA   0xF81F /* 255, 0, 255 */

Definition at line 159 of file ili9341_adafruit.h.

#define ILI9341_MAROON   0x7800 /* 128, 0, 0 */

Definition at line 150 of file ili9341_adafruit.h.

#define ILI9341_NAVY   0x000F /* 0, 0, 128 */

Definition at line 147 of file ili9341_adafruit.h.

Referenced by test_types().

#define ILI9341_NOP   0x00

Definition at line 87 of file ili9341_adafruit.h.

#define ILI9341_NORON   0x13

Definition at line 95 of file ili9341_adafruit.h.

#define ILI9341_OLIVE   0x7BE0 /* 128, 128, 0 */

Definition at line 152 of file ili9341_adafruit.h.

#define ILI9341_ORANGE   0xFD20 /* 255, 165, 0 */

Definition at line 162 of file ili9341_adafruit.h.

#define ILI9341_PASET   0x2B

Definition at line 110 of file ili9341_adafruit.h.

#define ILI9341_PINK   0xF81F

Definition at line 164 of file ili9341_adafruit.h.

#define ILI9341_PIXFMT   0x3A

Definition at line 116 of file ili9341_adafruit.h.

#define ILI9341_PTLAR   0x30

Definition at line 114 of file ili9341_adafruit.h.

#define ILI9341_PTLON   0x12

Definition at line 94 of file ili9341_adafruit.h.

#define ILI9341_PURPLE   0x780F /* 128, 0, 128 */

Definition at line 151 of file ili9341_adafruit.h.

#define ILI9341_PWCTR1   0xC0

Definition at line 124 of file ili9341_adafruit.h.

#define ILI9341_PWCTR2   0xC1

Definition at line 125 of file ili9341_adafruit.h.

#define ILI9341_PWCTR3   0xC2

Definition at line 126 of file ili9341_adafruit.h.

#define ILI9341_PWCTR4   0xC3

Definition at line 127 of file ili9341_adafruit.h.

#define ILI9341_PWCTR5   0xC4

Definition at line 128 of file ili9341_adafruit.h.

#define ILI9341_RAMRD   0x2E

Definition at line 112 of file ili9341_adafruit.h.

#define ILI9341_RAMWR   0x2C

Definition at line 111 of file ili9341_adafruit.h.

#define ILI9341_RDDID   0x04

Definition at line 89 of file ili9341_adafruit.h.

#define ILI9341_RDDST   0x09

Definition at line 90 of file ili9341_adafruit.h.

#define ILI9341_RDID1   0xDA

Definition at line 132 of file ili9341_adafruit.h.

#define ILI9341_RDID2   0xDB

Definition at line 133 of file ili9341_adafruit.h.

#define ILI9341_RDID3   0xDC

Definition at line 134 of file ili9341_adafruit.h.

#define ILI9341_RDID4   0xDD

Definition at line 135 of file ili9341_adafruit.h.

#define ILI9341_RDIMGFMT   0x0A

Definition at line 100 of file ili9341_adafruit.h.

#define ILI9341_RDMADCTL   0x0B

Definition at line 98 of file ili9341_adafruit.h.

#define ILI9341_RDMODE   0x0A

Definition at line 97 of file ili9341_adafruit.h.

#define ILI9341_RDPIXFMT   0x0C

Definition at line 99 of file ili9341_adafruit.h.

#define ILI9341_RDSELFDIAG   0x0F

Definition at line 101 of file ili9341_adafruit.h.

#define ILI9341_RED   0xF800 /* 255, 0, 0 */

Definition at line 158 of file ili9341_adafruit.h.

Referenced by test_types().

#define ILI9341_SLPIN   0x10

Definition at line 92 of file ili9341_adafruit.h.

#define ILI9341_SLPOUT   0x11

Definition at line 93 of file ili9341_adafruit.h.

#define ILI9341_SWRESET   0x01

Definition at line 88 of file ili9341_adafruit.h.

#define ILI9341_VMCTR1   0xC5

Definition at line 129 of file ili9341_adafruit.h.

#define ILI9341_VMCTR2   0xC7

Definition at line 130 of file ili9341_adafruit.h.

#define ILI9341_WHITE   0xFFFF /* 255, 255, 255 */

Definition at line 161 of file ili9341_adafruit.h.

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

#define ILI9341_YELLOW   0xFFE0 /* 255, 255, 0 */

Definition at line 160 of file ili9341_adafruit.h.

#define MADCTL_BGR   0x08

Definition at line 83 of file ili9341_adafruit.h.

Referenced by tft_setRotation().

#define MADCTL_MH   0x04

Definition at line 85 of file ili9341_adafruit.h.

#define MADCTL_ML   0x10

Definition at line 82 of file ili9341_adafruit.h.

#define MADCTL_MV   0x20

Definition at line 81 of file ili9341_adafruit.h.

Referenced by tft_setRotation().

#define MADCTL_MX   0x40

Definition at line 80 of file ili9341_adafruit.h.

Referenced by tft_setRotation().

#define MADCTL_MY   0x80

Definition at line 79 of file ili9341_adafruit.h.

Referenced by tft_setRotation().

#define MADCTL_RGB   0x00

Definition at line 84 of file ili9341_adafruit.h.

#define MAX_TFT_X   239

Definition at line 76 of file ili9341_adafruit.h.

#define MAX_TFT_Y   319

Definition at line 74 of file ili9341_adafruit.h.

#define MEMSPACE

This is the core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.). It needs to be paired with a hardware-specific library for each display device we carry (to handle the lower-level functions).

Adafruit invests time and resources providing this open source code, please support Adafruit & open-source hardware by purchasing products from Adafruit!

Copyright (c) 2013 Adafruit Industries. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition at line 50 of file ili9341_adafruit.h.

#define MIN_TFT_X   0

Definition at line 75 of file ili9341_adafruit.h.

#define MIN_TFT_Y   0

Definition at line 73 of file ili9341_adafruit.h.

#define WEAK_ATR   __attribute__((weak))

Definition at line 55 of file ili9341_adafruit.h.

Function Documentation

MEMSPACE void tft_configRegister ( void  )

Initialize ILI9341 display.

This is the core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.). It needs to be paired with a hardware-specific library for each display device we carry (to handle the lower-level functions).

Adafruit invests time and resources providing this open source code, please support Adafruit & open-source hardware by purchasing products from Adafruit!

Copyright (c) 2013 Adafruit Industries. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Returns
void

Definition at line 57 of file ili9341_adafruit.c.

Referenced by tft_init().

MEMSPACE void tft_drawBitmap ( window win,
int16_t  x,
int16_t  y,
const uint16_t bitmap,
int16_t  w,
int16_t  h 
)

Draw bitmap Replaced by tft_writeRect()

Parameters
[in]*winwindow structure
[in]xX offset
[in]yY offset
[in]*bitmapbitmap
[in]wWidth of bitmap
[in]hHeight of bitmap
Returns
void

Definition at line 184 of file ili9341_adafruit.c.

MEMSPACE void tft_drawCircle ( window win,
int16_t  x0,
int16_t  y0,
int16_t  r,
uint16_t  color 
)

Draw a circle outline.

Parameters
[in]*winwindow structure
[in]x0X offset
[in]y0Y offset
[in]rRadius of circle
[in]colorColor
Returns
void

Definition at line 201 of file ili9341_adafruit.c.

Referenced by user_loop().

MEMSPACE void tft_drawCircleHelper ( window win,
int16_t  x0,
int16_t  y0,
int16_t  r,
uint8_t  cornername,
uint16_t  color 
)

Draw a circle helper.

Parameters
[in]*winwindow structure
[in]x0X offset
[in]y0Y offset
[in]rRadius of circle
[in]cornernameCorner to draw
[in]colorColor
Returns
void

Definition at line 248 of file ili9341_adafruit.c.

Referenced by tft_drawRoundRect().

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

Draw a rectangle.

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

Definition at line 363 of file ili9341_adafruit.c.

MEMSPACE void tft_drawRoundRect ( window win,
int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
int16_t  r,
uint16_t  color 
)

Draw a rounded rectangle.

Parameters
[in]*winwindow structure
[in]xX offset
[in]yY offset
[in]wWidth
[in]hHeight
[in]rRadius
[in]colorColor
Returns
void

Definition at line 384 of file ili9341_adafruit.c.

MEMSPACE void tft_drawTriangle ( window win,
int16_t  x0,
int16_t  y0,
int16_t  x1,
int16_t  y1,
int16_t  x2,
int16_t  y2,
uint16_t  color 
)

Draw a triangle.

Parameters
[in]*winwindow structure
[in]x0X0 offset
[in]y0Y0 offset
[in]x1X1 offset
[in]y1Y1 offset
[in]x2X2 offset
[in]y2Y2 offset
[in]colorColor
Returns
void

Definition at line 437 of file ili9341_adafruit.c.

MEMSPACE void tft_fillCircle ( window win,
int16_t  x0,
int16_t  y0,
int16_t  r,
uint16_t  color 
)

Fill circle.

Parameters
[in]*winwindow structure
[in]x0X offset
[in]y0Y offset
[in]rRadius
[in]colorColor
Returns
void

Definition at line 346 of file ili9341_adafruit.c.

MEMSPACE void tft_fillCircleHelper ( window win,
int16_t  x0,
int16_t  y0,
int16_t  r,
uint8_t  cornername,
int16_t  delta,
uint16_t  color 
)

Fill circle helper.

Parameters
[in]*winwindow structure
[in]x0X offset
[in]y0Y offset
[in]rRadius of circle
[in]cornernameCorner to draw
[in]deltaX or X offset
[in]colorColor
Returns
void

Definition at line 302 of file ili9341_adafruit.c.

Referenced by tft_fillCircle(), and tft_fillRoundRect().

MEMSPACE void tft_fillRoundRect ( window win,
int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
int16_t  r,
uint16_t  color 
)

Fill a rounded rectangle.

Parameters
[in]*winwindow structure
[in]xX offset
[in]yY offset
[in]wWidth
[in]hHeight
[in]rRadius
[in]colorColor
Returns
void

Definition at line 414 of file ili9341_adafruit.c.

MEMSPACE void tft_fillTriangle ( window win,
int16_t  x0,
int16_t  y0,
int16_t  x1,
int16_t  y1,
int16_t  x2,
int16_t  y2,
uint16_t  color 
)

Fill a triangle.

Parameters
[in]*winwindow structure
[in]x0X0 offset
[in]y0Y0 offset
[in]x1X1 offset
[in]y1Y1 offset
[in]x2X2 offset
[in]y2Y2 offset
[in]colorColor
Returns
void

Definition at line 458 of file ili9341_adafruit.c.