COSA
An Object-Oriented Platform for Arduino Programming
ILI9341 Class Reference

#include <ILI9341.hh>

Inheritance diagram for ILI9341:
Inheritance graph
Collaboration diagram for ILI9341:
Collaboration graph

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 ()
 
Contextget_context () const
 
Contextset_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)
 
Fontget_text_font () const
 
Fontset_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...
 
Contextm_context
 
uint8_t m_direction
 
Driverm_next
 List of drivers. More...
 
Interrupt::Handlerm_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
 

Detailed Description

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.

Circuit

Please note that 3V3 level signals are required. The reset signal is optional.

+------------+
(VCC)---------------1-|VCC |
(GND)---------------2-|GND |
(SS/D10)------------3-|CS |
(RST*)--------------4-|RST |
(D9)----------------5-|DC |
(MOSI/D11)----------6-|SDI |
(SCK/D13)-----------7-|SCK |
(VCC)------[330]----8-|LED |
(MISO/D12)----------9-|SDO |
+------------+

References

  1. ILITEK. ILI9341 specification, V1.13, 2011-07-20.

Acknowledgements

Inspired by graphics library by ladyada/adafruit.

Definition at line 57 of file ILI9341.hh.

Member Enumeration Documentation

anonymous enum
protectedinherited

Memory Data Access Control (bits).

Enumerator
MADCTL_MH 
MADCTL_ML 
MADCTL_MV 
MADCTL_MX 
MADCTL_MY 
MADCTL_BGR 
MADCTL_RGB 

Definition at line 227 of file GDDRAM.hh.

anonymous enum
inherited

Basic color palette.

Enumerator
BLACK 
WHITE 
RED 
GREEN 
BLUE 
YELLOW 
CYAN 
MAGENTA 

Definition at line 100 of file Canvas.hh.

anonymous enum
inherited
Enumerator
PORTRAIT 
LANDSCAPE 

Definition at line 371 of file Canvas.hh.

anonymous enum
inherited

Canvas script instructions. See macro set below for arguments.

Enumerator
END_SCRIPT 
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 

Definition at line 970 of file Canvas.hh.

enum GDDRAM::Command
protectedinherited

GDDRAM SPI commands.

Enumerator
NOP 
SWRESET 
SWDELAY 
SCRIPTEND 
RDDIDIF 
RDDST 
RDDPM 
RDDMADCTL 
RDDCOLMOD 
RDDIM 
RDDSM 
RDDSDR 
SLPIN 
SLPOUT 
PTLON 
NORON 
DINVOFF 
DINVON 
GAMSET 
DISPOFF 
DISPON 
CASET 
PASET 
RASET 
RAMWR 
RGBSET 
RAMRD 
PTLAR 
VSCRDEF 
TEOFF 
TEON 
MADCTL 
VSCRSADD 
IDMOFF 
IDMON 
PIXSET 
COLMOD 
RAMWRC 
RAMRDC 
SETSCANLINE 
GETSCANLINE 
WRDISBV 
RDDISBV 
WRCTRLD 
RDCTRLD 
WRCABC 
RDCABC 
WRCABCMIN 
RDCABCMIN 
RDID1 
RDID2 
RDID3 
IFMODE 
FRMCTR1 
FRMCTR2 
FRMCTR3 
INVCTR 
PRCTR 
DISCTRL 
ETMOD 
BLCTRL1 
BLCTRL2 
BLCTRL3 
BLCTRL4 
BLCTRL5 
BLCTRL6 
BLCTRL7 
BLCTRL8 
PWCTRL1 
PWCTRL2 
PWCTRL3 
PWCTRL4 
PWCTRL5 
PWCTRL6 
VMCTRL1 
VMCTRL2 
NVMWR 
NVMPKEY 
RDNVM 
RDID4 
PGAMCTRL 
GMCTRP1 
NGAMCTRL 
GMCTRN1 
DGAMCTRL1 
DGAMCTRL2 
IFCTRL 
PWCTRLA 
PWCTRLB 
DTCTRLA 
DTCTRLB 
PWONCTRL 
EXTCTRL 
EN3GAM 
PRCTRL 
VCOM4L 

