COSA
An Object-Oriented Platform for Arduino Programming
|
#include <ILI9341.hh>
Public Types | |
enum | { BLACK = 0x0000U, WHITE = 0xFFFFU, RED = 0xF800U, GREEN = 0x07E0U, BLUE = 0x001FU, YELLOW = RED + GREEN, CYAN = GREEN + BLUE, MAGENTA = RED + BLUE } |
enum | { PORTRAIT = 0, LANDSCAPE = 1 } |
enum | { END_SCRIPT = 0, CALL_SCRIPT, SET_CANVAS_COLOR, SET_PEN_COLOR, SET_TEXT_COLOR, SET_TEXT_SCALE, SET_TEXT_FONT, SET_CURSOR, MOVE_CURSOR, DRAW_BITMAP, DRAW_ICON, DRAW_PIXEL, DRAW_LINE, DRAW_POLY, DRAW_STROKE, DRAW_RECT, FILL_RECT, DRAW_ROUNDRECT, FILL_ROUNDRECT, DRAW_CIRCLE, FILL_CIRCLE, DRAW_CHAR, DRAW_STRING, FILL_SCREEN } |
Public Member Functions | |
ILI9341 (Board::DigitalPin cs=Board::D10, Board::DigitalPin dc=Board::D9) | |
virtual bool | begin () |
virtual uint8_t | set_orientation (uint8_t direction) |
virtual void | draw_pixel (uint16_t x, uint16_t y) |
void | draw_pixel () |
virtual void | draw_image (uint16_t x, uint16_t y, Image *image) |
void | draw_image (Image *image) |
virtual void | draw_vertical_line (uint16_t x, uint16_t y, uint16_t length) |
void | draw_vertical_line (uint16_t length) |
virtual void | draw_horizontal_line (uint16_t x, uint16_t y, uint16_t length) |
void | draw_horizontal_line (uint16_t length) |
virtual void | fill_rect (uint16_t x, uint16_t y, uint16_t width, uint16_t height) |
void | fill_rect (uint16_t width, uint16_t height) |
virtual bool | end () |
Context * | get_context () const |
Context * | set_context (Context *context) |
color16_t | get_canvas_color () const |
color16_t | set_canvas_color (color16_t color) |
color16_t | get_pen_color () const |
color16_t | set_pen_color (color16_t color) |
color16_t | get_text_color () const |
color16_t | set_text_color (color16_t color) |
Font * | get_text_font () const |
Font * | set_text_font (Font *font) |
uint8_t | get_text_scale () const |
uint8_t | set_text_scale (uint8_t scale) |
void | get_cursor (uint16_t &x, uint16_t &y) const |
void | set_cursor (uint16_t x, uint16_t y) |
void | move_cursor (int16_t dx, int16_t dy) |
color16_t | color (uint8_t red, uint8_t green, uint8_t blue) |
virtual uint8_t | get_orientation () |
virtual void | draw_bitmap (uint16_t x, uint16_t y, const uint8_t *bp, uint16_t width, uint16_t height, uint8_t scale=1) |
void | draw_bitmap (const uint8_t *bp, uint16_t width, uint16_t height, uint8_t scale=1) |
virtual void | draw_icon (uint16_t x, uint16_t y, const uint8_t *bp, uint16_t width, uint16_t height, uint8_t scale=1) |
virtual void | draw_icon (uint16_t x, uint16_t y, const uint8_t *bp, uint8_t scale=1) |
void | draw_icon (const uint8_t *bp, uint8_t scale=1) |
virtual void | draw_line (uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) |
void | draw_line (uint16_t x1, uint16_t y1) |
virtual void | draw_poly_P (const int8_t *poly, uint8_t scale=1) |
virtual void | draw_stroke_P (const int8_t *stroke, uint8_t scale=1) |
virtual void | draw_rect (uint16_t x, uint16_t y, uint16_t width, uint16_t height) |
void | draw_rect (uint16_t width, uint16_t height) |
virtual void | draw_roundrect (uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t radius) |
void | draw_roundrect (uint16_t width, uint16_t height, uint16_t radius) |
virtual void | fill_roundrect (uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t radius) |
void | fill_roundrect (uint16_t width, uint16_t height, uint16_t radius) |
virtual void | draw_circle (uint16_t x, uint16_t y, uint16_t radius) |
void | draw_circle (uint16_t radius) |
virtual void | fill_circle (uint16_t x, uint16_t y, uint16_t radius) |
void | fill_circle (uint16_t radius) |
virtual void | draw_char (uint16_t x, uint16_t y, char c) |
void | draw_char (char c) |
virtual void | draw_string (char *s) |
virtual void | draw_string (str_P s) |
virtual void | fill_screen () |
void | run (uint8_t ix, const void_P *tab, uint8_t max) |
Static Public Member Functions | |
static color16_t | shade (color16_t color, uint8_t scale) |
static color16_t | blend (color16_t c1, color16_t c2) |
Public Attributes | |
uint16_t | WIDTH |
uint16_t | HEIGHT |
Static Public Attributes | |
static const uint16_t | SCREEN_WIDTH = 240 |
static const uint16_t | SCREEN_HEIGHT = 320 |
Protected Types | |
enum | Command { NOP = 0x0, SWRESET = 0x01, SWDELAY = 0x02, SCRIPTEND = 0x03, RDDIDIF = 0x04, RDDST = 0x09, RDDPM = 0x0A, RDDMADCTL = 0x0B, RDDCOLMOD = 0x0C, RDDIM = 0x0D, RDDSM = 0x0E, RDDSDR = 0x0F, SLPIN = 0x10, SLPOUT = 0x11, PTLON = 0x12, NORON = 0x13, DINVOFF = 0x20, DINVON = 0x21, GAMSET = 0x26, DISPOFF = 0x28, DISPON = 0x29, CASET = 0x2A, PASET = 0x2B, RASET = 0x2B, RAMWR = 0x2C, RGBSET = 0x2D, RAMRD = 0x2E, PTLAR = 0x30, VSCRDEF = 0x33, TEOFF = 0x34, TEON = 0x35, MADCTL = 0x36, VSCRSADD = 0x37, IDMOFF = 0x38, IDMON = 0x39, PIXSET = 0x3A, COLMOD = 0x3A, RAMWRC = 0x3C, RAMRDC = 0x3E, SETSCANLINE = 0x44, GETSCANLINE = 0x45, WRDISBV = 0x51, RDDISBV = 0x52, WRCTRLD = 0x53, RDCTRLD = 0x54, WRCABC = 0x55, RDCABC = 0x56, WRCABCMIN = 0x5E, RDCABCMIN = 0x5F, RDID1 = 0xDA, RDID2 = 0xDB, RDID3 = 0xDC, IFMODE = 0xB0, FRMCTR1 = 0xB1, FRMCTR2 = 0xB2, FRMCTR3 = 0xB3, INVCTR = 0xB4, PRCTR = 0xB5, DISCTRL = 0xB6, ETMOD = 0xB7, BLCTRL1 = 0xB8, BLCTRL2 = 0xB9, BLCTRL3 = 0xBA, BLCTRL4 = 0xBB, BLCTRL5 = 0xBC, BLCTRL6 = 0xBD, BLCTRL7 = 0xBE, BLCTRL8 = 0xBF, PWCTRL1 = 0xC0, PWCTRL2 = 0xC1, PWCTRL3 = 0xC2, PWCTRL4 = 0xC3, PWCTRL5 = 0xC4, PWCTRL6 = 0xFC, VMCTRL1 = 0xC5, VMCTRL2 = 0xC7, NVMWR = 0xD0, NVMPKEY = 0xD1, RDNVM = 0xD2, RDID4 = 0xD3, PGAMCTRL = 0xE0, GMCTRP1 = 0xE0, NGAMCTRL = 0xE1, GMCTRN1 = 0xE1, DGAMCTRL1 = 0xE2, DGAMCTRL2 = 0xE3, IFCTRL = 0xF6, PWCTRLA = 0xCB, PWCTRLB = 0xCF, DTCTRLA = 0xE8, DTCTRLB = 0xEA, PWONCTRL = 0xED, EXTCTRL = 0xF0, EN3GAM = 0xF2, PRCTRL = 0xF7, VCOM4L = 0xFF } |
enum | { MADCTL_MH = 0x04, MADCTL_ML = 0x10, MADCTL_MV = 0x20, MADCTL_MX = 0x40, MADCTL_MY = 0x80, MADCTL_BGR = 0x08, MADCTL_RGB = 0x00 } |
Protected Member Functions | |
virtual const uint8_t * | script () |
void | write (uint16_t data) |
void | write (uint16_t data, uint16_t count) |
void | write (Command cmd) |
void | write (Command cmd, uint8_t data) |
void | write (Command cmd, uint16_t data) |
void | write (Command cmd, uint16_t x, uint16_t y) |
void | set_clock (Clock rate) |
void | set_clock (uint32_t freq) |
Static Protected Member Functions | |
static Clock | clock (uint32_t freq) |
static Clock | cycle (uint16_t ns) |
Protected Attributes | |
OutputPin | m_dc |
Data/Command select pin. More... | |
bool | m_initiated |
Initialization state. More... | |
Context * | m_context |
uint8_t | m_direction |
Driver * | m_next |
List of drivers. More... | |
Interrupt::Handler * | m_irq |
Interrupt handler. More... | |
OutputPin | m_cs |
Device chip select pin. More... | |
Pulse | m_pulse |
Chip select pulse width. More... | |
uint8_t | m_spcr |
SPI/SPCR hardware control register setting. More... | |
uint8_t | m_spsr |
SPI/SPSR hardware status register. More... | |
Static Protected Attributes | |
static const uint8_t | s_script [] |
static Context | context |
Device driver for ILI9341, TFT LCD Single Chip Driver, 240x320 Resolution and max 262K color. The device driver uses 16-bit color. See Canvas and GDDRAM abstract driver.
Please note that 3V3 level signals are required. The reset signal is optional.
Inspired by graphics library by ladyada/adafruit.
Definition at line 57 of file ILI9341.hh.
|
protectedinherited |
|
inherited |
|
inherited |
Canvas script instructions. See macro set below for arguments.
|
protectedinherited |
ILI9341::ILI9341 | ( | Board::DigitalPin | cs = Board::D10 , |
Board::DigitalPin | dc = Board::D9 |
||
) |
Construct ILI9341 canvas object with given control pins.
[in] | cs | slave selection pin (default pin 10). |
[in] | dc | data/command selection pin (default pin 9). |
Definition at line 99 of file ILI9341.cpp.
|
virtualinherited |
Start interaction with device.
Implements Canvas.
Definition at line 35 of file GDDRAM.cpp.
|
staticinherited |
Blend the two colors.
[in] | c1. | |
[in] | c2. |
Definition at line 39 of file Canvas.cpp.
|
inlinestaticinherited |
|
inlineinherited |
|
inlinestaticinherited |
|
virtualinherited |
Draw bitmap with current pen color. The bitmap must be stored in program memory.
[in] | x. | |
[in] | y. | |
[in] | bp. | |
[in] | width. | |
[in] | height. | |
[in] | scale. |
Definition at line 69 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Draw character with current text color, font and scale.
[in] | x | position. |
[in] | y | position. |
[in] | c | character. |
Definition at line 378 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Draw circle with current pen color.
[in] | x. | |
[in] | y. | |
[in] | radius. |
Definition at line 247 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Draw horizontal line with current color.
[in] | x. | |
[in] | y. | |
[in] | length. |
Reimplemented from Canvas.
Definition at line 148 of file GDDRAM.cpp.
|
inlineinherited |
|
virtualinherited |
Draw icon at given position with current pen color. The icon must be stored in program memory.
[in] | x. | |
[in] | y. | |
[in] | bp. | |
[in] | width. | |
[in] | height. | |
[in] | scale. |
Definition at line 105 of file Canvas.cpp.
|
virtualinherited |
Draw icon at given position with current pen color. The icon must be stored in program memory.
[in] | x. | |
[in] | y. | |
[in] | bp. | |
[in] | scale. |
Definition at line 113 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Draw image on canvas at given position.
[in] | x. | |
[in] | y. | |
[in] | image. |
Reimplemented from Canvas.
Definition at line 99 of file GDDRAM.cpp.
|
inlineinherited |
|
virtualinherited |
Draw line with current pen color.
[in] | x0. | |
[in] | y0. | |
[in] | x1. | |
[in] | y1. |
Definition at line 167 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Set pixel with current color.
[in] | x. | |
[in] | y. |
Reimplemented from Canvas.
Definition at line 85 of file GDDRAM.cpp.
|
inlineinherited |
|
virtualinherited |
Draw polygon from program memory with current pen color. Vector of delta positions, terminate with 0, 0. Update cursor to end position.
[in] | poly. | |
[in] | scale. |
Definition at line 210 of file Canvas.cpp.
|
virtualinherited |
Draw rectangle with current pen color.
[in] | x. | |
[in] | y. | |
[in] | width. | |
[in] | height. |
Definition at line 142 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Draw round corner rectangle with current pen color.
[in] | x. | |
[in] | y. | |
[in] | width. | |
[in] | height. | |
[in] | radius. |
Definition at line 301 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Draw string in current text color, font and scale.
[in] | s | string. |
Definition at line 389 of file Canvas.cpp.
|
virtualinherited |
Draw string from program memory with current text color and font.
[in] | s | string in program memory (PSTR). |
Definition at line 397 of file Canvas.cpp.
|
virtualinherited |
Draw stroke from program memory with current pen color. Vector of delta positions, terminated with 0, 0. The cursor is moved for when both dx and dy are zero or negative. Update cursor to new position.
[in] | stroke. | |
[in] | scale. |
Definition at line 226 of file Canvas.cpp.
|
virtualinherited |
Draw vertical line with current color.
[in] | x | |
[in] | y | |
[in] | length. |
Reimplemented from Canvas.
Definition at line 126 of file GDDRAM.cpp.
|
inlineinherited |
|
virtualinherited |
Stop sequence of interaction with device.
Implements Canvas.
Definition at line 195 of file GDDRAM.cpp.
|
virtualinherited |
Fill circle with current pen color.
[in] | x. | |
[in] | y. | |
[in] | radius. |
Definition at line 280 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Fill rectangle with current color.
[in] | x. | |
[in] | y. | |
[in] | width. | |
[in] | height. |
Reimplemented from Canvas.
Definition at line 170 of file GDDRAM.cpp.
|
inlineinherited |
|
virtualinherited |
Fill round corner rectangle with current pen color.
[in] | x. | |
[in] | y. | |
[in] | width. | |
[in] | height. | |
[in] | radius. |
Definition at line 346 of file Canvas.cpp.
|
inlineinherited |
|
virtualinherited |
Fill screen with canvas color.
Reimplemented in OffScreen< width, height >.
Definition at line 406 of file Canvas.cpp.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
virtualinherited |
Get screen orientation.
Definition at line 49 of file Canvas.cpp.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inherited |
Run canvas drawing script. Table may contain sub-scripts, strings and icons. All should be in program memory. Use the support macro set to write scripts.
[in] | ix | script to run. |
[in] | tab | script table in program memory. |
[in] | max | size of script table. |
Definition at line 414 of file Canvas.cpp.
|
inlineprotectedvirtual |
Get initialization script (in program memory).
Implements GDDRAM.
Definition at line 87 of file ILI9341.hh.
|
inherited |
|
inlineinherited |
|
inlineinherited |
|
virtualinherited |
Set screen orientation.
[in] | direction. |
Reimplemented from Canvas.
Reimplemented in ILI9163, and ST7735.
Definition at line 62 of file GDDRAM.cpp.
|
inlineinherited |
|
staticinherited |
Create color shade (0..100%).
[in] | color. | |
[in] | scale. |
Definition at line 28 of file Canvas.cpp.
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
staticprotectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
staticprotected |
Initialization script (in program memory).
Definition at line 95 of file ILI9341.hh.
|
static |
Definition at line 79 of file ILI9341.hh.
|
static |
Screen size (width and height).
Definition at line 78 of file ILI9341.hh.
|
inherited |