32 #include <mraa/common.hpp>
33 #include <mraa/gpio.hpp>
34 #include <mraa/spi.hpp>
38 #define ILI9341_TFTWIDTH 240
39 #define ILI9341_TFTHEIGHT 320
41 #define SPI_FREQ 15000000
43 #define ILI9341_NOP 0x00
44 #define ILI9341_SWRESET 0x01
45 #define ILI9341_RDDID 0x04
46 #define ILI9341_RDDST 0x09
48 #define ILI9341_SLPIN 0x10
49 #define ILI9341_SLPOUT 0x11
50 #define ILI9341_PTLON 0x12
51 #define ILI9341_NORON 0x13
53 #define ILI9341_RDMODE 0x0A
54 #define ILI9341_RDMADCTL 0x0B
55 #define ILI9341_RDPIXFMT 0x0C
56 #define ILI9341_RDIMGFMT 0x0D
57 #define ILI9341_RDSELFDIAG 0x0F
59 #define ILI9341_INVOFF 0x20
60 #define ILI9341_INVON 0x21
61 #define ILI9341_GAMMASET 0x26
62 #define ILI9341_DISPOFF 0x28
63 #define ILI9341_DISPON 0x29
65 #define ILI9341_CASET 0x2A
66 #define ILI9341_PASET 0x2B
67 #define ILI9341_RAMWR 0x2C
68 #define ILI9341_RAMRD 0x2E
70 #define ILI9341_PTLAR 0x30
71 #define ILI9341_MADCTL 0x36
72 #define ILI9341_PIXFMT 0x3A
74 #define ILI9341_FRMCTR1 0xB1
75 #define ILI9341_FRMCTR2 0xB2
76 #define ILI9341_FRMCTR3 0xB3
77 #define ILI9341_INVCTR 0xB4
78 #define ILI9341_DFUNCTR 0xB6
80 #define ILI9341_PWCTR1 0xC0
81 #define ILI9341_PWCTR2 0xC1
82 #define ILI9341_PWCTR3 0xC2
83 #define ILI9341_PWCTR4 0xC3
84 #define ILI9341_PWCTR5 0xC4
85 #define ILI9341_VMCTR1 0xC5
86 #define ILI9341_VMCTR2 0xC7
88 #define ILI9341_RDID1 0xDA
89 #define ILI9341_RDID2 0xDB
90 #define ILI9341_RDID3 0xDC
91 #define ILI9341_RDID4 0xDD
93 #define ILI9341_GMCTRP1 0xE0
94 #define ILI9341_GMCTRN1 0xE1
96 #define MADCTL_MY 0x80
97 #define MADCTL_MX 0x40
98 #define MADCTL_MV 0x20
99 #define MADCTL_ML 0x10
100 #define MADCTL_RGB 0x00
101 #define MADCTL_BGR 0x08
102 #define MADCTL_MH 0x04
110 #define ILI9341_BLACK 0x0000
111 #define ILI9341_NAVY 0x000F
112 #define ILI9341_DARKGREEN 0x03E0
113 #define ILI9341_DARKCYAN 0x03EF
114 #define ILI9341_MAROON 0x7800
115 #define ILI9341_PURPLE 0x780F
116 #define ILI9341_OLIVE 0x7BE0
117 #define ILI9341_LIGHTGREY 0xC618
118 #define ILI9341_DARKGREY 0x7BEF
119 #define ILI9341_BLUE 0x001F
120 #define ILI9341_GREEN 0x07E0
121 #define ILI9341_CYAN 0x07FF
122 #define ILI9341_RED 0xF800
123 #define ILI9341_MAGENTA 0xF81F
124 #define ILI9341_YELLOW 0xFFE0
125 #define ILI9341_WHITE 0xFFFF
126 #define ILI9341_ORANGE 0xFD20
127 #define ILI9341_GREENYELLOW 0xAFE5
128 #define ILI9341_PINK 0xF81F
162 ILI9341(uint8_t csLCD, uint8_t csSD, uint8_t dc, uint8_t rst);
203 void drawPixel(int16_t x, int16_t y, uint16_t color);
213 void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
223 void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
269 uint16_t
color565(uint8_t r, uint8_t g, uint8_t b);
320 mraa::Result
dcLow();
334 uint8_t m_spiBuffer[32];
336 mraa::Gpio m_csLCDPinCtx;
337 mraa::Gpio m_csSDPinCtx;
338 mraa::Gpio m_dcPinCtx;
339 mraa::Gpio m_rstPinCtx;
uint16_t color565(uint8_t r, uint8_t g, uint8_t b)
Definition: ili9341.cxx:349
void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Definition: ili9341.cxx:285
void invertDisplay(bool i)
Definition: ili9341.cxx:345
void executeCMDList(const uint8_t *addr)
Definition: ili9341.cxx:353
void drawPixel(int16_t x, int16_t y, uint16_t color)
Definition: ili9341.cxx:246
mraa::Result lcdCSOn()
Definition: ili9341.cxx:391
mraa::Result lcdCSOff()
Definition: ili9341.cxx:407
void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1)
Definition: ili9341.cxx:226
GFX helper class.
Definition: gfx.h:38
std::string name()
Definition: ili9341.h:167
ILI9341(uint8_t csLCD, uint8_t csSD, uint8_t dc, uint8_t rst)
Definition: ili9341.cxx:40
void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Definition: ili9341.cxx:258
mraa::Result dcHigh()
Definition: ili9341.cxx:445
void writecommand(uint8_t c)
Definition: ili9341.cxx:377
mraa::Result rstLow()
Definition: ili9341.cxx:478
mraa::Result rstHigh()
Definition: ili9341.cxx:467
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
Definition: ili9341.cxx:312
void fillScreen(uint16_t color)
Definition: ili9341.cxx:341
void initModule()
Definition: ili9341.cxx:48
API for the ILI9342 LCd.
Definition: ili9341.h:152
mraa::Result sdCSOff()
Definition: ili9341.cxx:434
void writedata(uint8_t d)
Definition: ili9341.cxx:384
void configModule()
Definition: ili9341.cxx:107
mraa::Result sdCSOn()
Definition: ili9341.cxx:418
void setRotation(uint8_t r)
Definition: ili9341.cxx:79
mraa::Result dcLow()
Definition: ili9341.cxx:456