Display_Lib_RPI 2.3.0
A C++ Library to connect electronic displays to Linux single board computers.
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ILI9341_TFT Class Reference

Class to interface with ILI9341 LCD display. More...

#include <ILI9341_TFT_LCD_RDL.hpp>

Inheritance diagram for ILI9341_TFT:
Inheritance graph
[legend]

Public Member Functions

 ILI9341_TFT ()
 Constructor for class ILI9341_TFT.
 
virtual void setAddrWindow (uint16_t x, uint16_t y, uint16_t w, uint16_t h) override
 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.
 
void SetupGPIO (int8_t RST, int8_t DC, int8_t CS, int8_t SCLK, int8_t MOSI, int8_t MISO)
 sets up TFT GPIO for software SPI
 
void SetupGPIO (int8_t RST, int8_t DC)
 sets up TFT GPIO for Hardware SPi
 
void InitScreenSize (uint16_t w, uint16_t h)
 initialise the variables that define the size of the screen
 
rdlib::Return_Codes_e InitSPI (uint16_t CommDelay, int gpioDev)
 intialise PCBtype and SPI, Software SPI
 
rdlib::Return_Codes_e InitSPI (int device, int channel, int speed, int flags, int gpioDev)
 intialise SPI, Hardware SPI
 
uint16_t HighFreqDelayGet (void)
 Freq delay used in SW SPI getter, uS delay used in SW SPI method.
 
void HighFreqDelaySet (uint16_t)
 Freq delay used in SW SPI setter, uS delay used in SW SPI method.
 
rdlib::Return_Codes_e PowerDown (void)
 Call when powering down TFT.
 
void EnableDisplay (bool enableDisplay)
 enable /disable display mode
 
void setRotation (display_rotate_e rotation)
 Set origin of (0,0) and orientation of TFT display.
 
void invertDisplay (bool i)
 Enable/Disable display color inversion.
 
void scrollTo (uint16_t y)
 Scroll display memory.
 
void setScrollMargins (uint16_t top, uint16_t bottom)
 Set the height of the Top and Bottom Scroll Margins.
 
void NormalMode (void)
 To Return Display to normal mode.
 
rdlib::Return_Codes_e TFTResetPin (void)
 : Method for Hardware Reset pin control
 
void PrintDiagnostic (void)
 : Print out diagnostics
 
- Public Member Functions inherited from color16_graphics
 color16_graphics ()
 Construct a new graphics class object.
 
void fillScreen (uint16_t color)
 Fills the whole screen with a given color.
 
void setCursor (int16_t x, int16_t y)
 Set the Cursor Position on screen.
 
void drawPixel (uint16_t, uint16_t, uint16_t)
 Draw a pixel to screen.
 
rdlib::Return_Codes_e drawDotGrid (int16_t x, int16_t y, int16_t w, int16_t h, uint8_t DotGridGap, uint16_t color)
 Draws a grid of dots on the screen starting from the given coordinates. This function draws a grid of pixels with a specified gap between them. It checks that the provided coordinates and dimensions are within the screen bounds and adjusts them if necessary. It also validates The grid of dots gap value and defaults it to 2 if invalid.
 
void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 draws a line from (x0,y0) to (x1,y1).
 
rdlib::Return_Codes_e drawFastVLine (uint16_t x, uint16_t y, uint16_t h, uint16_t color)
 Draws a vertical line starting at (x,y) with height h.
 
rdlib::Return_Codes_e drawFastHLine (uint16_t x, uint16_t y, uint16_t w, uint16_t color)
 Draws a horizontal line starting at (x,y) with width w.
 
void drawLineAngle (int16_t x, int16_t y, int angle, uint8_t start, uint8_t length, int offset, uint16_t color)
 Draws a line using an angle and length as parameters. This function draws a line starting from (x, y), extending in the direction specified by angle, with a given length. The function also allows applying an offset to the angle before computing the line’s end coordinates.
 
void drawRectWH (uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color)
 draws rectangle at (x,y) where h is height and w is width of the rectangle.
 
rdlib::Return_Codes_e fillRectangle (uint16_t, uint16_t, uint16_t, uint16_t, uint16_t)
 fills a rectangle starting from coordinates (x,y) with width of w and height of h.
 
void fillRect (uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color)
 fills a rectangle at (x,y) where h is height and w is width of the rectangle.
 
void drawRoundRect (uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t r, uint16_t color)
 draws a rectangle with rounded edges
 
void fillRoundRect (uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t r, uint16_t color)
 Fills a rectangle with rounded edges.
 
void drawCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 draws a circle where (x0,y0) are center coordinates an r is circle radius.
 
void fillCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 fills a circle where (x0,y0) are center coordinates an r is circle radius.
 
void drawEllipse (int16_t cx, int16_t cy, int16_t semiMajorAxis, int16_t semiMinorAxis, bool fill, uint16_t color)
 Draw an ellipse on the display. This function uses the midpoint ellipse algorithm to efficiently draw an ellipse centered at (cx, cy) with the given semi-major (horizontal) and semi-minor (vertical) axes.
 
void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 draws a triangle of coordinates (x0,y0), (x1,y1) and (x2,y2).
 
void fillTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 Fills a triangle of coordinates (x0,y0), (x1,y1) and (x2,y2).
 
void drawQuadrilateral (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t x3, int16_t y3, uint16_t color)
 Draws a quadrilateral (four-sided polygon) by connecting four points with lines. This function draws a quadrilateral by drawing four lines between the given vertices. The lines are drawn in the order: (x0, y0) to (x1, y1), (x1, y1) to (x2, y2), (x2, y2) to (x3, y3), and finally (x3, y3) back to (x0, y0).
 
void fillQuadrilateral (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t x3, int16_t y3, uint16_t color, bool useTriangleSplit=true)
 Fills a quadrilateral with the specified color using triangles. This function fills a quadrilateral by dividing it into triangles and filling them individually. The quadrilateral is filled by calling the fillTriangle function three times with appropriate vertex coordinates. The useTriangleSplit parameter determines whether the quadrilateral is divided into two triangles or if only one triangle is used.
 
rdlib::Return_Codes_e drawPolygon (int16_t x, int16_t y, uint8_t sides, int16_t diameter, float rotation, bool fill, uint16_t color)
 Draws a polygon with a specified number of sides, diameter, rotation, and color. This function draws a regular polygon by connecting points equally spaced around a circle, with each point having a distance defined by the diameter. The polygon is rotated by the given angle (in degrees) before being drawn. The number of sides is enforced to be at least 3.
 
void drawSimpleArc (int16_t cx, int16_t cy, int16_t radius, float startAngle, float endAngle, uint16_t color)
 Draw a simple arc of one pixel on the display( no offsets , thickness or maximum arc calculations) This function draws an arc between two angles (start and end) on a circle with a given radius.
 
void drawArc (uint16_t cx, uint16_t cy, uint16_t radius, uint16_t thickness, float startAngle, float endAngle, uint16_t color)
 Draw an arc on the TFT display. This function draws an arc between two angles (start and end) on a circle with a given radius.
 
float getArcAngleMax () const
 Get the current maximum angle of the arc.
 
void setArcAngleMax (float arcAngleMax)
 Set a new maximum angle for the arc.
 
int getArcAngleOffset () const
 Get the current angle offset.
 
void setArcAngleOffset (int arcAngleOffset)
 Set a new angle offset.
 
virtual size_t write (uint8_t) override
 write method used in the print class when user calls print
 
rdlib::Return_Codes_e writeChar (int16_t x, int16_t y, char value)
 Write 1 character on Display.
 
rdlib::Return_Codes_e writeCharString (int16_t x, int16_t y, char *text)
 Write Text character array on display.
 
void setTextWrap (bool w)
 turn on or off screen wrap of the text (fonts 1-6)
 
void setTextColor (uint16_t c, uint16_t bg)
 Set text color foreground and background.
 
void setTextColor (uint16_t c)
 Set text color foreground.
 
rdlib::Return_Codes_e drawIcon (uint16_t x, uint16_t y, uint16_t w, uint16_t color, uint16_t bgcolor, const std::span< const uint8_t > data)
 Draws an custom Icon of X by 8 size to screen , where X = 0 to 127.
 
rdlib::Return_Codes_e drawBitmap (uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color, uint16_t bgcolor, const std::span< const uint8_t > data)
 : Draws an bi-color bitmap to screen
 
rdlib::Return_Codes_e drawBitmap24 (uint16_t x, uint16_t y, const std::span< const uint8_t > data, uint16_t w, uint16_t h)
 Draws an 24 bit color bitmap to screen from a data array.
 
rdlib::Return_Codes_e drawBitmap16 (uint16_t x, uint16_t y, const std::span< const uint8_t > data, uint16_t w, uint16_t h)
 : Draws an 16 bit color bitmap to screen from a data array
 
rdlib::Return_Codes_e drawSprite (uint16_t x, uint16_t y, const std::span< const uint8_t > data, uint16_t w, uint16_t h, uint16_t backgroundColor)
 : Draws an 16 bit color sprite bitmap to screen with transparent background
 
int16_t Color565 (int16_t, int16_t, int16_t)
 : Convert: 24-bit color to 565 16-bit color
 
