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_pcd8544.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 InterfacePCD8544: public I
44 {
45 public:
53  template <typename... Args>
54  InterfacePCD8544(NanoDisplayBase<InterfacePCD8544<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  uint8_t m_width = 0;
107  uint8_t m_column = 0;
108  uint8_t m_page = 0;
109 };
113 template <typename I> class DisplayPCD8544: public NanoDisplayOps<NanoDisplayOps1<I>, I>
114 {
115 public:
122  DisplayPCD8544(I &intf, int8_t rstPin)
123  : NanoDisplayOps<NanoDisplayOps1<I>, I>(intf)
124  , m_rstPin(rstPin)
125  {
126  }
127 
128 protected:
129  int8_t m_rstPin;
130 
134  void beginDisplay();
135 
139  void endDisplay();
140 };
141 
145 template <typename I> class DisplayPCD8544_84x48: public DisplayPCD8544<I>
146 {
147 public:
154  DisplayPCD8544_84x48(I &intf, int8_t rstPin)
155  : DisplayPCD8544<I>(intf, rstPin)
156  {
157  }
158 
159 protected:
163  void beginController();
164 
168  void endController();
169 };
173 class DisplayPCD8544_84x48_SPI: public DisplayPCD8544_84x48<InterfacePCD8544<PlatformSpi>>
174 {
175 public:
183  explicit DisplayPCD8544_84x48_SPI(int8_t rstPin, const SPlatformSpiConfig &config = {-1, {-1}, -1, 0, -1, -1})
184  : DisplayPCD8544_84x48(m_spi, rstPin)
185  , m_spi(*this, config.dc,
187  config.busId, {config.cs}, config.dc, config.frequency ?: 4000000, config.scl, config.sda})
188  {
189  }
190 
194  void begin() override;
195 
199  void end() override;
200 
201 private:
203 };
204 
209 template <typename I> class DisplayPCD8544_84x48_CustomSPI: public DisplayPCD8544_84x48<InterfacePCD8544<I>>
210 {
211 public:
220  template <typename... Args>
221  DisplayPCD8544_84x48_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
222  : DisplayPCD8544_84x48<InterfacePCD8544<I>>(m_spi, rstPin)
223  , m_spi(*this, dcPin, data...)
224  {
225  }
226 
230  void begin() override
231  {
232  m_spi.begin();
233  DisplayPCD8544_84x48<InterfacePCD8544<I>>::beginController();
234  }
235 
239  void end() override
240  {
242  m_spi.end();
243  }
244 
245 private:
246  InterfacePCD8544<I> m_spi;
247 };
248 #include "lcd_pcd8544.inl"
249 
DisplayPCD8544_84x48(I &intf, int8_t rstPin)
Definition: lcd_pcd8544.h:154
uint8_t lcduint_t
Definition: canvas_types.h:79
DisplayPCD8544(I &intf, int8_t rstPin)
Definition: lcd_pcd8544.h:122
void setDataMode(uint8_t mode)
Definition: lcd_pcd8544.inl:65
DisplayPCD8544_84x48_CustomSPI(int8_t rstPin, int8_t dcPin, Args &&... data)
Inits 84x48 lcd display over spi (based on PCD8544 controller): 1-bit mode.
Definition: lcd_pcd8544.h:221
InterfacePCD8544(NanoDisplayBase< InterfacePCD8544< I >> &base, int8_t dc, Args &&... data)
Definition: lcd_pcd8544.h:54
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_pcd8544.h:129
DisplayPCD8544_84x48_SPI(int8_t rstPin, const SPlatformSpiConfig &config={-1, {-1}, -1, 0, -1, -1})
Inits 84x48 lcd display over spi (based on PCD8544 controller): 1-bit mode.
Definition: lcd_pcd8544.h:183
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_pcd8544.inl:35