Definition at line 125 of file GDDRAM.hh.

Constructor & Destructor Documentation

ILI9341::ILI9341 ( Board::DigitalPin  cs = Board::D10,
Board::DigitalPin  dc = Board::D9 
)

Construct ILI9341 canvas object with given control pins.

Parameters
[in]csslave selection pin (default pin 10).
[in]dcdata/command selection pin (default pin 9).

Definition at line 99 of file ILI9341.cpp.

Member Function Documentation

bool GDDRAM::begin ( )
virtualinherited

Start interaction with device.

Returns
true(1) if successful otherwise false(0).

Implements Canvas.

Definition at line 35 of file GDDRAM.cpp.

Canvas::color16_t Canvas::blend ( color16_t  c1,
color16_t  c2 
)
staticinherited

Blend the two colors.

Parameters
[in]c1.
[in]c2.
Returns
color blend.

Definition at line 39 of file Canvas.cpp.

static Clock SPI::Driver::clock ( uint32_t  freq)
inlinestaticinherited

Calculate SPI clock rate (scale factor) for given frequency.

Parameters
[in]freqdevice max frequency (in Hz).
Returns
clock rate.

Definition at line 117 of file SPI.hh.

color16_t Canvas::color ( uint8_t  red,
uint8_t  green,
uint8_t  blue 
)
inlineinherited

Create 16-bit color from primary colors (RGB).

Parameters
[in]red.
[in]green.
[in]blue.
Returns
color.

Definition at line 549 of file Canvas.hh.

static Clock SPI::Driver::cycle ( uint16_t  ns)
inlinestaticinherited

Calculate SPI clock rate (scale factor) for given clock cycle time in nano seconds.

Parameters
[in]nsmin device clock cycle time.
Returns
clock rate.

Definition at line 135 of file SPI.hh.

void Canvas::draw_bitmap ( uint16_t  x,
uint16_t  y,
const uint8_t *  bp,
uint16_t  width,
uint16_t  height,
uint8_t  scale = 1 
)
virtualinherited

Draw bitmap with current pen color. The bitmap must be stored in program memory.

Parameters
[in]x.
[in]y.
[in]bp.
[in]width.
[in]height.
[in]scale.

Definition at line 69 of file Canvas.cpp.

void Canvas::draw_bitmap ( const uint8_t *  bp,
uint16_t  width,
uint16_t  height,
uint8_t  scale = 1 
)
inlineinherited

Draw bitmap at cursor position with current pen color. The bitmap must be stored in program memory.

Parameters
[in]bp.
[in]width.
[in]height.
[in]scale.

Definition at line 626 of file Canvas.hh.

void Canvas::draw_char ( uint16_t  x,
uint16_t  y,
char  c 
)
virtualinherited

Draw character with current text color, font and scale.

Parameters
[in]xposition.
[in]yposition.
[in]ccharacter.

Definition at line 378 of file Canvas.cpp.

void Canvas::draw_char ( char  c)
inlineinherited

Draw character with current text color, font and scale.

Parameters
[in]ccharacter.

Definition at line 933 of file Canvas.hh.

void Canvas::draw_circle ( uint16_t  x,
uint16_t  y,
uint16_t  radius 
)
virtualinherited

Draw circle with current pen color.

Parameters
[in]x.
[in]y.
[in]radius.

Definition at line 247 of file Canvas.cpp.

void Canvas::draw_circle ( uint16_t  radius)
inlineinherited

Draw circle at cursor position with current pen color.

Parameters
[in]radius.

Definition at line 893 of file Canvas.hh.

void GDDRAM::draw_horizontal_line ( uint16_t  x,
uint16_t  y,
uint16_t  length 
)
virtualinherited

Draw horizontal line with current color.

Parameters
[in]x.
[in]y.
[in]length.

Reimplemented from Canvas.