int getDisplaySPIBlockSize () const
 Gets the maximum SPI transaction block size.
 
void setDisplaySPIBlockSize (int size)
 Sets the maximum SPI transaction block size.
 
- Public Member Functions inherited from display_Fonts
 display_Fonts ()
 init the OLED font class object constructor
 
rdlib::Return_Codes_e setFont (display_Font_name_e)
 SetFont.
 
void setInvertFont (bool invertStatus)
 setInvertFont
 
bool getInvertFont (void)
 getInvertFont
 
- Public Member Functions inherited from Print
int getWriteError ()
 gets the error flag status, zero no error
 
void clearWriteError ()
 clears the error flag by setting it to zero
 
virtual size_t write (const uint8_t *buffer, size_t size)
 define in the sub class
 
size_t write (const char *str)
 Writes a string to the output.
 
size_t write (const char *buffer, size_t size)
 Writes a buffer of a specified size to the output.
 
virtual int availableForWrite ()
 define in the sub class
 
size_t print (const char[])
 print an array
 
size_t print (char)
 print an character
 
size_t print (int, int=RDL_DEC)
 print an integer of base number system
 
size_t print (unsigned int, int=RDL_DEC)
 print an unsigned integer of base number system
 
size_t print (long, int=RDL_DEC)
 print an long integer of base number system
 
size_t print (unsigned long, int=RDL_DEC)
 print an unsigned long integer of base number system
 
size_t print (double, int=2)
 print an double
 
size_t print (const std::string &)
 print an C++ string object
 
size_t println (const char[])
 Prints a character array followed by a newline.
 
size_t println (char)
 print an character followed by new line
 
size_t println (int, int=RDL_DEC)
 print an integer of base number system followed by new line
 
size_t println (unsigned int, int=RDL_DEC)
 print an unsigned integer of base number system followed by new line
 
size_t println (long, int=RDL_DEC)
 print an long integer of base number system followed by new line
 
size_t println (unsigned long, int=RDL_DEC)
 print an unsigned long integer of base number system followed by new line
 
size_t println (double, int=2)
 print an double
 
size_t println (void)
 Goto to new line.
 
size_t println (const std::string &s)
 print an C++ string object followed by new line
 
template<typename T >
size_t print (const std::vector< T > &v, int format=defaultFormat< T >())
 Print a vector of any type.
 
template<typename T >
size_t println (const std::vector< T > &vec, int format=defaultFormat< T >())
 Print a vector of elements followed by a newline.
 
template<typename T , size_t N>
size_t print (const std::array< T, N > &arr, int format=defaultFormat< T >())
 Print a std::array of any type.
 
template<typename T , size_t N>
size_t println (const std::array< T, N > &arr, int format=defaultFormat< T >())
 Print a std::array of elements followed by a newline.
 

Private Member Functions

rdlib::Return_Codes_e TFTDataCommandPin (void)
 : Method for Data or Command pin setup
 
rdlib::Return_Codes_e TFTClock_Data_ChipSelect_Pins (void)
 : Method for Clock, data and chip select pin setup routine for software SPI.
 
rdlib::Return_Codes_e ILI9341Initialize (void)
 init routine for ILI9341_TFTcontroller
 
void TFTSetupResetPin (int8_t rst)
 sets up TFT GPIO reset pin
 
void cmdInit (void)
 Command Initialization sequence for ILI9341 LCD TFT display.
 

Private Attributes

bool _resetPinOn = true
 
int _spiDev = 0
 
int _spiChan = 0
 
int _spiBaud = 50000
 
int _spiFlags = 0
 
uint16_t _widthStartTFT = 240
 
uint16_t _heightStartTFT = 320
 

Static Private Attributes

static constexpr uint8_t ILI9341_NOP = 0x00
 
static constexpr uint8_t ILI9341_SWRESET = 0x01
 
static constexpr uint8_t ILI9341_RDDID = 0x04
 
static constexpr uint8_t ILI9341_RDDST = 0x09
 
static constexpr uint8_t ILI9341_SLPIN = 0x10
 
static constexpr uint8_t ILI9341_SLPOUT = 0x11
 
static constexpr uint8_t ILI9341_PTLON = 0x12
 
static constexpr uint8_t ILI9341_NORON = 0x13
 
static constexpr uint8_t ILI9341_INVOFF = 0x20
 
static constexpr uint8_t ILI9341_INVON = 0x21
 
static constexpr uint8_t ILI9341_GAMMASET = 0x26
 
static constexpr uint8_t ILI9341_DISPOFF = 0x28
 
static constexpr uint8_t ILI9341_DISPON = 0x29
 
