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_ssd1331.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 InterfaceSSD1331: public I
44 {
45 public:
54  template <typename... Args>
55  InterfaceSSD1331(uint8_t bits, NanoDisplayBase<InterfaceSSD1331<I>> &base, int8_t dc, Args &&... data)
56  : I(data...)
57  , m_bits(bits)
58  , m_dc(dc)
59  , m_base(base)
60  {
61  }
62 
79 
86  void nextBlock();
87 
91  void endBlock();
92 
97  void setDataMode(uint8_t mode);
98 
103  void commandStart();
104 
111  void setRotation(uint8_t rotation);
112 
122  void drawLine(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2, uint16_t color);
123 
141  void copyBlock(uint8_t left, uint8_t top, uint8_t right, uint8_t bottom, uint8_t newLeft, uint8_t newTop);
142 
148  void setContrast(uint8_t contrast);
149 
150 private:
151  const uint8_t m_bits;
152  const int8_t m_dc = -1;
154  uint8_t m_rotation = 0x00;
155 };
159 template <typename I> class DisplaySSD1331x8: public NanoDisplayOps<NanoDisplayOps8<I>, I>
160 {
161 public:
168  DisplaySSD1331x8(I &intf, int8_t rstPin)
169  : NanoDisplayOps<NanoDisplayOps8<I>, I>(intf)
170  , m_rstPin(rstPin)
171  {
172  }
173 
174 protected:
175  int8_t m_rstPin;
176 
180  void beginDisplay();
181 
185  void endDisplay();
186 };
187 
191 template <typename I> class DisplaySSD1331_96x64x8: public DisplaySSD1331x8<I>
192 {
193 public:
200  DisplaySSD1331_96x64x8(I &intf, int8_t rstPin)
201  : DisplaySSD1331x8<I>(intf, rstPin)
202  {
203  }
204 
205 protected:
209  void beginController();
210 
214  void endController();
215 };
216 #ifdef CONFIG_LCDGFX_PLATFORM_SPI
217 
220 class DisplaySSD1331_96x64x8_SPI: public DisplaySSD1331_96x64x8<InterfaceSSD1331<PlatformSpi>>
221 {
222 public:
230  explicit DisplaySSD1331_96x64x8_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0U, -1, -1})
231  : DisplaySSD1331_96x64x8(m_spi, rstPin)
232  , m_spi(8, *this, config.dc,
234  config.busId, {config.cs}, config.dc, config.frequency ?: static_cast<uint32_t>(6000000), config.scl, config.sda})
235  {
236  }
237 
241  void begin() override;
242 
246  void end() override;
247 
248 private:
250 };
251 #endif
252 
257 template <typename I> class DisplaySSD1331_96x64x8_CustomSPI: public DisplaySSD1331_96x64x8<InterfaceSSD1331<I>>
258 {
259 public:
268  template <typename... Args>
269  DisplaySSD1331_96x64x8_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
270  : DisplaySSD1331_96x64x8<InterfaceSSD1331<I>>(m_spi, rstPin)
271  , m_spi(8, *this, dcPin, data...)
272  {
273  }
274 
278  void begin() override
279  {
280  m_spi.begin();
281  DisplaySSD1331_96x64x8<InterfaceSSD1331<I>>::beginController();
282  }
283 
287  void end() override
288  {
290  m_spi.end();
291  }
292 
293 private:
294  InterfaceSSD1331<I> m_spi;
295 };
299 template <typename I> class DisplaySSD1331x16: public NanoDisplayOps<NanoDisplayOps16<I>, I>
300 {
301 public:
308  DisplaySSD1331x16(I &intf, int8_t rstPin)
309  : NanoDisplayOps<NanoDisplayOps16<I>, I>(intf)
310  , m_rstPin(rstPin)
311  {
312  }
313 
314 protected:
315  int8_t m_rstPin;
316 
320  void beginDisplay();
321 
325  void endDisplay();
326 };
327 
331 template <typename I> class DisplaySSD1331_96x64x16: public DisplaySSD1331x16<I>
332 {
333 public:
340  DisplaySSD1331_96x64x16(I &intf, int8_t rstPin)
341  : DisplaySSD1331x16<I>(intf, rstPin)
342  {
343  }
344 
345 protected:
349  void beginController();
350 
354  void endController();
355 };
356 #ifdef CONFIG_LCDGFX_PLATFORM_SPI
357 
360 class DisplaySSD1331_96x64x16_SPI: public DisplaySSD1331_96x64x16<InterfaceSSD1331<PlatformSpi>>
361 {
362 public:
370  explicit DisplaySSD1331_96x64x16_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0U, -1, -1})
371  : DisplaySSD1331_96x64x16(m_spi, rstPin)
372  , m_spi(16, *this, config.dc,
374  config.busId, {config.cs}, config.dc, config.frequency ?: static_cast<uint32_t>(6000000), config.scl, config.sda})
375  {
376  }
377 
381  void begin() override;
382 
386  void end() override;
387 
388 private:
390 };
391 #endif
392 
397 template <typename I> class DisplaySSD1331_96x64x16_CustomSPI: public DisplaySSD1331_96x64x16<InterfaceSSD1331<I>>
398 {
399 public:
408  template <typename... Args>
409  DisplaySSD1331_96x64x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
410  : DisplaySSD1331_96x64x16<InterfaceSSD1331<I>>(m_spi, rstPin)
411  , m_spi(16, *this, dcPin, data...)
412  {
413  }
414 
418  void begin() override
419  {
420  m_spi.begin();
422  }
423 
427  void end() override
428  {
430  m_spi.end();
431  }
432 
433 private:
434  InterfaceSSD1331<I> m_spi;
435 };
436 #include "lcd_ssd1331.inl"
437 
uint8_t lcduint_t
Definition: canvas_types.h:79
DisplaySSD1331x16(I &intf, int8_t rstPin)
Definition: lcd_ssd1331.h:308
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_ssd1331.h:315
void setContrast(uint8_t contrast)
void copyBlock(uint8_t left, uint8_t top, uint8_t right, uint8_t bottom, uint8_t newLeft, uint8_t newTop)
int8_t lcdint_t
Definition: canvas_types.h:77
InterfaceSSD1331(uint8_t bits, NanoDisplayBase< InterfaceSSD1331< I >> &base, int8_t dc, Args &&... data)
Definition: lcd_ssd1331.h:55
DisplaySSD1331_96x64x16(I &intf, int8_t rstPin)
Definition: lcd_ssd1331.h:340
void setRotation(uint8_t rotation)
Sets screen orientation (rotation)
Definition: lcd_ssd1331.inl:76
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_ssd1331.inl:35
void drawLine(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2, uint16_t color)
DisplaySSD1331x8(I &intf, int8_t rstPin)
Definition: lcd_ssd1331.h:168
DisplaySSD1331_96x64x8(I &intf, int8_t rstPin)
Definition: lcd_ssd1331.h:200
DisplaySSD1331_96x64x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
Inits 96x64x16 lcd display over spi (based on SSD1331 controller): 16-bit mode.
Definition: lcd_ssd1331.h:409
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_ssd1331.h:175
void setDataMode(uint8_t mode)
Definition: lcd_ssd1331.inl:59
DisplaySSD1331_96x64x8_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
Inits 96x64x8 lcd display over spi (based on SSD1331 controller): 8-bit mode.
Definition: lcd_ssd1331.h:269