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 
143 private:
144  const uint8_t m_bits;
145  const int8_t m_dc = -1;
147  uint8_t m_rotation = 0x00;
148 };
152 template <typename I> class DisplaySSD1331x8: public NanoDisplayOps<NanoDisplayOps8<I>, I>
153 {
154 public:
161  DisplaySSD1331x8(I &intf, int8_t rstPin)
162  : NanoDisplayOps<NanoDisplayOps8<I>, I>(intf)
163  , m_rstPin(rstPin)
164  {
165  }
166 
167 protected:
168  int8_t m_rstPin;
169 
173  void beginDisplay();
174 
178  void endDisplay();
179 };
180 
184 template <typename I> class DisplaySSD1331_96x64x8: public DisplaySSD1331x8<I>
185 {
186 public:
193  DisplaySSD1331_96x64x8(I &intf, int8_t rstPin)
194  : DisplaySSD1331x8<I>(intf, rstPin)
195  {
196  }
197 
198 protected:
202  void beginController();
203 
207  void endController();
208 };
212 class DisplaySSD1331_96x64x8_SPI: public DisplaySSD1331_96x64x8<InterfaceSSD1331<PlatformSpi>>
213 {
214 public:
222  explicit DisplaySSD1331_96x64x8_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0, -1, -1})
223  : DisplaySSD1331_96x64x8(m_spi, rstPin)
224  , m_spi(8, *this, config.dc,
226  config.busId, {config.cs}, config.dc, config.frequency ?: 6000000, config.scl, config.sda})
227  {
228  }
229 
233  void begin() override;
234 
238  void end() override;
239 
240 private:
242 };
243 
248 template <typename I> class DisplaySSD1331_96x64x8_CustomSPI: public DisplaySSD1331_96x64x8<InterfaceSSD1331<I>>
249 {
250 public:
259  template <typename... Args>
260  DisplaySSD1331_96x64x8_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
261  : DisplaySSD1331_96x64x8<InterfaceSSD1331<I>>(m_spi, rstPin)
262  , m_spi(8, *this, dcPin, data...)
263  {
264  }
265 
269  void begin() override
270  {
271  m_spi.begin();
272  DisplaySSD1331_96x64x8<InterfaceSSD1331<I>>::beginController();
273  }
274 
278  void end() override
279  {
281  m_spi.end();
282  }
283 
284 private:
285  InterfaceSSD1331<I> m_spi;
286 };
290 template <typename I> class DisplaySSD1331x16: public NanoDisplayOps<NanoDisplayOps16<I>, I>
291 {
292 public:
299  DisplaySSD1331x16(I &intf, int8_t rstPin)
300  : NanoDisplayOps<NanoDisplayOps16<I>, I>(intf)
301  , m_rstPin(rstPin)
302  {
303  }
304 
305 protected:
306  int8_t m_rstPin;
307 
311  void beginDisplay();
312 
316  void endDisplay();
317 };
318 
322 template <typename I> class DisplaySSD1331_96x64x16: public DisplaySSD1331x16<I>
323 {
324 public:
331  DisplaySSD1331_96x64x16(I &intf, int8_t rstPin)
332  : DisplaySSD1331x16<I>(intf, rstPin)
333  {
334  }
335 
336 protected:
340  void beginController();
341 
345  void endController();
346 };
350 class DisplaySSD1331_96x64x16_SPI: public DisplaySSD1331_96x64x16<InterfaceSSD1331<PlatformSpi>>
351 {
352 public:
360  explicit DisplaySSD1331_96x64x16_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0, -1, -1})
361  : DisplaySSD1331_96x64x16(m_spi, rstPin)
362  , m_spi(16, *this, config.dc,
364  config.busId, {config.cs}, config.dc, config.frequency ?: 6000000, config.scl, config.sda})
365  {
366  }
367 
371  void begin() override;
372 
376  void end() override;
377 
378 private:
380 };
381 
386 template <typename I> class DisplaySSD1331_96x64x16_CustomSPI: public DisplaySSD1331_96x64x16<InterfaceSSD1331<I>>
387 {
388 public:
397  template <typename... Args>
398  DisplaySSD1331_96x64x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
399  : DisplaySSD1331_96x64x16<InterfaceSSD1331<I>>(m_spi, rstPin)
400  , m_spi(16, *this, dcPin, data...)
401  {
402  }
403 
407  void begin() override
408  {
409  m_spi.begin();
411  }
412 
416  void end() override
417  {
419  m_spi.end();
420  }
421 
422 private:
423  InterfaceSSD1331<I> m_spi;
424 };
425 #include "lcd_ssd1331.inl"
426 
uint8_t lcduint_t
Definition: canvas_types.h:79
DisplaySSD1331x16(I &intf, int8_t rstPin)
Definition: lcd_ssd1331.h:299
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_ssd1331.h:306
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_SPI(int8_t rstPin, const SPlatformSpiConfig &config={-1, {-1}, -1, 0, -1, -1})
Inits 96x64x16 lcd display over spi (based on SSD1331 controller): 16-bit mode.
Definition: lcd_ssd1331.h:360
DisplaySSD1331_96x64x16(I &intf, int8_t rstPin)
Definition: lcd_ssd1331.h:331
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:161
DisplaySSD1331_96x64x8(I &intf, int8_t rstPin)
Definition: lcd_ssd1331.h:193
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:398
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_ssd1331.h:168
void setDataMode(uint8_t mode)
Definition: lcd_ssd1331.inl:59
DisplaySSD1331_96x64x8_SPI(int8_t rstPin, const SPlatformSpiConfig &config={-1, {-1}, -1, 0, -1, -1})
Inits 96x64x8 lcd display over spi (based on SSD1331 controller): 8-bit mode.
Definition: lcd_ssd1331.h:222
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:260