static constexpr uint8_t ILI9341_CASET = 0x2A
 
static constexpr uint8_t ILI9341_PASET = 0x2B
 
static constexpr uint8_t ILI9341_RAMWR = 0x2C
 
static constexpr uint8_t ILI9341_RAMRD = 0x2E
 
static constexpr uint8_t ILI9341_PTLAR = 0x30
 
static constexpr uint8_t ILI9341_VSCRDEF = 0x33
 
static constexpr uint8_t ILI9341_MADCTL = 0x36
 
static constexpr uint8_t ILI9341_VSCRSADD = 0x37
 
static constexpr uint8_t ILI9341_PIXFMT = 0x3A
 
static constexpr uint8_t ILI9341_FRMCTR1 = 0xB1
 
static constexpr uint8_t ILI9341_FRMCTR2 = 0xB2
 
static constexpr uint8_t ILI9341_FRMCTR3 = 0xB3
 
static constexpr uint8_t ILI9341_INVCTR = 0xB4
 
static constexpr uint8_t ILI9341_DFUNCTR = 0xB6
 
static constexpr uint8_t ILI9341_PWCTR1 = 0xC0
 
static constexpr uint8_t ILI9341_PWCTR2 = 0xC1
 
static constexpr uint8_t ILI9341_PWCTR3 = 0xC2
 
static constexpr uint8_t ILI9341_PWCTR4 = 0xC3
 
static constexpr uint8_t ILI9341_PWCTR5 = 0xC4
 
static constexpr uint8_t ILI9341_VMCTR1 = 0xC5
 
static constexpr uint8_t ILI9341_VMCTR2 = 0xC7
 
static constexpr uint8_t ILI9341_RDID1 = 0xDA
 
static constexpr uint8_t ILI9341_RDID2 = 0xDB
 
static constexpr uint8_t ILI9341_RDID3 = 0xDC
 
static constexpr uint8_t ILI9341_RDID4 = 0xDD
 
static constexpr uint8_t ILI9341_EN3GAM = 0xF2
 
static constexpr uint8_t ILI9341_GMCTRP1 = 0xE0
 
static constexpr uint8_t ILI9341_GMCTRN1 = 0xE1
 
static constexpr uint8_t ILI9341_PWONCS = 0xED
 
static constexpr uint8_t ILI9341_PWCTRA = 0xCB
 
static constexpr uint8_t ILI9341_PWCTRB = 0xCF
 
static constexpr uint8_t ILI9341_DTMCTRA = 0xE8
 
static constexpr uint8_t ILI9341_DTMCTRC = 0xEA
 
static constexpr uint8_t ILI9341_PURTCTR = 0xF7
 
static constexpr uint8_t MADCTL_MY = 0x80
 
static constexpr uint8_t MADCTL_MX = 0x40
 
static constexpr uint8_t MADCTL_MV = 0x20
 
static constexpr uint8_t MADCTL_ML = 0x10
 
static constexpr uint8_t MADCTL_RGB = 0x00
 
static constexpr uint8_t MADCTL_BGR = 0x08
 
static constexpr uint8_t MADCTL_MH = 0x04
 

Additional Inherited Members

- Public Types inherited from color16_graphics
enum  pixel_color565_e : uint16_t {
  RDLC_BLACK = 0x0000 , RDLC_BLUE = 0x001F , RDLC_RED = 0xF800 , RDLC_GREEN = 0x07E0 ,
  RDLC_CYAN = 0x07FF , RDLC_MAGENTA = 0xF81F , RDLC_YELLOW = 0xFFE0 , RDLC_WHITE = 0xFFFF ,
  RDLC_TAN = 0xED01 , RDLC_GREY = 0x9CD1 , RDLC_BROWN = 0x6201 , RDLC_DGREEN = 0x01C0 ,
  RDLC_ORANGE = 0xFC00 , RDLC_NAVY = 0x000F , RDLC_DCYAN = 0x03EF , RDLC_MAROON = 0x7800 ,
  RDLC_PURPLE = 0x780F , RDLC_OLIVE = 0x7BE0 , RDLC_LGREY = 0xC618 , RDLC_DGREY = 0x7BEF ,
  RDLC_GYELLOW = 0xAFE5 , RDLC_PINK = 0xFC18 , RDLC_LBLUE = 0x7E5F , RDLC_BEIGE = 0xB5D2
}
 16-bit color definitions (RGB565 format). More...
 
enum  display_rotate_e : uint8_t { Degrees_0 = 0 , Degrees_90 , Degrees_180 , Degrees_270 }
 
- Public Types inherited from Print
enum  BaseNum : uint8_t { RDL_DEC = 10 , RDL_HEX = 16 , RDL_OCT = 8 , RDL_BIN = 2 }
 
- Protected Member Functions inherited from color16_graphics
void pushColor (uint16_t color)
 pushColor
 
void writeCommand (uint8_t)
 : Write an SPI command to
 
void writeData (uint8_t)
 Write an SPI data byte to device.
 
void spiWrite (uint8_t)
 Write byte to SPI.
 
void spiWriteDataBuffer (uint8_t *spidata, int len)
 Write a buffer to SPI, both Software and hardware SPI supported.
 
- Protected Member Functions inherited from Print
void setWriteError (int err=0)
 
- Protected Attributes inherited from color16_graphics
bool _textwrap = true
 
uint16_t _textcolor = 0xFFFF
 
uint16_t _textbgcolor = 0x0000
 
int16_t _cursorX = 0
 
int16_t _cursorY = 0
 
uint16_t _width
 
uint16_t _height
 
uint8_t _XStart = 0
 
uint8_t _YStart = 0
 
float _arcAngleMax = 360.0f
 
int _arcAngleOffset = 0
 
int8_t _Display_DC
 
int8_t _Display_RST
 
int8_t _Display_CS
 
int8_t _Display_SCLK
 
int8_t _Display_SDATA
 
int8_t _Display_MISO
 
int _DeviceNumGpioChip = 0
 
int _GpioHandle = 0
 
bool _hardwareSPI =true
 
uint16_t _HighFreqDelay = 0
 
int _spiHandle = 0
 
- Protected Attributes inherited from display_Fonts
std::span< const uint8_t > _FontSelect = pFontDefault
 
uint8_t _Font_X_Size = 0x08
 
uint8_t _Font_Y_Size = 0x08
 
uint8_t _FontOffset = 0x20
 
uint8_t _FontNumChars = 0x5F
 

Detailed Description

Class to interface with ILI9341 LCD display.

Member Function Documentation

◆ EnableDisplay()

void ILI9341_TFT::EnableDisplay ( bool  enableDisplay)

enable /disable display mode

Parameters
enableDisplaytrue enable on, false disable

◆ HighFreqDelayGet()

uint16_t ILI9341_TFT::HighFreqDelayGet ( void  )

Freq delay used in SW SPI getter, uS delay used in SW SPI method.

Returns
The GPIO communications delay in uS

◆ HighFreqDelaySet()

void ILI9341_TFT::HighFreqDelaySet ( uint16_t  CommDelay)

Freq delay used in SW SPI setter, uS delay used in SW SPI method.

Parameters
CommDelayThe GPIO communications delay in uS

◆ ILI9341Initialize()

rdlib::Return_Codes_e ILI9341_TFT::ILI9341Initialize ( void  )
private

◆ InitScreenSize()

void ILI9341_TFT::InitScreenSize ( uint16_t  width_TFT,
uint16_t  height_TFT 
)

initialise the variables that define the size of the screen

Parameters
width_TFTwidth in pixels
height_TFTheight in pixels

◆ InitSPI() [1/2]

rdlib::Return_Codes_e ILI9341_TFT::InitSPI ( int  device,
int  channel,
int  speed,
int  flags,
int  gpioDev 
)

intialise SPI, Hardware SPI

Parameters
deviceA SPI device, >= 0.
channelA SPI channel, >= 0.
speedThe speed of serial communication in bits per second.
flagsThe flags may be used to modify the default behaviour. Set to 0(mode 0) for this device.
gpioDevThe device number of a gpiochip.
Returns
  1. rdlib::Success = success
  2. Upstream error code from ILI9341Initialize()
Note
overloaded 2 off, 1 for HW SPI , 1 for SW SPI

◆ InitSPI() [2/2]

rdlib::Return_Codes_e ILI9341_TFT::InitSPI ( uint16_t  CommDelay,
int  gpioDev 
)

intialise PCBtype and SPI, Software SPI

Parameters
CommDelayuS GPIO delay used in software SPI
gpioDevThe device number of a gpiochip.
Returns
Upstream error code from ILI9341Initialize()
Note
overloaded 2 off, 1 for HW SPI , 1 for SW SPI

◆ invertDisplay()

void ILI9341_TFT::invertDisplay ( bool  invert)

Enable/Disable display color inversion.

Parameters
invertTrue to invert, False to have normal color

◆ NormalMode()

void ILI9341_TFT::NormalMode ( void  )

To Return Display to normal mode.

Note
used after scroll set for example

◆ PowerDown()

rdlib::Return_Codes_e ILI9341_TFT::PowerDown ( void  )

Call when powering down TFT.