Definition at line 148 of file GDDRAM.cpp.

void Canvas::draw_horizontal_line ( uint16_t  length)
inlineinherited

Draw horizontal line with given length and current pen color. Update cursor to new position.

Parameters
[in]length.

Definition at line 757 of file Canvas.hh.

void Canvas::draw_icon ( uint16_t  x,
uint16_t  y,
const uint8_t *  bp,
uint16_t  width,
uint16_t  height,
uint8_t  scale = 1 
)
virtualinherited

Draw icon at given position with current pen color. The icon must be stored in program memory.

Parameters
[in]x.
[in]y.
[in]bp.
[in]width.
[in]height.
[in]scale.

Definition at line 105 of file Canvas.cpp.

void Canvas::draw_icon ( uint16_t  x,
uint16_t  y,
const uint8_t *  bp,
uint8_t  scale = 1 
)
virtualinherited

Draw icon at given position with current pen color. The icon must be stored in program memory.

Parameters
[in]x.
[in]y.
[in]bp.
[in]scale.

Definition at line 113 of file Canvas.cpp.

void Canvas::draw_icon ( const uint8_t *  bp,
uint8_t  scale = 1 
)
inlineinherited

Draw icon at cursor position with current pen color. The icon must be stored in program memory.

Parameters
[in]bp.
[in]scale.

Definition at line 668 of file Canvas.hh.

void GDDRAM::draw_image ( uint16_t  x,
uint16_t  y,
Image image 
)
virtualinherited

Draw image on canvas at given position.

Parameters
[in]x.
[in]y.
[in]image.

Reimplemented from Canvas.

Definition at line 99 of file GDDRAM.cpp.

void Canvas::draw_image ( Image image)
inlineinherited

Draw image on canvas at current position.

Parameters
[in]image.

Definition at line 691 of file Canvas.hh.

void Canvas::draw_line ( uint16_t  x0,
uint16_t  y0,
uint16_t  x1,
uint16_t  y1 
)
virtualinherited

Draw line with current pen color.

Parameters
[in]x0.
[in]y0.
[in]x1.
[in]y1.

Definition at line 167 of file Canvas.cpp.

void Canvas::draw_line ( uint16_t  x1,
uint16_t  y1 
)
inlineinherited

Draw line to given position with current color. Update cursor to new position.

Parameters
[in]x1.
[in]y1.

Definition at line 714 of file Canvas.hh.

void GDDRAM::draw_pixel ( uint16_t  x,
uint16_t  y 
)
virtualinherited

Set pixel with current color.

Parameters
[in]x.
[in]y.

Reimplemented from Canvas.

Definition at line 85 of file GDDRAM.cpp.

void Canvas::draw_pixel ( )
inlineinherited

Set pixel at cursor position with current pen color.

Definition at line 596 of file Canvas.hh.

void Canvas::draw_poly_P ( const int8_t *  poly,
uint8_t  scale = 1 
)
virtualinherited

Draw polygon from program memory with current pen color. Vector of delta positions, terminate with 0, 0. Update cursor to end position.

Parameters
[in]poly.
[in]scale.

Definition at line 210 of file Canvas.cpp.

void Canvas::draw_rect ( uint16_t  x,
uint16_t  y,
uint16_t  width,
uint16_t  height 
)
virtualinherited

Draw rectangle with current pen color.

Parameters
[in]x.
[in]y.
[in]width.
[in]height.

Definition at line 142 of file Canvas.cpp.

void Canvas::draw_rect ( uint16_t  width,
uint16_t  height 
)
inlineinherited

Draw rectangle at cursor position with current pen color.

Parameters
[in]width.
[in]height.

Definition at line 799 of file Canvas.hh.

void Canvas::draw_roundrect ( uint16_t  x,
uint16_t  y,
uint16_t  width,
uint16_t  height,
uint16_t  radius 
)
virtualinherited

Draw round corner rectangle with current pen color.

Parameters
[in]x.
[in]y.
[in]width.
[in]height.
[in]radius.

