Adafruit ILI9341 Display Library
Public Member Functions | List of all members
Adafruit_ILI9341 Class Reference

Class to manage hardware interface with ILI9341 chipset (also seems to work with ILI9340) More...

#include <Adafruit_ILI9341.h>

Inheritance diagram for Adafruit_ILI9341:

Public Member Functions

 Adafruit_ILI9341 (int8_t _CS, int8_t _DC, int8_t _MOSI, int8_t _SCLK, int8_t _RST=-1, int8_t _MISO=-1)
 Instantiate Adafruit ILI9341 driver with software SPI. More...
 
 Adafruit_ILI9341 (int8_t _CS, int8_t _DC, int8_t _RST=-1)
 Instantiate Adafruit ILI9341 driver with hardware SPI using the default SPI peripheral. More...
 
 Adafruit_ILI9341 (SPIClass *spiClass, int8_t dc, int8_t cs=-1, int8_t rst=-1)
 Instantiate Adafruit ILI9341 driver with hardware SPI using a specific SPI peripheral (not necessarily default). More...
 
 Adafruit_ILI9341 (tftBusWidth busWidth, int8_t d0, int8_t wr, int8_t dc, int8_t cs=-1, int8_t rst=-1, int8_t rd=-1)
 Instantiate Adafruit ILI9341 driver using parallel interface. More...
 
void begin (uint32_t freq=0)
 Initialize ILI9341 chip Connects to the ILI9341 over SPI and sends initialization procedure commands. More...
 
void setRotation (uint8_t r)
 Set origin of (0,0) and orientation of TFT display. More...
 
void invertDisplay (bool i)
 Enable/Disable display color inversion. More...
 
void scrollTo (uint16_t y)
 Scroll display memory. More...
 
void setScrollMargins (uint16_t top, uint16_t bottom)
 Set the height of the Top and Bottom Scroll Margins. More...
 
void setAddrWindow (uint16_t x, uint16_t y, uint16_t w, uint16_t h)
 Set the "address window" - the rectangle we will write to RAM with the next chunk of SPI data writes. The ILI9341 will automatically wrap the data as each row is filled. More...
 
uint8_t readcommand8 (uint8_t reg, uint8_t index=0)
 Read 8 bits of data from ILI9341 configuration memory. NOT from RAM! This is highly undocumented/supported, it's really a hack but kinda works? More...
 

Detailed Description

Class to manage hardware interface with ILI9341 chipset (also seems to work with ILI9340)

Constructor & Destructor Documentation

◆ Adafruit_ILI9341() [1/4]

Adafruit_ILI9341::Adafruit_ILI9341 ( int8_t  cs,
int8_t  dc,
int8_t  mosi,
int8_t  sclk,
int8_t  rst = -1,
int8_t  miso = -1 
)

Instantiate Adafruit ILI9341 driver with software SPI.

Parameters
csChip select pin #
dcData/Command pin #
mosiSPI MOSI pin #
sclkSPI Clock pin #
rstReset pin # (optional, pass -1 if unused)
misoSPI MISO pin # (optional, pass -1 if unused)

◆ Adafruit_ILI9341() [2/4]

Adafruit_ILI9341::Adafruit_ILI9341 ( int8_t  cs,
int8_t  dc,
int8_t  rst = -1 
)

Instantiate Adafruit ILI9341 driver with hardware SPI using the default SPI peripheral.

Parameters
csChip select pin # (OK to pass -1 if CS tied to GND).
dcData/Command pin # (required).
rstReset pin # (optional, pass -1 if unused).

◆ Adafruit_ILI9341() [3/4]

Adafruit_ILI9341::Adafruit_ILI9341 ( SPIClass *  spiClass,
int8_t  dc,
int8_t  cs = -1,
int8_t  rst = -1 
)

Instantiate Adafruit ILI9341 driver with hardware SPI using a specific SPI peripheral (not necessarily default).

Parameters
spiClassPointer to SPI peripheral (e.g. &SPI or &SPI1).
dcData/Command pin # (required).
csChip select pin # (optional, pass -1 if unused and CS is tied to GND).
rstReset pin # (optional, pass -1 if unused).

◆ Adafruit_ILI9341() [4/4]

Adafruit_ILI9341::Adafruit_ILI9341 ( tftBusWidth  busWidth,
int8_t  d0,
int8_t  wr,
int8_t  dc,
int8_t  cs = -1,
int8_t  rst = -1,
int8_t  rd = -1 
)

Instantiate Adafruit ILI9341 driver using parallel interface.

Parameters
busWidthIf tft16 (enumeration in Adafruit_SPITFT.h), is a 16-bit interface, else 8-bit.
d0Data pin 0 (MUST be a byte- or word-aligned LSB of a PORT register – pins 1-n are extrapolated from this).
wrWrite strobe pin # (required).
dcData/Command pin # (required).
csChip select pin # (optional, pass -1 if unused and CS is tied to GND).
rstReset pin # (optional, pass -1 if unused).
rdRead strobe pin # (optional, pass -1 if unused).

Member Function Documentation

◆ begin()

void Adafruit_ILI9341::begin ( uint32_t  freq = 0)

Initialize ILI9341 chip Connects to the ILI9341 over SPI and sends initialization procedure commands.

Parameters
freqDesired SPI clock frequency

◆ setRotation()

void Adafruit_ILI9341::setRotation ( uint8_t  m)

Set origin of (0,0) and orientation of TFT display.

Parameters
mThe index for rotation, from 0-3 inclusive

◆ invertDisplay()

void Adafruit_ILI9341::invertDisplay ( bool  invert)

Enable/Disable display color inversion.

Parameters
invertTrue to invert, False to have normal color

◆ scrollTo()

void Adafruit_ILI9341::scrollTo ( uint16_t  y)

Scroll display memory.

Parameters
yHow many pixels to scroll display by

◆ setScrollMargins()

void Adafruit_ILI9341::setScrollMargins ( uint16_t  top,
uint16_t  bottom 
)

Set the height of the Top and Bottom Scroll Margins.

Parameters
topThe height of the Top scroll margin
bottomThe height of the Bottom scroll margin

◆ setAddrWindow()

void Adafruit_ILI9341::setAddrWindow ( uint16_t  x1,
uint16_t  y1,
uint16_t  w,
uint16_t  h 
)

Set the "address window" - the rectangle we will write to RAM with the next chunk of SPI data writes. The ILI9341 will automatically wrap the data as each row is filled.

Parameters
x1TFT memory 'x' origin
y1TFT memory 'y' origin
wWidth of rectangle
hHeight of rectangle

◆ readcommand8()

uint8_t Adafruit_ILI9341::readcommand8 ( uint8_t  commandByte,
uint8_t  index = 0 
)

Read 8 bits of data from ILI9341 configuration memory. NOT from RAM! This is highly undocumented/supported, it's really a hack but kinda works?

Parameters
commandByteThe command register to read data from
indexThe byte index into the command to read from
Returns
Unsigned 8-bit data read from ILI9341 register

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