Returns
a rdlib::Return_Codes_e code
  1. rdlib::Success
  2. rdlib::GpioChipDevice
  3. rdlib::GpioPinFree
  4. rdlib::SPIOpenClose
Note
Turns off Display Sets GPIO low and turns off SPI

◆ PrintDiagnostic()

void ILI9341_TFT::PrintDiagnostic ( void  )

: Print out diagnostics

Note
not working TODO
Todo:
Not working, v 2.1.0, reading back 00 and 255 instead of valid values.

Enum to hold Read diagnostics commands

< Read the power mode

< Read MADCTL

< Read pixel Format

< Read image format

< Read self-diagnostic result

◆ scrollTo()

void ILI9341_TFT::scrollTo ( uint16_t  pixelY)

Scroll display memory.

Parameters
pixelYHow many pixels to scroll display by.

◆ setAddrWindow()

void ILI9341_TFT::setAddrWindow ( uint16_t  x0,
uint16_t  y0,
uint16_t  x1,
uint16_t  y1 
)
overridevirtual

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
x0TFT memory 'x' origin
y0TFT memory 'y' origin
x1Width of rectangle
y1Height of rectangle

Implements color16_graphics.

◆ setRotation()

void ILI9341_TFT::setRotation ( display_rotate_e  rotation)

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

Parameters
rotationThe index for rotation, from 0-3 inclusive, enum

◆ setScrollMargins()

void ILI9341_TFT::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

◆ SetupGPIO() [1/2]

void ILI9341_TFT::SetupGPIO ( int8_t  rst,
int8_t  dc 
)

sets up TFT GPIO for Hardware SPi

Parameters
rstreset GPIO
dcdata or command GPIO.
Note
overloaded 2 off, 1 for HW SPI , 1 for SW SPI

◆ SetupGPIO() [2/2]

void ILI9341_TFT::SetupGPIO ( int8_t  rst,
int8_t  dc,
int8_t  cs,
int8_t  sclk,
int8_t  mosi,
int8_t  miso 
)

sets up TFT GPIO for software SPI

Parameters
rstreset GPIO
dcdata or command GPIO.
cschip select GPIO
sclkData clock GPIO
mosiData to TFT GPIO
misoData from TFT GPIO read diagnostics
Note
overloaded 2 off, 1 for HW SPI , 1 for SW SPI

◆ TFTClock_Data_ChipSelect_Pins()

rdlib::Return_Codes_e ILI9341_TFT::TFTClock_Data_ChipSelect_Pins ( void  )
private

: Method for Clock, data and chip select pin setup routine for software SPI.

Returns
a rdlib::Return_Codes_e code
  1. rdlib::Success
  2. rdlib::GpioPinClaim

◆ TFTDataCommandPin()

rdlib::Return_Codes_e ILI9341_TFT::TFTDataCommandPin ( void  )
private

: Method for Data or Command pin setup

Returns
a rdlib::Return_Codes_e code
  1. rdlib::Success
  2. rdlib::GpioPinClaim

◆ TFTResetPin()

rdlib::Return_Codes_e ILI9341_TFT::TFTResetPin ( void  )

: Method for Hardware Reset pin control

Returns
a rdlib::Return_Codes_e code
  1. rdlib::Success
  2. rdlib::GpioPinClaim

◆ TFTSetupResetPin()

void ILI9341_TFT::TFTSetupResetPin ( int8_t  rst)
private

sets up TFT GPIO reset pin

Parameters
rstreset GPIO

if rst value is -1 use software reset, else use Hardware reset.

Member Data Documentation

◆ _heightStartTFT

uint16_t ILI9341_TFT::_heightStartTFT = 320
private

never change after first init

◆ _resetPinOn

bool ILI9341_TFT::_resetPinOn = true
private

reset pin? true:hw rst pin, false:sw rt

◆ _spiBaud

int ILI9341_TFT::_spiBaud = 50000
private

The speed of serial communication in bits per second.

◆ _spiChan

int ILI9341_TFT::_spiChan = 0
private

A SPI channel, >= 0.

◆ _spiDev

int ILI9341_TFT::_spiDev = 0
private

A SPI device, >= 0.

◆ _spiFlags

int ILI9341_TFT::_spiFlags = 0
private

The flags 2 LSB defines SPI mode

◆ _widthStartTFT

uint16_t ILI9341_TFT::_widthStartTFT = 240
private

never change after first init

◆ ILI9341_CASET

constexpr uint8_t ILI9341_TFT::ILI9341_CASET = 0x2A
staticconstexprprivate

Column Address Set

◆ ILI9341_DFUNCTR

constexpr uint8_t ILI9341_TFT::ILI9341_DFUNCTR = 0xB6
staticconstexprprivate

Display Function Control

