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_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 
103 private:
104  const int8_t m_dc = -1;
106 };
110 template <typename I> class DisplaySSD1325: public NanoDisplayOps<NanoDisplayOps4<I>, I>
111 {
112 public:
119  DisplaySSD1325(I &intf, int8_t rstPin)
120  : NanoDisplayOps<NanoDisplayOps4<I>, I>(intf)
121  , m_rstPin(rstPin)
122  {
123  }
124 
125 protected:
126  int8_t m_rstPin;
127 
131  void beginDisplay();
132 
136  void endDisplay();
137 };
138 
142 template <typename I> class DisplaySSD1325_128x64: public DisplaySSD1325<I>
143 {
144 public:
151  DisplaySSD1325_128x64(I &intf, int8_t rstPin)
152  : DisplaySSD1325<I>(intf, rstPin)
153  {
154  }
155 
156 protected:
160  void beginController();
161 
165  void endController();
166 };
170 class DisplaySSD1325_128x64_SPI: public DisplaySSD1325_128x64<InterfaceSSD1325<PlatformSpi>>
171 {
172 public:
180  explicit DisplaySSD1325_128x64_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0, -1, -1})
181  : DisplaySSD1325_128x64(m_spi, rstPin)
182  , m_spi(*this, config.dc,
184  config.busId, {config.cs}, config.dc, config.frequency ?: 10000000, config.scl, config.sda})
185  {
186  }
187 
191  void begin() override;
192 
196  void end() override;
197 
198 private:
200 };
201 
206 template <typename I> class DisplaySSD1325_128x64_CustomSPI: public DisplaySSD1325_128x64<InterfaceSSD1325<I>>
207 {
208 public:
217  template <typename... Args>
218  DisplaySSD1325_128x64_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
219  : DisplaySSD1325_128x64<InterfaceSSD1325<I>>(m_spi, rstPin)
220  , m_spi(*this, dcPin, data...)
221  {
222  }
223 
227  void begin() override
228  {
229  m_spi.begin();
230  DisplaySSD1325_128x64<InterfaceSSD1325<I>>::beginController();
231  }
232 
236  void end() override
237  {
239  m_spi.end();
240  }
241 
242 private:
243  InterfaceSSD1325<I> m_spi;
244 };
248 class DisplaySSD1325_128x64_I2C: public DisplaySSD1325_128x64<InterfaceSSD1325<PlatformI2c>>
249 {
250 public:
258  explicit DisplaySSD1325_128x64_I2C(int8_t rstPin, const SPlatformI2cConfig &config = {-1, 0x3C, -1, -1, 0})
259  : DisplaySSD1325_128x64(m_i2c, rstPin)
260  , m_i2c(*this, -1,
261  SPlatformI2cConfig{config.busId, static_cast<uint8_t>(config.addr ?: 0x3C), config.scl, config.sda,
262  config.frequency ?: 400000})
263  {
264  }
265 
269  void begin() override;
270 
274  void end() override;
275 
276 private:
278 };
279 
284 template <typename I> class DisplaySSD1325_128x64_CustomI2C: public DisplaySSD1325_128x64<InterfaceSSD1325<I>>
285 {
286 public:
294  template <typename... Args>
295  DisplaySSD1325_128x64_CustomI2C(int8_t rstPin, Args &&... data)
296  : DisplaySSD1325_128x64<InterfaceSSD1325<I>>(m_i2c, rstPin)
297  , m_i2c(*this, -1, data...)
298  {
299  }
300 
304  void begin() override
305  {
306  m_i2c.begin();
307  DisplaySSD1325_128x64<InterfaceSSD1325<I>>::beginController();
308  }
309 
313  void end() override
314  {
316  m_i2c.end();
317  }
318 
319 private:
320  InterfaceSSD1325<I> m_i2c;
321 };
322 #include "lcd_ssd1325.inl"
323 
DisplaySSD1325_128x64_SPI(int8_t rstPin, const SPlatformSpiConfig &config={-1, {-1}, -1, 0, -1, -1})
Inits 128x64 lcd display over spi (based on SSD1325 controller): 4-bit mode.
Definition: lcd_ssd1325.h:180
uint8_t lcduint_t
Definition: canvas_types.h:79
DisplaySSD1325_128x64(I &intf, int8_t rstPin)
Definition: lcd_ssd1325.h:151
DisplaySSD1325(I &intf, int8_t rstPin)
Definition: lcd_ssd1325.h:119
void setDataMode(uint8_t mode)
Definition: lcd_ssd1325.inl:67
InterfaceSSD1325(NanoDisplayBase< InterfaceSSD1325< I >> &base, int8_t dc, Args &&... data)
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:295
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
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_ssd1325.h:126
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:218
DisplaySSD1325_128x64_I2C(int8_t rstPin, const SPlatformI2cConfig &config={-1, 0x3C, -1, -1, 0})
Inits 128x64 lcd display over i2c (based on SSD1325 controller): 4-bit mode.
Definition: lcd_ssd1325.h:258