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 
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 
uint8_t lcduint_t
Definition: canvas_types.h:79
DisplaySSD1325_128x64(I &intf, int8_t rstPin)
Definition: lcd_ssd1325.h:157
DisplaySSD1325(I &intf, int8_t rstPin)
Definition: lcd_ssd1325.h:125
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: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
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_ssd1325.h:132
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 setContrast(uint8_t contrast)
Definition: lcd_ssd1325.inl:84