LCDGFX LCD display driver  1.0.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 (c) 2019-2020, 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 <class I>
44 class InterfaceILI9341: public I
45 {
46 public:
54  template <typename... Args>
55  InterfaceILI9341(NanoDisplayBase<InterfaceILI9341<I>> &base, int8_t dc, Args&&... data)
56  : I(data...)
57  , m_dc( dc )
58  , m_base(base)
59  {
60  }
61 
78 
85  void nextBlock();
86 
90  void endBlock();
91 
96  void setDataMode(uint8_t mode);
97 
102  void commandStart();
103 
110  void setRotation(uint8_t rotation);
111 
121  void rotateOutput(uint8_t rotate);
122 
123 private:
124  const int8_t m_dc = -1;
126 
127  uint8_t m_rotation = 0x00;
128  uint8_t m_rotate_output = 0x00;
129  static const uint8_t m_rgb_bit = 0b00001000;
130 };
131 
132 
136 template <class I>
137 class DisplayILI9341x16: public NanoDisplayOps<NanoDisplayOps16<I>,I>
138 {
139 public:
146  DisplayILI9341x16(I &intf, int8_t rstPin)
147  : NanoDisplayOps<NanoDisplayOps16<I>, I>(intf)
148  , m_rstPin( rstPin ) { }
149 
150 protected:
151  int8_t m_rstPin;
152 
156  void begin() override;
157 
161  void end() override;
162 };
163 
167 template <class I>
169 {
170 public:
177  DisplayILI9341_240x320x16(I &intf, int8_t rstPin)
178  : DisplayILI9341x16<I>(intf, rstPin) { }
179 
180 protected:
181 
185  void begin() override;
186 
190  void end() override;
191 };
192 
196 class DisplayILI9341_240x320x16_SPI: public DisplayILI9341_240x320x16<InterfaceILI9341<PlatformSpi>>
197 {
198 public:
206  DisplayILI9341_240x320x16_SPI( int8_t rstPin, const SPlatformSpiConfig &config = { -1, { -1 }, -1, 0, -1, -1 } )
207  : DisplayILI9341_240x320x16(m_spi, rstPin)
208  , m_spi( *this, config.dc,
209  SPlatformSpiConfig{ config.busId,
210  { config.cs },
211  config.dc,
212  config.frequency ?: 10000000,
213  config.scl,
214  config.sda } ) {}
215 
219  void begin() override;
220 
224  void end() override;
225 
226 private:
228 };
229 
234 template <class I>
236 {
237 public:
246  template <typename... Args>
247  DisplayILI9341_240x320x16_CustomSPI( int8_t rstPin, int8_t dcPin, Args&&... data )
248  : DisplayILI9341_240x320x16<InterfaceILI9341<I>>(m_spi, rstPin)
249  , m_spi( *this, dcPin,
250  data... ) {}
251 
255  void begin() override
256  {
257  m_spi.begin();
259  }
260 
264  void end() override
265  {
267  m_spi.end();
268  }
269 
270 private:
271  InterfaceILI9341<I> m_spi;
272 };
276 template <class I>
278 {
279 public:
286  DisplayILI9341_128x160x16(I &intf, int8_t rstPin)
287  : DisplayILI9341x16<I>(intf, rstPin) { }
288 
289 protected:
290 
294  void begin() override;
295 
299  void end() override;
300 };
301 
305 class DisplayILI9341_128x160x16_SPI: public DisplayILI9341_128x160x16<InterfaceILI9341<PlatformSpi>>
306 {
307 public:
315  DisplayILI9341_128x160x16_SPI( int8_t rstPin, const SPlatformSpiConfig &config = { -1, { -1 }, -1, 0, -1, -1 } )
316  : DisplayILI9341_128x160x16(m_spi, rstPin)
317  , m_spi( *this, config.dc,
318  SPlatformSpiConfig{ config.busId,
319  { config.cs },
320  config.dc,
321  config.frequency ?: 10000000,
322  config.scl,
323  config.sda } ) {}
324 
328  void begin() override;
329 
333  void end() override;
334 
335 private:
337 };
338 
343 template <class I>
345 {
346 public:
355  template <typename... Args>
356  DisplayILI9341_128x160x16_CustomSPI( int8_t rstPin, int8_t dcPin, Args&&... data )
357  : DisplayILI9341_128x160x16<InterfaceILI9341<I>>(m_spi, rstPin)
358  , m_spi( *this, dcPin,
359  data... ) {}
360 
364  void begin() override
365  {
366  m_spi.begin();
368  }
369 
373  void end() override
374  {
376  m_spi.end();
377  }
378 
379 private:
380  InterfaceILI9341<I> m_spi;
381 };
382 #include "lcd_ili9341.inl"
383 
DisplayILI9341x16(I &intf, int8_t rstPin)
Definition: lcd_ili9341.h:146
uint8_t lcduint_t
Definition: canvas_types.h:81
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:356
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_ili9341.h:151
void setDataMode(uint8_t mode)
Definition: lcd_ili9341.inl:73
InterfaceILI9341(NanoDisplayBase< InterfaceILI9341< I >> &base, int8_t dc, Args &&... data)
Definition: lcd_ili9341.h:55
void setRotation(uint8_t rotation)
Sets screen orientation (rotation)
Definition: lcd_ili9341.inl:92
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:315
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:206
DisplayILI9341_240x320x16(I &intf, int8_t rstPin)
Definition: lcd_ili9341.h:177
DisplayILI9341_128x160x16(I &intf, int8_t rstPin)
Definition: lcd_ili9341.h:286
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:247
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:36