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_ssd1351.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 InterfaceSSD1351: public I
44 {
45 public:
53  template <typename... Args>
54  InterfaceSSD1351(NanoDisplayBase<InterfaceSSD1351<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 
126  void setOffset(lcdint_t ox, lcdint_t oy);
127 
134  void setRgbMode(uint8_t mode);
135 
141  void setContrast(uint8_t contrast);
142 
143 private:
144  const int8_t m_dc = -1;
146  uint8_t m_rotation = 0x00;
147  uint8_t m_rgbMode = 0x04;
148  lcdint_t m_offset_x = 0x00;
149  lcdint_t m_offset_y = 0x00;
150 };
154 template <typename I> class DisplaySSD1351x16: public NanoDisplayOps<NanoDisplayOps16<I>, I>
155 {
156 public:
163  DisplaySSD1351x16(I &intf, int8_t rstPin)
164  : NanoDisplayOps<NanoDisplayOps16<I>, I>(intf)
165  , m_rstPin(rstPin)
166  {
167  }
168 
169 protected:
170  int8_t m_rstPin;
171 
175  void beginDisplay();
176 
180  void endDisplay();
181 };
182 
186 template <typename I> class DisplaySSD1351_128x128x16: public DisplaySSD1351x16<I>
187 {
188 public:
195  DisplaySSD1351_128x128x16(I &intf, int8_t rstPin)
196  : DisplaySSD1351x16<I>(intf, rstPin)
197  {
198  }
199 
200 protected:
204  void beginController();
205 
209  void endController();
210 };
211 #ifdef CONFIG_LCDGFX_PLATFORM_SPI
212 
215 class DisplaySSD1351_128x128x16_SPI: public DisplaySSD1351_128x128x16<InterfaceSSD1351<PlatformSpi>>
216 {
217 public:
225  explicit DisplaySSD1351_128x128x16_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0U, -1, -1})
226  : DisplaySSD1351_128x128x16(m_spi, rstPin)
227  , m_spi(*this, config.dc,
229  config.busId, {config.cs}, config.dc, config.frequency ?: static_cast<uint32_t>(4400000), config.scl, config.sda})
230  {
231  }
232 
236  void begin() override;
237 
241  void end() override;
242 
243 private:
245 };
246 #endif
247 
252 template <typename I> class DisplaySSD1351_128x128x16_CustomSPI: public DisplaySSD1351_128x128x16<InterfaceSSD1351<I>>
253 {
254 public:
263  template <typename... Args>
264  DisplaySSD1351_128x128x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
265  : DisplaySSD1351_128x128x16<InterfaceSSD1351<I>>(m_spi, rstPin)
266  , m_spi(*this, dcPin, data...)
267  {
268  }
269 
273  void begin() override
274  {
275  m_spi.begin();
277  }
278 
282  void end() override
283  {
285  m_spi.end();
286  }
287 
288 private:
289  InterfaceSSD1351<I> m_spi;
290 };
294 template <typename I> class DisplaySSD1351_96x96x16: public DisplaySSD1351x16<I>
295 {
296 public:
303  DisplaySSD1351_96x96x16(I &intf, int8_t rstPin)
304  : DisplaySSD1351x16<I>(intf, rstPin)
305  {
306  }
307 
308 protected:
312  void beginController();
313 
317  void endController();
318 };
319 #ifdef CONFIG_LCDGFX_PLATFORM_SPI
320 
323 class DisplaySSD1351_96x96x16_SPI: public DisplaySSD1351_96x96x16<InterfaceSSD1351<PlatformSpi>>
324 {
325 public:
333  explicit DisplaySSD1351_96x96x16_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0U, -1, -1})
334  : DisplaySSD1351_96x96x16(m_spi, rstPin)
335  , m_spi(*this, config.dc,
337  config.busId, {config.cs}, config.dc, config.frequency ?: static_cast<uint32_t>(4400000), config.scl, config.sda})
338  {
339  }
340 
344  void begin() override;
345 
349  void end() override;
350 
351 private:
353 };
354 #endif
355 
360 template <typename I> class DisplaySSD1351_96x96x16_CustomSPI: public DisplaySSD1351_96x96x16<InterfaceSSD1351<I>>
361 {
362 public:
371  template <typename... Args>
372  DisplaySSD1351_96x96x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
373  : DisplaySSD1351_96x96x16<InterfaceSSD1351<I>>(m_spi, rstPin)
374  , m_spi(*this, dcPin, data...)
375  {
376  }
377 
381  void begin() override
382  {
383  m_spi.begin();
385  }
386 
390  void end() override
391  {
393  m_spi.end();
394  }
395 
396 private:
397  InterfaceSSD1351<I> m_spi;
398 };
399 #include "lcd_ssd1351.inl"
400 
void setRotation(uint8_t rotation)
Sets screen orientation (rotation)
Definition: lcd_ssd1351.inl:89
void setRgbMode(uint8_t mode)
Sets RGB mode used by display controller.
void endBlock()
Closes data send operation to lcd display.
Definition: lcd_ssd1351.inl:67
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
InterfaceSSD1351(NanoDisplayBase< InterfaceSSD1351< I >> &base, int8_t dc, Args &&... data)
Creates instance of interface to LCD display.
Definition: lcd_ssd1351.h:54
global lcd settings
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_ssd1351.inl:35
DisplaySSD1351_96x96x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
Inits 96x96x16 lcd display over spi (based on SSD1351 controller): 16-bit mode.
Definition: lcd_ssd1351.h:372
void commandStart()
Starts communication with LCD display in command mode.
Definition: lcd_ssd1351.inl:80
void begin() override
Initializes SSD1351 lcd in 16-bit mode.
Definition: lcd_ssd1351.h:273
Class implements basic functions for 16-bit mode of SSD1351-based displays.
Definition: lcd_ssd1351.h:294
void end() override
Closes connection to display.
Definition: lcd_ssd1351.h:390
Class implements interface functions to SSD1351 displays.
Definition: lcd_ssd1351.h:43
int8_t lcdint_t
internal int type, used by the library.
Definition: canvas_types.h:77
SSD1306 HAL IO communication functions.
DisplaySSD1351x16(I &intf, int8_t rstPin)
Creates instance of SSD1351 controller class for 16-bit mode.
Definition: lcd_ssd1351.h:163
DisplaySSD1351_128x128x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
Inits 128x128x16 lcd display over spi (based on SSD1351 controller): 16-bit mode. ...
Definition: lcd_ssd1351.h:264
void end() override
Closes connection to display.
Definition: lcd_ssd1351.h:282
DisplaySSD1351_128x128x16(I &intf, int8_t rstPin)
Creates instance of SSD1351 128x128x16 controller class for 16-bit mode.
Definition: lcd_ssd1351.h:195
int8_t dc
Data command control pin number.
Definition: interface.h:102
void nextBlock()
Switches to the start of next RAM page for the block, specified by startBlock().
Definition: lcd_ssd1351.inl:62
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_ssd1351.h:170
Class implements basic functions for 16-bit mode of SSD1351-based displays.
Definition: lcd_ssd1351.h:154
Template class implements SSD1351 96x96x16 lcd display in 16 bit mode over custom SPI implementation ...
Definition: lcd_ssd1351.h:360
void begin() override
Initializes SSD1351 lcd in 16-bit mode.
Definition: lcd_ssd1351.h:381
DisplaySSD1351_96x96x16(I &intf, int8_t rstPin)
Creates instance of SSD1351 96x96x16 controller class for 16-bit mode.
Definition: lcd_ssd1351.h:303
Template class implements SSD1351 128x128x16 lcd display in 16 bit mode over custom SPI implementatio...
Definition: lcd_ssd1351.h:252
void setDataMode(uint8_t mode)
Enables either data or command mode on SPI bus.
Definition: lcd_ssd1351.inl:72
NanoCanvasOps provides operations for drawing in memory buffer.
Definition: display.h:978
void setContrast(uint8_t contrast)
Set display contrast for all RGB channels uniformly.
void setOffset(lcdint_t ox, lcdint_t oy)
Sets display offset in GDRAM memory.
Class implements basic display operations for the library: It stores reference to communication inter...
Definition: display_base.h:55
NanoDisplayOps16 is template class for 16-bit operations.
Definition: display.h:740
Class implements basic functions for 16-bit mode of SSD1351-based displays.
Definition: lcd_ssd1351.h:186