LCDGFX LCD display driver  1.2.0
Lightweight graphics library for SSD1306, SSD1325, SSD1327, SSD1331, SSD1351, SH1106, SH1107, IL9163, ST7735, ST7789, ILI9341, PCD8544 displays over I2C/SPI
lcd_il9163.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 InterfaceIL9163: public I
44 {
45 public:
53  template <typename... Args>
54  InterfaceIL9163(NanoDisplayBase<InterfaceIL9163<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 
114  void setRotation(uint8_t rotation);
115 
120  void normalMode();
121 
127  void invertMode();
128 
129 private:
130  const int8_t m_dc = -1;
132  uint8_t m_rotation = 0x00;
133  uint8_t m_rgb_bit = 0b00000000;
134 };
138 template <typename I> class DisplayIL9163x16: public NanoDisplayOps<NanoDisplayOps16<I>, I>
139 {
140 public:
147  DisplayIL9163x16(I &intf, int8_t rstPin)
148  : NanoDisplayOps<NanoDisplayOps16<I>, I>(intf)
149  , m_rstPin(rstPin)
150  {
151  }
152 
153 protected:
154  int8_t m_rstPin;
155 
159  void beginDisplay();
160 
164  void endDisplay();
165 };
166 
170 template <typename I> class DisplayIL9163_128x128x16: public DisplayIL9163x16<I>
171 {
172 public:
179  DisplayIL9163_128x128x16(I &intf, int8_t rstPin)
180  : DisplayIL9163x16<I>(intf, rstPin)
181  {
182  }
183 
184 protected:
188  void beginController();
189 
193  void endController();
194 };
195 #ifdef CONFIG_LCDGFX_PLATFORM_SPI
196 
199 class DisplayIL9163_128x128x16_SPI: public DisplayIL9163_128x128x16<InterfaceIL9163<PlatformSpi>>
200 {
201 public:
209  explicit DisplayIL9163_128x128x16_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0U, -1, -1})
210  : DisplayIL9163_128x128x16(m_spi, rstPin)
211  , m_spi(*this, config.dc,
213  config.busId, {config.cs}, config.dc, config.frequency ?: static_cast<uint32_t>(8000000), config.scl, config.sda})
214  {
215  }
216 
220  void begin() override;
221 
225  void end() override;
226 
227 private:
229 };
230 #endif
231 
236 template <typename I> class DisplayIL9163_128x128x16_CustomSPI: public DisplayIL9163_128x128x16<InterfaceIL9163<I>>
237 {
238 public:
247  template <typename... Args>
248  DisplayIL9163_128x128x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
249  : DisplayIL9163_128x128x16<InterfaceIL9163<I>>(m_spi, rstPin)
250  , m_spi(*this, dcPin, data...)
251  {
252  }
253 
257  void begin() override
258  {
259  m_spi.begin();
261  }
262 
266  void end() override
267  {
269  m_spi.end();
270  }
271 
272 private:
273  InterfaceIL9163<I> m_spi;
274 };
278 template <typename I> class DisplayIL9163_128x160x16: public DisplayIL9163x16<I>
279 {
280 public:
287  DisplayIL9163_128x160x16(I &intf, int8_t rstPin)
288  : DisplayIL9163x16<I>(intf, rstPin)
289  {
290  }
291 
292 protected:
296  void beginController();
297 
301  void endController();
302 };
303 #ifdef CONFIG_LCDGFX_PLATFORM_SPI
304 
307 class DisplayIL9163_128x160x16_SPI: public DisplayIL9163_128x160x16<InterfaceIL9163<PlatformSpi>>
308 {
309 public:
317  explicit DisplayIL9163_128x160x16_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0U, -1, -1})
318  : DisplayIL9163_128x160x16(m_spi, rstPin)
319  , m_spi(*this, config.dc,
321  config.busId, {config.cs}, config.dc, config.frequency ?: static_cast<uint32_t>(8000000), config.scl, config.sda})
322  {
323  }
324 
328  void begin() override;
329 
333  void end() override;
334 
335 private:
337 };
338 #endif
339 
344 template <typename I> class DisplayIL9163_128x160x16_CustomSPI: public DisplayIL9163_128x160x16<InterfaceIL9163<I>>
345 {
346 public:
355  template <typename... Args>
356  DisplayIL9163_128x160x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
357  : DisplayIL9163_128x160x16<InterfaceIL9163<I>>(m_spi, rstPin)
358  , m_spi(*this, dcPin, data...)
359  {
360  }
361 
365  void begin() override
366  {
367  m_spi.begin();
369  }
370 
374  void end() override
375  {
377  m_spi.end();
378  }
379 
380 private:
381  InterfaceIL9163<I> m_spi;
382 };
383 #include "lcd_il9163.inl"
384 
Structure describes spi platform configuration.
Definition: interface.h:80
uint8_t lcduint_t
internal int type, used by the library.
Definition: canvas_types.h:79
Class implements interface functions to IL9163 displays.
Definition: lcd_il9163.h:43
void invertMode()
Switches display to inverted mode (sends INVON command).
Definition: lcd_il9163.inl:129
Class implements basic functions for 16-bit mode of IL9163-based displays.
Definition: lcd_il9163.h:278
global lcd settings
Template class implements IL9163 128x128x16 lcd display in 16 bit mode over custom SPI implementation...
Definition: lcd_il9163.h:236
void setDataMode(uint8_t mode)
Enables either data or command mode on SPI bus.
Definition: lcd_il9163.inl:70
SSD1306 HAL IO communication functions.
DisplayIL9163_128x128x16(I &intf, int8_t rstPin)
Creates instance of IL9163 128x128x16 controller class for 16-bit mode.
Definition: lcd_il9163.h:179
DisplayIL9163x16(I &intf, int8_t rstPin)
Creates instance of IL9163 controller class for 16-bit mode.
Definition: lcd_il9163.h:147
void setRotation(uint8_t rotation)
Sets screen orientation (rotation)
Definition: lcd_il9163.inl:87
void end() override
Closes connection to display.
Definition: lcd_il9163.h:266
int8_t dc
Data command control pin number.
Definition: interface.h:102
void commandStart()
Starts communication with LCD display in command mode.
Definition: lcd_il9163.inl:78
DisplayIL9163_128x160x16(I &intf, int8_t rstPin)
Creates instance of IL9163 128x160x16 controller class for 16-bit mode.
Definition: lcd_il9163.h:287
void endBlock()
Closes data send operation to lcd display.
Definition: lcd_il9163.inl:65
void begin() override
Initializes IL9163 lcd in 16-bit mode.
Definition: lcd_il9163.h:257
void begin() override
Initializes IL9163 lcd in 16-bit mode.
Definition: lcd_il9163.h:365
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_il9163.inl:35
DisplayIL9163_128x160x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
Inits 128x160x16 lcd display over spi (based on IL9163 controller): 16-bit mode.
Definition: lcd_il9163.h:356
Template class implements IL9163 128x160x16 lcd display in 16 bit mode over custom SPI implementation...
Definition: lcd_il9163.h:344
DisplayIL9163_128x128x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
Inits 128x128x16 lcd display over spi (based on IL9163 controller): 16-bit mode.
Definition: lcd_il9163.h:248
InterfaceIL9163(NanoDisplayBase< InterfaceIL9163< I >> &base, int8_t dc, Args &&... data)
Creates instance of interface to LCD display.
Definition: lcd_il9163.h:54
Class implements basic functions for 16-bit mode of IL9163-based displays.
Definition: lcd_il9163.h:138
Class implements basic functions for 16-bit mode of IL9163-based displays.
Definition: lcd_il9163.h:170
void end() override
Closes connection to display.
Definition: lcd_il9163.h:374
NanoCanvasOps provides operations for drawing in memory buffer.
Definition: display.h:978
Class implements basic display operations for the library: It stores reference to communication inter...
Definition: display_base.h:55
void nextBlock()
Switches to the start of next RAM page for the block, specified by startBlock().
Definition: lcd_il9163.inl:60
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_il9163.h:154
NanoDisplayOps16 is template class for 16-bit operations.
Definition: display.h:740
void normalMode()
Switches display to normal (non-inverted) mode (sends INVOFF command).
Definition: lcd_il9163.inl:121