Definition at line 301 of file Canvas.cpp.

void Canvas::draw_roundrect ( uint16_t  width,
uint16_t  height,
uint16_t  radius 
)
inlineinherited

Draw round corner rectangle at cursor position with current pen color.

Parameters
[in]width.
[in]height.
[in]radius.

Definition at line 847 of file Canvas.hh.

void Canvas::draw_string ( char *  s)
virtualinherited

Draw string in current text color, font and scale.

Parameters
[in]sstring.

Definition at line 389 of file Canvas.cpp.

void Canvas::draw_string ( str_P  s)
virtualinherited

Draw string from program memory with current text color and font.

Parameters
[in]sstring in program memory (PSTR).

Definition at line 397 of file Canvas.cpp.

void Canvas::draw_stroke_P ( const int8_t *  stroke,
uint8_t  scale = 1 
)
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.

Parameters
[in]stroke.
[in]scale.

Definition at line 226 of file Canvas.cpp.

void GDDRAM::draw_vertical_line ( uint16_t  x,
uint16_t  y,
uint16_t  length 
)
virtualinherited

Draw vertical line with current color.

Parameters
[in]x
[in]y
[in]length.

Reimplemented from Canvas.

Definition at line 126 of file GDDRAM.cpp.

void Canvas::draw_vertical_line ( uint16_t  length)
inlineinherited

Draw vertical line with given length and current pen color. Update cursor to new position.

Parameters
[in]length.

Definition at line 736 of file Canvas.hh.

bool GDDRAM::end ( )
virtualinherited

Stop sequence of interaction with device.

Returns
true(1) if successful otherwise false(0).

Implements Canvas.

Definition at line 195 of file GDDRAM.cpp.

void Canvas::fill_circle ( uint16_t  x,
uint16_t  y,
uint16_t  radius 
)
virtualinherited

Fill circle with current pen color.

Parameters
[in]x.
[in]y.
[in]radius.

Definition at line 280 of file Canvas.cpp.

void Canvas::fill_circle ( uint16_t  radius)
inlineinherited

Fill circle at cursor position with current pen color.

Parameters
[in]radius.

Definition at line 913 of file Canvas.hh.

void GDDRAM::fill_rect ( uint16_t  x,
uint16_t  y,
uint16_t  width,
uint16_t  height 
)
virtualinherited

Fill rectangle with current color.

Parameters
[in]x.
[in]y.
[in]width.
[in]height.

Reimplemented from Canvas.

Definition at line 170 of file GDDRAM.cpp.

void Canvas::fill_rect ( uint16_t  width,
uint16_t  height 
)
inlineinherited

Fill rectangle at cursor position with current pen color.

Parameters
[in]width.
[in]height.

Definition at line 821 of file Canvas.hh.

void Canvas::fill_roundrect ( uint16_t  x,
uint16_t  y,
uint16_t  width,
uint16_t  height,
uint16_t  radius 
)
virtualinherited

Fill round corner rectangle with current pen color.

Parameters
[in]x.
[in]y.
[in]width.
[in]height.
[in]radius.

Definition at line 346 of file Canvas.cpp.

void Canvas::fill_roundrect ( uint16_t  width,
uint16_t  height,
uint16_t  radius 
)
inlineinherited

Fill round corner rectangle at cursor position with current pen color.

Parameters
[in]width.
[in]height.
[in]radius.

Definition at line 873 of file Canvas.hh.

void Canvas::fill_screen ( )
virtualinherited

Fill screen with canvas color.

Reimplemented in OffScreen< width, height >.

Definition at line 406 of file Canvas.cpp.

color16_t Canvas::get_canvas_color ( ) const
inlineinherited

Get current canvas color.

Returns
color.

Definition at line 422 of file Canvas.hh.

Context* Canvas::get_context ( ) const
inlineinherited

Get current canvas context.

Returns
context.

Definition at line 401 of file Canvas.hh.

