LCDGFX LCD display driver  1.2.0
Lightweight graphics library for SSD1306, SSD1325, SSD1327, SSD1331, SSD1351, SH1106, SH1107, IL9163, ST7735, ST7789, ILI9341, PCD8544 displays over I2C/SPI
lcd_ssd1325.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 InterfaceSSD1325: public I
44 {
45 public:
53  template <typename... Args>
54  InterfaceSSD1325(NanoDisplayBase<InterfaceSSD1325<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 
107  void setContrast(uint8_t contrast);
108 
109 private:
110  const int8_t m_dc = -1;
112 };
116 template <typename I> class DisplaySSD1325: public NanoDisplayOps<NanoDisplayOps4<I>, I>
117 {
118 public:
125  DisplaySSD1325(I &intf, int8_t rstPin)
126  : NanoDisplayOps<NanoDisplayOps4<I>, I>(intf)
127  , m_rstPin(rstPin)
128  {
129  }
130 
131 protected:
132  int8_t m_rstPin;
133 
137  void beginDisplay();
138 
142  void endDisplay();
143 };
144 
148 template <typename I> class DisplaySSD1325_128x64: public DisplaySSD1325<I>
149 {
150 public:
157  DisplaySSD1325_128x64(I &intf, int8_t rstPin)
158  : DisplaySSD1325<I>(intf, rstPin)
159  {
160  }
161 
162 protected:
166  void beginController();
167 
171  void endController();
172 };
173 #ifdef CONFIG_LCDGFX_PLATFORM_SPI
174 
177 class DisplaySSD1325_128x64_SPI: public DisplaySSD1325_128x64<InterfaceSSD1325<PlatformSpi>>
178 {
179 public:
187  explicit DisplaySSD1325_128x64_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0U, -1, -1})
188  : DisplaySSD1325_128x64(m_spi, rstPin)
189  , m_spi(*this, config.dc,
191  config.busId, {config.cs}, config.dc, config.frequency ?: static_cast<uint32_t>(10000000), config.scl, config.sda})
192  {
193  }
194 
198  void begin() override;
199 
203  void end() override;
204 
205 private:
207 };
208 #endif
209 
214 template <typename I> class DisplaySSD1325_128x64_CustomSPI: public DisplaySSD1325_128x64<InterfaceSSD1325<I>>
215 {
216 public:
225  template <typename... Args>
226  DisplaySSD1325_128x64_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
227  : DisplaySSD1325_128x64<InterfaceSSD1325<I>>(m_spi, rstPin)
228  , m_spi(*this, dcPin, data...)
229  {
230  }
231 
235  void begin() override
236  {
237  m_spi.begin();
238  DisplaySSD1325_128x64<InterfaceSSD1325<I>>::beginController();
239  }
240 
244  void end() override
245  {
247  m_spi.end();
248  }
249 
250 private:
251  InterfaceSSD1325<I> m_spi;
252 };
253 #ifdef CONFIG_LCDGFX_PLATFORM_I2C
254 
257 class DisplaySSD1325_128x64_I2C: public DisplaySSD1325_128x64<InterfaceSSD1325<PlatformI2c>>
258 {
259 public:
267  explicit DisplaySSD1325_128x64_I2C(int8_t rstPin, const SPlatformI2cConfig &config = {-1, 0x3C, -1, -1, 0U})
268  : DisplaySSD1325_128x64(m_i2c, rstPin)
269  , m_i2c(*this, -1,
270  SPlatformI2cConfig{config.busId, static_cast<uint8_t>(config.addr ?: 0x3C), config.scl, config.sda,
271  config.frequency ?: 400000U})
272  {
273  }
274 
278  void begin() override;
279 
283  void end() override;
284 
285 private:
287 };
288 #endif
289 
294 template <typename I> class DisplaySSD1325_128x64_CustomI2C: public DisplaySSD1325_128x64<InterfaceSSD1325<I>>
295 {
296 public:
304  template <typename... Args>
305  DisplaySSD1325_128x64_CustomI2C(int8_t rstPin, Args &&... data)
306  : DisplaySSD1325_128x64<InterfaceSSD1325<I>>(m_i2c, rstPin)
307  , m_i2c(*this, -1, data...)
308  {
309  }
310 
314  void begin() override
315  {
316  m_i2c.begin();
317  DisplaySSD1325_128x64<InterfaceSSD1325<I>>::beginController();
318  }
319 
323  void end() override
324  {
326  m_i2c.end();
327  }
328 
329 private:
330  InterfaceSSD1325<I> m_i2c;
331 };
332 #include "lcd_ssd1325.inl"
333 
Structure describes spi platform configuration.
Definition: interface.h:80
uint8_t lcduint_t
internal int type, used by the library.
Definition: canvas_types.h:79
NanoDisplayOps4 is template class for 4-bit monochrome operations.
Definition: display.h:300
global lcd settings
void end() override
Closes connection to display.
Definition: lcd_ssd1325.h:323
void endBlock()
Closes data send operation to lcd display.
Definition: lcd_ssd1325.inl:62
int8_t busId
bus id number.
Definition: interface.h:49
Structure describes i2c platform configuration.
Definition: interface.h:43
DisplaySSD1325_128x64(I &intf, int8_t rstPin)
Creates instance of SSD1325 128x64 controller class for 4-bit mode.
Definition: lcd_ssd1325.h:157
SSD1306 HAL IO communication functions.
DisplaySSD1325(I &intf, int8_t rstPin)
Creates instance of SSD1325 controller class for 4-bit mode.
Definition: lcd_ssd1325.h:125
Template class implements SSD1325 128x64 lcd display in 4 bit mode over custom SPI implementation (us...
Definition: lcd_ssd1325.h:214
void nextBlock()
Switches to the start of next RAM page for the block, specified by startBlock().
Definition: lcd_ssd1325.inl:57
int8_t dc
Data command control pin number.
Definition: interface.h:102
void setDataMode(uint8_t mode)
Enables either data or command mode on SPI bus.
Definition: lcd_ssd1325.inl:67
InterfaceSSD1325(NanoDisplayBase< InterfaceSSD1325< I >> &base, int8_t dc, Args &&... data)
Creates instance of interface to LCD display.
Definition: lcd_ssd1325.h:54
DisplaySSD1325_128x64_CustomI2C(int8_t rstPin, Args &&... data)
Inits 128x64 lcd display over i2c (based on SSD1325 controller): 4-bit mode.
Definition: lcd_ssd1325.h:305
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_ssd1325.inl:35
Template class implements SSD1325 128x64 lcd display in 4 bit mode over custom I2C implementation (us...
Definition: lcd_ssd1325.h:294
Class implements basic functions for 4-bit mode of SSD1325-based displays.
Definition: lcd_ssd1325.h:116
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_ssd1325.h:132
void end() override
Closes connection to display.
Definition: lcd_ssd1325.h:244
DisplaySSD1325_128x64_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
Inits 128x64 lcd display over spi (based on SSD1325 controller): 4-bit mode.
Definition: lcd_ssd1325.h:226
void commandStart()
Starts communication with LCD display in command mode.
Definition: lcd_ssd1325.inl:75
void begin() override
Initializes SSD1325 lcd in 4-bit mode.
Definition: lcd_ssd1325.h:314
void begin() override
Initializes SSD1325 lcd in 4-bit mode.
Definition: lcd_ssd1325.h:235
Class implements basic functions for 4-bit mode of SSD1325-based displays.
Definition: lcd_ssd1325.h:148
NanoCanvasOps provides operations for drawing in memory buffer.
Definition: display.h:978
Class implements basic display operations for the library: It stores reference to communication inter...
Definition: display_base.h:55
void setContrast(uint8_t contrast)
Set display contrast, ie light intensity.
Definition: lcd_ssd1325.inl:84
Class implements interface functions to SSD1325 displays.
Definition: lcd_ssd1325.h:43