LCDGFX LCD display driver  1.1.5
This library is developed to control SSD1306/SSD1325/SSD1327/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
lcd_ili9341.h
Go to the documentation of this file.
1 /*
2  MIT License
3 
4  Copyright 2019-2022 (C) Alexey Dynda
5 
6  Permission is hereby granted, free of charge, to any person obtaining a copy
7  of this software and associated documentation files (the "Software"), to deal
8  in the Software without restriction, including without limitation the rights
9  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  copies of the Software, and to permit persons to whom the Software is
11  furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in all
14  copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  SOFTWARE.
23 */
24 /* !!! THIS FILE IS AUTO GENERATED !!! */
29 #pragma once
30 
31 #include "lcd_hal/io.h"
32 #include "v2/lcd/lcd_common.h"
33 #include "v2/lcd/base/display.h"
34 
43 template <typename I> class InterfaceILI9341: public I
44 {
45 public:
53  template <typename... Args>
54  InterfaceILI9341(NanoDisplayBase<InterfaceILI9341<I>> &base, int8_t dc, Args &&... data)
55  : I(data...)
56  , m_dc(dc)
57  , m_base(base)
58  {
59  }
60 
77 
84  void nextBlock();
85 
89  void endBlock();
90 
95  void setDataMode(uint8_t mode);
96 
101  void commandStart();
102 
109  void setRotation(uint8_t rotation);
110 
120  void rotateOutput(uint8_t rotate);
121 
122 private:
123  const int8_t m_dc = -1;
125  uint8_t m_rotation = 0x00;
126  uint8_t m_rotate_output = 0x00;
127  static const uint8_t m_rgb_bit = 0b00001000;
128 };
132 template <typename I> class DisplayILI9341x16: public NanoDisplayOps<NanoDisplayOps16<I>, I>
133 {
134 public:
141  DisplayILI9341x16(I &intf, int8_t rstPin)
142  : NanoDisplayOps<NanoDisplayOps16<I>, I>(intf)
143  , m_rstPin(rstPin)
144  {
145  }
146 
147 protected:
148  int8_t m_rstPin;
149 
153  void beginDisplay();
154 
158  void endDisplay();
159 };
160 
164 template <typename I> class DisplayILI9341_240x320x16: public DisplayILI9341x16<I>
165 {
166 public:
173  DisplayILI9341_240x320x16(I &intf, int8_t rstPin)
174  : DisplayILI9341x16<I>(intf, rstPin)
175  {
176  }
177 
178 protected:
182  void beginController();
183 
187  void endController();
188 };
192 class DisplayILI9341_240x320x16_SPI: public DisplayILI9341_240x320x16<InterfaceILI9341<PlatformSpi>>
193 {
194 public:
202  explicit DisplayILI9341_240x320x16_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0, -1, -1})
203  : DisplayILI9341_240x320x16(m_spi, rstPin)
204  , m_spi(*this, config.dc,
206  config.busId, {config.cs}, config.dc, config.frequency ?: 10000000, config.scl, config.sda})
207  {
208  }
209 
213  void begin() override;
214 
218  void end() override;
219 
220 private:
222 };
223 
228 template <typename I> class DisplayILI9341_240x320x16_CustomSPI: public DisplayILI9341_240x320x16<InterfaceILI9341<I>>
229 {
230 public:
239  template <typename... Args>
240  DisplayILI9341_240x320x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
241  : DisplayILI9341_240x320x16<InterfaceILI9341<I>>(m_spi, rstPin)
242  , m_spi(*this, dcPin, data...)
243  {
244  }
245 
249  void begin() override
250  {
251  m_spi.begin();
253  }
254 
258  void end() override
259  {
261  m_spi.end();
262  }
263 
264 private:
265  InterfaceILI9341<I> m_spi;
266 };
270 template <typename I> class DisplayILI9341_128x160x16: public DisplayILI9341x16<I>
271 {
272 public:
279  DisplayILI9341_128x160x16(I &intf, int8_t rstPin)
280  : DisplayILI9341x16<I>(intf, rstPin)
281  {
282  }
283 
284 protected:
288  void beginController();
289 
293  void endController();
294 };
298 class DisplayILI9341_128x160x16_SPI: public DisplayILI9341_128x160x16<InterfaceILI9341<PlatformSpi>>
299 {
300 public:
308  explicit DisplayILI9341_128x160x16_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0, -1, -1})
309  : DisplayILI9341_128x160x16(m_spi, rstPin)
310  , m_spi(*this, config.dc,
312  config.busId, {config.cs}, config.dc, config.frequency ?: 10000000, config.scl, config.sda})
313  {
314  }
315 
319  void begin() override;
320 
324  void end() override;
325 
326 private:
328 };
329 
334 template <typename I> class DisplayILI9341_128x160x16_CustomSPI: public DisplayILI9341_128x160x16<InterfaceILI9341<I>>
335 {
336 public:
345  template <typename... Args>
346  DisplayILI9341_128x160x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
347  : DisplayILI9341_128x160x16<InterfaceILI9341<I>>(m_spi, rstPin)
348  , m_spi(*this, dcPin, data...)
349  {
350  }
351 
355  void begin() override
356  {
357  m_spi.begin();
359  }
360 
364  void end() override
365  {
367  m_spi.end();
368  }
369 
370 private:
371  InterfaceILI9341<I> m_spi;
372 };
373 #include "lcd_ili9341.inl"
374 
DisplayILI9341_240x320x16_SPI(int8_t rstPin, const SPlatformSpiConfig &config={-1, {-1}, -1, 0, -1, -1})
Inits 240x320x16 lcd display over spi (based on ILI9341 controller): 16-bit mode. ...
Definition: lcd_ili9341.h:202
DisplayILI9341x16(I &intf, int8_t rstPin)
Definition: lcd_ili9341.h:141
uint8_t lcduint_t
Definition: canvas_types.h:79
void rotateOutput(uint8_t rotate)
Sets rotation of all output functions.
DisplayILI9341_128x160x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
Inits 128x160x16 lcd display over spi (based on ILI9341 controller): 16-bit mode. ...
Definition: lcd_ili9341.h:346
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_ili9341.h:148
void setDataMode(uint8_t mode)
Definition: lcd_ili9341.inl:69
InterfaceILI9341(NanoDisplayBase< InterfaceILI9341< I >> &base, int8_t dc, Args &&... data)
Definition: lcd_ili9341.h:54
void setRotation(uint8_t rotation)
Sets screen orientation (rotation)
Definition: lcd_ili9341.inl:86
DisplayILI9341_240x320x16(I &intf, int8_t rstPin)
Definition: lcd_ili9341.h:173
DisplayILI9341_128x160x16(I &intf, int8_t rstPin)
Definition: lcd_ili9341.h:279
DisplayILI9341_128x160x16_SPI(int8_t rstPin, const SPlatformSpiConfig &config={-1, {-1}, -1, 0, -1, -1})
Inits 128x160x16 lcd display over spi (based on ILI9341 controller): 16-bit mode. ...
Definition: lcd_ili9341.h:308
DisplayILI9341_240x320x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
Inits 240x320x16 lcd display over spi (based on ILI9341 controller): 16-bit mode. ...
Definition: lcd_ili9341.h:240
void startBlock(lcduint_t x, lcduint_t y, lcduint_t w)
Sets block in RAM of lcd display controller to write data to.
Definition: lcd_ili9341.inl:35