void Canvas::get_cursor ( uint16_t &  x,
uint16_t &  y 
) const
inlineinherited

Get current cursor position.

Parameters
[out]x.
[out]y.

Definition at line 517 of file Canvas.hh.

uint8_t Canvas::get_orientation ( )
virtualinherited

Get screen orientation.

Returns
direction (Canvas::LANDSCAPE/PORTRAIT).

Definition at line 49 of file Canvas.cpp.

color16_t Canvas::get_pen_color ( ) const
inlineinherited

Get current drawing color.

Returns
color.

Definition at line 441 of file Canvas.hh.

color16_t Canvas::get_text_color ( ) const
inlineinherited

Get current text color.

Returns
color.

Definition at line 460 of file Canvas.hh.

Font* Canvas::get_text_font ( ) const
inlineinherited

Get current text font.

Definition at line 478 of file Canvas.hh.

uint8_t Canvas::get_text_scale ( ) const
inlineinherited

Get current text scale.

Returns
text scale.

Definition at line 497 of file Canvas.hh.

void Canvas::move_cursor ( int16_t  dx,
int16_t  dy 
)
inlineinherited

Move current cursor to delta position.

Parameters
[in]dx.
[in]dy.

Definition at line 537 of file Canvas.hh.

void Canvas::run ( uint8_t  ix,
const void_P tab,
uint8_t  max 
)
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.

Parameters
[in]ixscript to run.
[in]tabscript table in program memory.
[in]maxsize of script table.

Definition at line 414 of file Canvas.cpp.

virtual const uint8_t* ILI9341::script ( )
inlineprotectedvirtual

Get initialization script (in program memory).

Returns
pointer to script.

Implements GDDRAM.

Definition at line 87 of file ILI9341.hh.

color16_t Canvas::set_canvas_color ( color16_t  color)
inlineinherited

Set current canvas color. Return previous color.

Parameters
[in]color.
Returns
previous color.

Definition at line 432 of file Canvas.hh.

void SPI::Driver::set_clock ( Clock  rate)
inherited

Set SPI master clock rate.

Parameters
[in]clockrate.

Definition at line 297 of file SPI.cpp.

void SPI::Driver::set_clock ( uint32_t  freq)
inlineinherited

Set SPI master clock frequency.

Parameters
[in]freqdevice max frequency (in Hz).

Definition at line 157 of file SPI.hh.

Context* Canvas::set_context ( Context context)
inlineinherited

Set current canvas context. Return previous context.

Parameters
[in]context.
Returns
previous context.

Definition at line 411 of file Canvas.hh.

void Canvas::set_cursor ( uint16_t  x,
uint16_t  y 
)
inlineinherited

Set current cursor position.

Parameters
[in]x.
[in]y.

Definition at line 527 of file Canvas.hh.

uint8_t GDDRAM::set_orientation ( uint8_t  direction)
virtualinherited

Set screen orientation.

Parameters
[in]direction.

Reimplemented from Canvas.

Reimplemented in ILI9163, and ST7735.

Definition at line 62 of file GDDRAM.cpp.

color16_t Canvas::set_pen_color ( color16_t  color)
inlineinherited

Set current drawing color. Return previous color.

Parameters
[in]color.
Returns
previous color.

Definition at line 451 of file Canvas.hh.

color16_t Canvas::set_text_color ( color16_t  color)
inlineinherited

Set current text color. Return previous color.

Parameters
[in]color.
Returns
previous color.

Definition at line 470 of file Canvas.hh.

Font* Canvas::set_text_font ( Font font)
inlineinherited

Set current text font. Return previous font.

Parameters
[in]font.
Returns
previous font.

Definition at line 488 of file Canvas.hh.

uint8_t Canvas::set_text_scale ( uint8_t  scale)
inlineinherited

Set current text scale (1..n). Return previous scale.

Parameters
[in]scale.
Returns
previous scale.

Definition at line 507 of file Canvas.hh.

Canvas::color16_t Canvas::shade ( color16_t  color,
uint8_t  scale 
)
staticinherited

