LCDGFX LCD display driver  2.0.1
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, 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 spiDataMode(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 
250 
254 template <class I>
255 class DisplaySSD1331x16: public NanoDisplayOps<NanoDisplayOps16<I>,I>
256 {
257 public:
264  DisplaySSD1331x16(I &intf, int8_t rstPin)
265  : NanoDisplayOps<NanoDisplayOps16<I>, I>(intf)
266  , m_rstPin( rstPin ) { }
267 
268 protected:
269  int8_t m_rstPin;
270 
274  void begin() override;
275 
279  void end() override;
280 };
281 
285 template <class I>
287 {
288 public:
295  DisplaySSD1331_96x64x16(I &intf, int8_t rstPin)
296  : DisplaySSD1331x16<I>(intf, rstPin) { }
297 
298 protected:
299 
303  void begin() override;
304 
308  void end() override;
309 };
310 
314 class DisplaySSD1331_96x64x16_SPI: public DisplaySSD1331_96x64x16<InterfaceSSD1331<PlatformSpi>>
315 {
316 public:
324  DisplaySSD1331_96x64x16_SPI( int8_t rstPin, const SPlatformSpiConfig &config = { -1, { -1 }, -1, 0, -1, -1 } )
325  : DisplaySSD1331_96x64x16(m_spi, rstPin)
326  , m_spi( 16, *this, config.dc,
327  SPlatformSpiConfig{ config.busId,
328  { config.cs },
329  config.dc,
330  config.frequency ?: 6000000,
331  config.scl,
332  config.sda } ) {}
333 
337  void begin() override;
338 
342  void end() override;
343 
344 private:
346 };
347 
348 #include "lcd_ssd1331.inl"
349 
uint8_t lcduint_t
Definition: canvas_types.h:81
DisplaySSD1331x16(I &intf, int8_t rstPin)
Definition: lcd_ssd1331.h:264
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_ssd1331.h:269
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:295
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
void spiDataMode(uint8_t mode)
Definition: lcd_ssd1331.inl:63
DisplaySSD1331_96x64x8(I &intf, int8_t rstPin)
Definition: lcd_ssd1331.h:197
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_ssd1331.h:171
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:324