◆ ILI9341_DISPOFF

constexpr uint8_t ILI9341_TFT::ILI9341_DISPOFF = 0x28
staticconstexprprivate

Display OFF

◆ ILI9341_DISPON

constexpr uint8_t ILI9341_TFT::ILI9341_DISPON = 0x29
staticconstexprprivate

Display ON

◆ ILI9341_DTMCTRA

constexpr uint8_t ILI9341_TFT::ILI9341_DTMCTRA = 0xE8
staticconstexprprivate

Driver timing control A

◆ ILI9341_DTMCTRC

constexpr uint8_t ILI9341_TFT::ILI9341_DTMCTRC = 0xEA
staticconstexprprivate

Driver timing control C

◆ ILI9341_EN3GAM

constexpr uint8_t ILI9341_TFT::ILI9341_EN3GAM = 0xF2
staticconstexprprivate

Enable 3 gamma control

◆ ILI9341_FRMCTR1

constexpr uint8_t ILI9341_TFT::ILI9341_FRMCTR1 = 0xB1
staticconstexprprivate

Frame Rate Ctrl (Normal Mode/Full Colors)

◆ ILI9341_FRMCTR2

constexpr uint8_t ILI9341_TFT::ILI9341_FRMCTR2 = 0xB2
staticconstexprprivate

Frame Rate Ctrl (Idle Mode/8 colors)

◆ ILI9341_FRMCTR3

constexpr uint8_t ILI9341_TFT::ILI9341_FRMCTR3 = 0xB3
staticconstexprprivate

Frame Rate control (In Partial Mode/Full Colors)

◆ ILI9341_GAMMASET

constexpr uint8_t ILI9341_TFT::ILI9341_GAMMASET = 0x26
staticconstexprprivate

Gamma Set

◆ ILI9341_GMCTRN1

constexpr uint8_t ILI9341_TFT::ILI9341_GMCTRN1 = 0xE1
staticconstexprprivate

Negative Gamma Correction

◆ ILI9341_GMCTRP1

constexpr uint8_t ILI9341_TFT::ILI9341_GMCTRP1 = 0xE0
staticconstexprprivate

Positive Gamma Correction

◆ ILI9341_INVCTR

constexpr uint8_t ILI9341_TFT::ILI9341_INVCTR = 0xB4
staticconstexprprivate

Display Inversion Control

◆ ILI9341_INVOFF

constexpr uint8_t ILI9341_TFT::ILI9341_INVOFF = 0x20
staticconstexprprivate

Display Inversion OFF

◆ ILI9341_INVON

constexpr uint8_t ILI9341_TFT::ILI9341_INVON = 0x21
staticconstexprprivate

Display Inversion ON

◆ ILI9341_MADCTL

constexpr uint8_t ILI9341_TFT::ILI9341_MADCTL = 0x36
staticconstexprprivate

Memory Access Control

◆ ILI9341_NOP

constexpr uint8_t ILI9341_TFT::ILI9341_NOP = 0x00
staticconstexprprivate

No-op register

◆ ILI9341_NORON

constexpr uint8_t ILI9341_TFT::ILI9341_NORON = 0x13
staticconstexprprivate

Normal Display Mode ON

◆ ILI9341_PASET

constexpr uint8_t ILI9341_TFT::ILI9341_PASET = 0x2B
staticconstexprprivate

Page Address Set

◆ ILI9341_PIXFMT

constexpr uint8_t ILI9341_TFT::ILI9341_PIXFMT = 0x3A
staticconstexprprivate

COLMOD: Pixel Format Set

◆ ILI9341_PTLAR

constexpr uint8_t ILI9341_TFT::ILI9341_PTLAR = 0x30
staticconstexprprivate

Partial Area

◆ ILI9341_PTLON

constexpr uint8_t ILI9341_TFT::ILI9341_PTLON = 0x12
staticconstexprprivate

Partial Mode ON

◆ ILI9341_PURTCTR

constexpr uint8_t ILI9341_TFT::ILI9341_PURTCTR = 0xF7
staticconstexprprivate

Pump ratio control

◆ ILI9341_PWCTR1

constexpr uint8_t ILI9341_TFT::ILI9341_PWCTR1 = 0xC0
staticconstexprprivate

Power Control 1

◆ ILI9341_PWCTR2

constexpr uint8_t ILI9341_TFT::ILI9341_PWCTR2 = 0xC1
staticconstexprprivate

Power Control 2

◆ ILI9341_PWCTR3

constexpr uint8_t ILI9341_TFT::ILI9341_PWCTR3 = 0xC2
staticconstexprprivate

Power Control 3

◆ ILI9341_PWCTR4

