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_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 
109  void setRotation(uint8_t rotation);
110 
121  void setOffset(lcdint_t ox, lcdint_t oy);
122 
129  void setRgbMode(uint8_t mode);
130 
136  void setContrast(uint8_t contrast);
137 
138 private:
139  const int8_t m_dc = -1;
141  uint8_t m_rotation = 0x00;
142  uint8_t m_rgbMode = 0x04;
143  lcdint_t m_offset_x = 0x00;
144  lcdint_t m_offset_y = 0x00;
145 };
149 template <typename I> class DisplaySSD1351x16: public NanoDisplayOps<NanoDisplayOps16<I>, I>
150 {
151 public:
158  DisplaySSD1351x16(I &intf, int8_t rstPin)
159  : NanoDisplayOps<NanoDisplayOps16<I>, I>(intf)
160  , m_rstPin(rstPin)
161  {
162  }
163 
164 protected:
165  int8_t m_rstPin;
166 
170  void beginDisplay();
171 
175  void endDisplay();
176 };
177 
181 template <typename I> class DisplaySSD1351_128x128x16: public DisplaySSD1351x16<I>
182 {
183 public:
190  DisplaySSD1351_128x128x16(I &intf, int8_t rstPin)
191  : DisplaySSD1351x16<I>(intf, rstPin)
192  {
193  }
194 
195 protected:
199  void beginController();
200 
204  void endController();
205 };
206 #ifdef CONFIG_LCDGFX_PLATFORM_SPI
207 
210 class DisplaySSD1351_128x128x16_SPI: public DisplaySSD1351_128x128x16<InterfaceSSD1351<PlatformSpi>>
211 {
212 public:
220  explicit DisplaySSD1351_128x128x16_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0U, -1, -1})
221  : DisplaySSD1351_128x128x16(m_spi, rstPin)
222  , m_spi(*this, config.dc,
224  config.busId, {config.cs}, config.dc, config.frequency ?: static_cast<uint32_t>(4400000), config.scl, config.sda})
225  {
226  }
227 
231  void begin() override;
232 
236  void end() override;
237 
238 private:
240 };
241 #endif
242 
247 template <typename I> class DisplaySSD1351_128x128x16_CustomSPI: public DisplaySSD1351_128x128x16<InterfaceSSD1351<I>>
248 {
249 public:
258  template <typename... Args>
259  DisplaySSD1351_128x128x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
260  : DisplaySSD1351_128x128x16<InterfaceSSD1351<I>>(m_spi, rstPin)
261  , m_spi(*this, dcPin, data...)
262  {
263  }
264 
268  void begin() override
269  {
270  m_spi.begin();
272  }
273 
277  void end() override
278  {
280  m_spi.end();
281  }
282 
283 private:
284  InterfaceSSD1351<I> m_spi;
285 };
289 template <typename I> class DisplaySSD1351_96x96x16: public DisplaySSD1351x16<I>
290 {
291 public:
298  DisplaySSD1351_96x96x16(I &intf, int8_t rstPin)
299  : DisplaySSD1351x16<I>(intf, rstPin)
300  {
301  }
302 
303 protected:
307  void beginController();
308 
312  void endController();
313 };
314 #ifdef CONFIG_LCDGFX_PLATFORM_SPI
315 
318 class DisplaySSD1351_96x96x16_SPI: public DisplaySSD1351_96x96x16<InterfaceSSD1351<PlatformSpi>>
319 {
320 public:
328  explicit DisplaySSD1351_96x96x16_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0U, -1, -1})
329  : DisplaySSD1351_96x96x16(m_spi, rstPin)
330  , m_spi(*this, config.dc,
332  config.busId, {config.cs}, config.dc, config.frequency ?: static_cast<uint32_t>(4400000), config.scl, config.sda})
333  {
334  }
335 
339  void begin() override;
340 
344  void end() override;
345 
346 private:
348 };
349 #endif
350 
355 template <typename I> class DisplaySSD1351_96x96x16_CustomSPI: public DisplaySSD1351_96x96x16<InterfaceSSD1351<I>>
356 {
357 public:
366  template <typename... Args>
367  DisplaySSD1351_96x96x16_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
368  : DisplaySSD1351_96x96x16<InterfaceSSD1351<I>>(m_spi, rstPin)
369  , m_spi(*this, dcPin, data...)
370  {
371  }
372 
376  void begin() override
377  {
378  m_spi.begin();
380  }
381 
385  void end() override
386  {
388  m_spi.end();
389  }
390 
391 private:
392  InterfaceSSD1351<I> m_spi;
393 };
394 #include "lcd_ssd1351.inl"
395 
void setRotation(uint8_t rotation)
Sets screen orientation (rotation)
Definition: lcd_ssd1351.inl:89
void setRgbMode(uint8_t mode)
Sets RGB mode used by dispay controller.
uint8_t lcduint_t
Definition: canvas_types.h:79
InterfaceSSD1351(NanoDisplayBase< InterfaceSSD1351< I >> &base, int8_t dc, Args &&... data)
Definition: lcd_ssd1351.h:54
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:367
int8_t lcdint_t
Definition: canvas_types.h:77
DisplaySSD1351x16(I &intf, int8_t rstPin)
Definition: lcd_ssd1351.h:158
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:259
DisplaySSD1351_128x128x16(I &intf, int8_t rstPin)
Definition: lcd_ssd1351.h:190
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_ssd1351.h:165
DisplaySSD1351_96x96x16(I &intf, int8_t rstPin)
Definition: lcd_ssd1351.h:298
void setDataMode(uint8_t mode)
Definition: lcd_ssd1351.inl:72
void setContrast(uint8_t contrast)
void setOffset(lcdint_t ox, lcdint_t oy)
Sets display offset in GDRAM memory.