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_ssd1331.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 InterfaceSSD1331: public I
45 {
46 public:
55  template <typename... Args>
56  InterfaceSSD1331(uint8_t bits, NanoDisplayBase<InterfaceSSD1331<I>> &base, int8_t dc, Args&&... data)
57  : I(data...)
58  , m_bits( bits )
59  , m_dc( dc )
60  , m_base(base)
61  {
62  }
63 
80 
87  void nextBlock();
88 
92  void endBlock();
93 
98  void setDataMode(uint8_t mode);
99 
104  void commandStart();
105 
112  void setRotation(uint8_t rotation);
113 
123  void drawLine(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2, uint16_t color);
124 
142  void copyBlock(uint8_t left, uint8_t top, uint8_t right, uint8_t bottom, uint8_t newLeft, uint8_t newTop);
143 
144 private:
145  const uint8_t m_bits;
146  const int8_t m_dc = -1;
148 
149  uint8_t m_rotation = 0x00;
150 };
151 
152 
156 template <class I>
157 class DisplaySSD1331x8: public NanoDisplayOps<NanoDisplayOps8<I>,I>
158 {
159 public:
166  DisplaySSD1331x8(I &intf, int8_t rstPin)
167  : NanoDisplayOps<NanoDisplayOps8<I>, I>(intf)
168  , m_rstPin( rstPin ) { }
169 
170 protected:
171  int8_t m_rstPin;
172 
176  void begin() override;
177 
181  void end() override;
182 };
183 
187 template <class I>
189 {
190 public:
197  DisplaySSD1331_96x64x8(I &intf, int8_t rstPin)
198  : DisplaySSD1331x8<I>(intf, rstPin) { }
199 
200 protected:
201 
205  void begin() override;
206 
210  void end() override;
211 };
212 
216 class DisplaySSD1331_96x64x8_SPI: public DisplaySSD1331_96x64x8<InterfaceSSD1331<PlatformSpi>>
217 {
218 public:
226  DisplaySSD1331_96x64x8_SPI( int8_t rstPin, const SPlatformSpiConfig &config = { -1, { -1 }, -1, 0, -1, -1 } )
227  : DisplaySSD1331_96x64x8(m_spi, rstPin)
228  , m_spi( 8, *this, config.dc,
229  SPlatformSpiConfig{ config.busId,
230  { config.cs },
231  config.dc,
232  config.frequency ?: 6000000,
233  config.scl,
234  config.sda } ) {}
235 
239  void begin() override;
240 
244  void end() override;
245 
246 private:
248 };
249 
254 template <class I>
256 {
257 public:
266  template <typename... Args>
267  DisplaySSD1331_96x64x8_CustomSPI( int8_t rstPin, int8_t dcPin, Args&&... data )
268  : DisplaySSD1331_96x64x8<InterfaceSSD1331<I>>(m_spi, rstPin)
269  , m_spi( 8, *this, dcPin,
270  data... ) {}
271 
275  void begin() override
276  {
277  m_spi.begin();
279  }
280 
284  void end() override
285  {
287  m_spi.end();
288  }
289 
290 private:
291  InterfaceSSD1331<I> m_spi;
292 };
293 
297 template <class I>
298 class DisplaySSD1331x16: public NanoDisplayOps<NanoDisplayOps16<I>,I>
299 {
300 public:
307  DisplaySSD1331x16(I &intf, int8_t rstPin)
308  : NanoDisplayOps<NanoDisplayOps16<I>, I>(intf)
309  , m_rstPin( rstPin ) { }
310 
311 protected:
312  int8_t m_rstPin;
313 
317  void begin() override;
318 
322  void end() override;
323 };
324 
328 template <class I>
330 {
331 public:
338  DisplaySSD1331_96x64x16(I &intf, int8_t rstPin)
339  : DisplaySSD1331x16<I>(intf, rstPin) { }
340 
341 protected:
342 
346  void begin() override;
347 
351  void end() override;
352 };
353 
357 class DisplaySSD1331_96x64x16_SPI: public DisplaySSD1331_96x64x16<InterfaceSSD1331<PlatformSpi>>
358 {
359 public:
367  DisplaySSD1331_96x64x16_SPI( int8_t rstPin, const SPlatformSpiConfig &config = { -1, { -1 }, -1, 0, -1, -1 } )
368  : DisplaySSD1331_96x64x16(m_spi, rstPin)
369  , m_spi( 16, *this, config.dc,
370  SPlatformSpiConfig{ config.busId,
371  { config.cs },
372  config.dc,
373  config.frequency ?: 6000000,
374  config.scl,
375  config.sda } ) {}
376 
380  void begin() override;
381 
385  void end() override;
386 
387 private:
389 };
390 
395 template <class I>
397 {
398 public:
407  template <typename... Args>
408  DisplaySSD1331_96x64x16_CustomSPI( int8_t rstPin, int8_t dcPin, Args&&... data )
409  : DisplaySSD1331_96x64x16<InterfaceSSD1331<I>>(m_spi, rstPin)
410  , m_spi( 16, *this, dcPin,
411  data... ) {}
412 
416  void begin() override
417  {
418  m_spi.begin();
420  }
421 
425  void end() override
426  {
428  m_spi.end();
429  }
430 
431 private:
432  InterfaceSSD1331<I> m_spi;
433 };
434 #include "lcd_ssd1331.inl"
435 
uint8_t lcduint_t
Definition: canvas_types.h:81
DisplaySSD1331x16(I &intf, int8_t rstPin)
Definition: lcd_ssd1331.h:307
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_ssd1331.h:312
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:79
InterfaceSSD1331(uint8_t bits, NanoDisplayBase< InterfaceSSD1331< I >> &base, int8_t dc, Args &&... data)
Definition: lcd_ssd1331.h:56
DisplaySSD1331_96x64x16(I &intf, int8_t rstPin)
Definition: lcd_ssd1331.h:338
void setRotation(uint8_t rotation)
Sets screen orientation (rotation)
Definition: lcd_ssd1331.inl:82
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:36
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:226
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:166
DisplaySSD1331_96x64x8(I &intf, int8_t rstPin)
Definition: lcd_ssd1331.h:197
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:408
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_ssd1331.h:171
void setDataMode(uint8_t mode)
Definition: lcd_ssd1331.inl:63
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:267
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:367