constexpr uint8_t ILI9341_TFT::ILI9341_PWCTR4 = 0xC3
staticconstexprprivate

Power Control 4

◆ ILI9341_PWCTR5

constexpr uint8_t ILI9341_TFT::ILI9341_PWCTR5 = 0xC4
staticconstexprprivate

Power Control 5

◆ ILI9341_PWCTRA

constexpr uint8_t ILI9341_TFT::ILI9341_PWCTRA = 0xCB
staticconstexprprivate

Power Control A

◆ ILI9341_PWCTRB

constexpr uint8_t ILI9341_TFT::ILI9341_PWCTRB = 0xCF
staticconstexprprivate

Power Control B

◆ ILI9341_PWONCS

constexpr uint8_t ILI9341_TFT::ILI9341_PWONCS = 0xED
staticconstexprprivate

Power on sequence control

◆ ILI9341_RAMRD

constexpr uint8_t ILI9341_TFT::ILI9341_RAMRD = 0x2E
staticconstexprprivate

Memory Read

◆ ILI9341_RAMWR

constexpr uint8_t ILI9341_TFT::ILI9341_RAMWR = 0x2C
staticconstexprprivate

Memory Write

◆ ILI9341_RDDID

constexpr uint8_t ILI9341_TFT::ILI9341_RDDID = 0x04
staticconstexprprivate

Read display identification information

◆ ILI9341_RDDST

constexpr uint8_t ILI9341_TFT::ILI9341_RDDST = 0x09
staticconstexprprivate

Read Display Status

◆ ILI9341_RDID1

constexpr uint8_t ILI9341_TFT::ILI9341_RDID1 = 0xDA
staticconstexprprivate

Read ID 1

◆ ILI9341_RDID2

constexpr uint8_t ILI9341_TFT::ILI9341_RDID2 = 0xDB
staticconstexprprivate

Read ID 2

◆ ILI9341_RDID3

constexpr uint8_t ILI9341_TFT::ILI9341_RDID3 = 0xDC
staticconstexprprivate

Read ID 3

◆ ILI9341_RDID4

constexpr uint8_t ILI9341_TFT::ILI9341_RDID4 = 0xDD
staticconstexprprivate

Read ID 4

◆ ILI9341_SLPIN

constexpr uint8_t ILI9341_TFT::ILI9341_SLPIN = 0x10
staticconstexprprivate

Enter Sleep Mode

◆ ILI9341_SLPOUT

constexpr uint8_t ILI9341_TFT::ILI9341_SLPOUT = 0x11
staticconstexprprivate

Sleep Out

◆ ILI9341_SWRESET

constexpr uint8_t ILI9341_TFT::ILI9341_SWRESET = 0x01
staticconstexprprivate

Software reset register

◆ ILI9341_VMCTR1

constexpr uint8_t ILI9341_TFT::ILI9341_VMCTR1 = 0xC5
staticconstexprprivate

VCOM Control 1

◆ ILI9341_VMCTR2

constexpr uint8_t ILI9341_TFT::ILI9341_VMCTR2 = 0xC7
staticconstexprprivate

VCOM Control 2

◆ ILI9341_VSCRDEF

constexpr uint8_t ILI9341_TFT::ILI9341_VSCRDEF = 0x33
staticconstexprprivate

Vertical Scrolling Definition

◆ ILI9341_VSCRSADD

constexpr uint8_t ILI9341_TFT::ILI9341_VSCRSADD = 0x37
staticconstexprprivate

Vertical Scrolling Start Address

◆ MADCTL_BGR

constexpr uint8_t ILI9341_TFT::MADCTL_BGR = 0x08
staticconstexprprivate

Blue-Green-Red pixel order

◆ MADCTL_MH

constexpr uint8_t ILI9341_TFT::MADCTL_MH = 0x04
staticconstexprprivate

LCD refresh right to left

◆ MADCTL_ML

constexpr uint8_t ILI9341_TFT::MADCTL_ML = 0x10
staticconstexprprivate

LCD refresh Bottom to top

◆ MADCTL_MV

constexpr uint8_t ILI9341_TFT::MADCTL_MV = 0x20
staticconstexprprivate

Reverse Mode

◆ MADCTL_MX

constexpr uint8_t ILI9341_TFT::MADCTL_MX = 0x40
staticconstexprprivate

Right to left

◆ MADCTL_MY

constexpr uint8_t ILI9341_TFT::MADCTL_MY = 0x80
staticconstexprprivate

Bottom to top

◆ MADCTL_RGB

constexpr uint8_t ILI9341_TFT::MADCTL_RGB = 0x00
staticconstexprprivate

Red-Green-Blue pixel order


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