Create color shade (0..100%).

Parameters
[in]color.
[in]scale.
Returns
color shade.

Definition at line 28 of file Canvas.cpp.

void GDDRAM::write ( uint16_t  data)
inlineprotectedinherited

Write 16-bit data to device, MSB first.

Parameters
[in]datato write.

Definition at line 241 of file GDDRAM.hh.

void GDDRAM::write ( uint16_t  data,
uint16_t  count 
)
inlineprotectedinherited

Write given number of 16-bit data to device, MSB first.

Parameters
[in]datato write.
[in]countnumber of data elements to write.
Precondition
(count > 0)

Definition at line 255 of file GDDRAM.hh.

void GDDRAM::write ( Command  cmd)
inlineprotectedinherited

Write command to device.

Parameters
[in]cmdcommand to write.

Definition at line 273 of file GDDRAM.hh.

void GDDRAM::write ( Command  cmd,
uint8_t  data 
)
inlineprotectedinherited

Write command and 8-bit data to device.

Parameters
[in]cmdcommand to write.
[in]datato write.

Definition at line 286 of file GDDRAM.hh.

void GDDRAM::write ( Command  cmd,
uint16_t  data 
)
inlineprotectedinherited

Write command and 16-bit data to device.

Parameters
[in]cmdcommand to write.
[in]datato write.

Definition at line 300 of file GDDRAM.hh.

void GDDRAM::write ( Command  cmd,
uint16_t  x,
uint16_t  y 
)
inlineprotectedinherited

Write command and 2x16-bit data to device.

Parameters
[in]cmdcommand to write.
[in]xdata to write.
[in]ydata to write.

Definition at line 317 of file GDDRAM.hh.

Member Data Documentation

Canvas::Context Canvas::context
staticprotectedinherited

Default Canvas context (Factory pattern).

Definition at line 1009 of file Canvas.hh.

uint16_t Canvas::HEIGHT
inherited

Definition at line 370 of file Canvas.hh.

Context* Canvas::m_context
protectedinherited

Current Canvas context (Delegation pattern).

Definition at line 1012 of file Canvas.hh.

OutputPin SPI::Driver::m_cs
protectedinherited

Device chip select pin.

Definition at line 166 of file SPI.hh.

OutputPin GDDRAM::m_dc
protectedinherited

Data/Command select pin.

Definition at line 112 of file GDDRAM.hh.

uint8_t Canvas::m_direction
protectedinherited

Canvas direction (LANDSCAPE/PORTRAIT).

Definition at line 1015 of file Canvas.hh.

bool GDDRAM::m_initiated
protectedinherited

Initialization state.

Definition at line 113 of file GDDRAM.hh.

Interrupt::Handler* SPI::Driver::m_irq
protectedinherited

Interrupt handler.

Definition at line 165 of file SPI.hh.

Driver* SPI::Driver::m_next
protectedinherited

List of drivers.

Definition at line 164 of file SPI.hh.

Pulse SPI::Driver::m_pulse
protectedinherited

Chip select pulse width.

Definition at line 167 of file SPI.hh.

uint8_t SPI::Driver::m_spcr
protectedinherited

SPI/SPCR hardware control register setting.

Definition at line 173 of file SPI.hh.

uint8_t SPI::Driver::m_spsr
protectedinherited

SPI/SPSR hardware status register.

Definition at line 174 of file SPI.hh.

const uint8_t ILI9341::s_script[]
staticprotected

Initialization script (in program memory).

Definition at line 95 of file ILI9341.hh.

const uint16_t ILI9341::SCREEN_HEIGHT = 320
static

Definition at line 79 of file ILI9341.hh.

const uint16_t ILI9341::SCREEN_WIDTH = 240
static

Screen size (width and height).

Definition at line 78 of file ILI9341.hh.

uint16_t Canvas::WIDTH
inherited

Screen size; width/height and orientation.

Definition at line 369 of file Canvas.hh.


The documentation for this class was generated from the following files: