LCDGFX LCD display driver  1.0.2
This library is developed to control SSD1306/SSD1325/SSD1327/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
lcd_ssd1327.h
Go to the documentation of this file.
1 /*
2  MIT License
3 
4  Copyright (c) 2019-2020, 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 InterfaceSSD1327: public I
45 {
46 public:
54  template <typename... Args>
55  InterfaceSSD1327(NanoDisplayBase<InterfaceSSD1327<I>> &base, int8_t dc, Args&&... data)
56  : I(data...)
57  , m_dc( dc )
58  , m_base(base)
59  {
60  }
61 
78 
85  void nextBlock();
86 
90  void endBlock();
91 
96  void spiDataMode(uint8_t mode);
97 
102  void commandStart();
103 
104 private:
105  const int8_t m_dc = -1;
107 };
108 
109 
113 template <class I>
114 class DisplaySSD1327: public NanoDisplayOps<NanoDisplayOps4<I>,I>
115 {
116 public:
123  DisplaySSD1327(I &intf, int8_t rstPin)
124  : NanoDisplayOps<NanoDisplayOps4<I>, I>(intf)
125  , m_rstPin( rstPin ) { }
126 
127 protected:
128  int8_t m_rstPin;
129 
133  void begin() override;
134 
138  void end() override;
139 };
140 
144 template <class I>
146 {
147 public:
154  DisplaySSD1327_128x128(I &intf, int8_t rstPin)
155  : DisplaySSD1327<I>(intf, rstPin) { }
156 
157 protected:
158 
162  void begin() override;
163 
167  void end() override;
168 };
169 
173 class DisplaySSD1327_128x128_SPI: public DisplaySSD1327_128x128<InterfaceSSD1327<PlatformSpi>>
174 {
175 public:
183  DisplaySSD1327_128x128_SPI( int8_t rstPin, const SPlatformSpiConfig &config = { -1, { -1 }, -1, 0, -1, -1 } )
184  : DisplaySSD1327_128x128(m_spi, rstPin)
185  , m_spi( *this, config.dc,
186  SPlatformSpiConfig{ config.busId,
187  { config.cs },
188  config.dc,
189  config.frequency ?: 10000000,
190  config.scl,
191  config.sda } ) {}
192 
196  void begin() override;
197 
201  void end() override;
202 
203 private:
205 };
206 
211 template <class I>
213 {
214 public:
223  template <typename... Args>
224  DisplaySSD1327_128x128_CustomSPI( int8_t rstPin, int8_t dcPin, Args&&... data )
225  : DisplaySSD1327_128x128<InterfaceSSD1327<I>>(m_spi, rstPin)
226  , m_spi( *this, dcPin,
227  data... ) {}
228 
232  void begin() override
233  {
234  m_spi.begin();
236  }
237 
241  void end() override
242  {
244  m_spi.end();
245  }
246 
247 private:
248  InterfaceSSD1327<I> m_spi;
249 };
253 class DisplaySSD1327_128x128_I2C: public DisplaySSD1327_128x128<InterfaceSSD1327<PlatformI2c>>
254 {
255 public:
263  DisplaySSD1327_128x128_I2C( int8_t rstPin, const SPlatformI2cConfig &config = { -1, 0x3C, -1, -1, 0 } )
264  : DisplaySSD1327_128x128(m_i2c, rstPin)
265  , m_i2c( *this, -1,
266  SPlatformI2cConfig{ config.busId,
267  static_cast<uint8_t>(config.addr ?: 0x3C),
268  config.scl,
269  config.sda,
270  config.frequency ?: 400000 } ) {}
271 
275  void begin() override;
276 
280  void end() override;
281 
282 private:
284 };
285 
290 template <class I>
292 {
293 public:
301  template <typename... Args>
302  DisplaySSD1327_128x128_CustomI2C( int8_t rstPin, Args&&... data )
303  : DisplaySSD1327_128x128<InterfaceSSD1327<I>>(m_i2c, rstPin)
304  , m_i2c( *this, -1,
305  data... ) {}
306 
310  void begin() override
311  {
312  m_i2c.begin();
314  }
315 
319  void end() override
320  {
322  m_i2c.end();
323  }
324 
325 private:
326  InterfaceSSD1327<I> m_i2c;
327 };
328 
329 
330 #include "lcd_ssd1327.inl"
331 
uint8_t lcduint_t
Definition: canvas_types.h:81
InterfaceSSD1327(NanoDisplayBase< InterfaceSSD1327< I >> &base, int8_t dc, Args &&... data)
Definition: lcd_ssd1327.h:55
DisplaySSD1327_128x128_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
Inits 128x128 lcd display over spi (based on SSD1327 controller): 4-bit mode.
Definition: lcd_ssd1327.h:224
DisplaySSD1327_128x128(I &intf, int8_t rstPin)
Definition: lcd_ssd1327.h:154
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_ssd1327.inl:36
void spiDataMode(uint8_t mode)
Definition: lcd_ssd1327.inl:71
DisplaySSD1327(I &intf, int8_t rstPin)
Definition: lcd_ssd1327.h:123
DisplaySSD1327_128x128_CustomI2C(int8_t rstPin, Args &&... data)
Inits 128x128 lcd display over i2c (based on SSD1327 controller): 4-bit mode.
Definition: lcd_ssd1327.h:302
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_ssd1327.h:128
DisplaySSD1327_128x128_SPI(int8_t rstPin, const SPlatformSpiConfig &config={ -1, { -1 }, -1, 0, -1, -1 })
Inits 128x128 lcd display over spi (based on SSD1327 controller): 4-bit mode.
Definition: lcd_ssd1327.h:183
DisplaySSD1327_128x128_I2C(int8_t rstPin, const SPlatformI2cConfig &config={ -1, 0x3C, -1, -1, 0 })
Inits 128x128 lcd display over i2c (based on SSD1327 controller): 4-bit mode.
Definition: lcd_ssd1327.h:263