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 };
189 #ifdef CONFIG_LCDGFX_PLATFORM_SPI
190 
193 class DisplayILI9341_240x320x16_SPI: public DisplayILI9341_240x320x16<InterfaceILI9341<PlatformSpi>>
194 {
195 public:
203  explicit DisplayILI9341_240x320x16_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0U, -1, -1})
204  : DisplayILI9341_240x320x16(m_spi, rstPin)
205  , m_spi(*this, config.dc,
207  config.busId, {config.cs}, config.dc, config.frequency ?: static_cast<uint32_t>(10000000), config.scl, config.sda})
208  {
209  }
210 
214  void begin() override;
215 
219  void end() override;
220 
221 private:
223 };
224 #endif
225 
230 template <typename I> class DisplayILI9341_240x320x16_CustomSPI: public DisplayILI9341_240x320x16<InterfaceILI9341<I>>
231 {
232 public:
241  template <typename... Args>
242  DisplayILI9341_240x320x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
243  : DisplayILI9341_240x320x16<InterfaceILI9341<I>>(m_spi, rstPin)
244  , m_spi(*this, dcPin, data...)
245  {
246  }
247 
251  void begin() override
252  {
253  m_spi.begin();
255  }
256 
260  void end() override
261  {
263  m_spi.end();
264  }
265 
266 private:
267  InterfaceILI9341<I> m_spi;
268 };
272 template <typename I> class DisplayILI9341_128x160x16: public DisplayILI9341x16<I>
273 {
274 public:
281  DisplayILI9341_128x160x16(I &intf, int8_t rstPin)
282  : DisplayILI9341x16<I>(intf, rstPin)
283  {
284  }
285 
286 protected:
290  void beginController();
291 
295  void endController();
296 };
297 #ifdef CONFIG_LCDGFX_PLATFORM_SPI
298 
301 class DisplayILI9341_128x160x16_SPI: public DisplayILI9341_128x160x16<InterfaceILI9341<PlatformSpi>>
302 {
303 public:
311  explicit DisplayILI9341_128x160x16_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0U, -1, -1})
312  : DisplayILI9341_128x160x16(m_spi, rstPin)
313  , m_spi(*this, config.dc,
315  config.busId, {config.cs}, config.dc, config.frequency ?: static_cast<uint32_t>(10000000), config.scl, config.sda})
316  {
317  }
318 
322  void begin() override;
323 
327  void end() override;
328 
329 private:
331 };
332 #endif
333 
338 template <typename I> class DisplayILI9341_128x160x16_CustomSPI: public DisplayILI9341_128x160x16<InterfaceILI9341<I>>
339 {
340 public:
349  template <typename... Args>
350  DisplayILI9341_128x160x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
351  : DisplayILI9341_128x160x16<InterfaceILI9341<I>>(m_spi, rstPin)
352  , m_spi(*this, dcPin, data...)
353  {
354  }
355 
359  void begin() override
360  {
361  m_spi.begin();
363  }
364 
368  void end() override
369  {
371  m_spi.end();
372  }
373 
374 private:
375  InterfaceILI9341<I> m_spi;
376 };
377 #include "lcd_ili9341.inl"
378 
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:350
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:281
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:242
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