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_any.h
Go to the documentation of this file.
1 /*
2  MIT License
3 
4  Copyright (c) 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 */
28 #pragma once
29 
30 #include "lcd_hal/io.h"
31 #include "v2/lcd/lcd_common.h"
32 #include "v2/lcd/base/display.h"
33 
43 {
44 public:
58  virtual void startBlock(lcduint_t x, lcduint_t y, lcduint_t w) = 0;
59 
64  virtual void nextBlock()
65  {
66  }
67 
71  virtual void endBlock() = 0;
72 
77  virtual void send(uint8_t data) = 0;
78 };
79 
84 {
85 public:
92  : m_intf(intf)
93  {
94  }
95 
110  {
111  m_intf.startBlock(x, y, w);
112  }
113 
118  void nextBlock()
119  {
120  m_intf.nextBlock();
121  }
122 
126  void endBlock()
127  {
128  m_intf.endBlock();
129  }
130 
135  void send(uint8_t data)
136  {
137  m_intf.send(data);
138  }
139 
140 private:
141  DisplayInterface &m_intf;
142 };
143 
147 class DisplayAny1: public NanoDisplayOps<NanoDisplayOps1<InterfaceAny>, InterfaceAny>, DisplayInterface
148 {
149 public:
159  DisplayAny1(lcduint_t width, lcduint_t height);
160 
164  void begin() override;
165 
169  void end() override;
170 
171 private:
172  InterfaceAny m_any;
173 };
174 
178 class DisplayAny4: public NanoDisplayOps<NanoDisplayOps4<InterfaceAny>, InterfaceAny>, DisplayInterface
179 {
180 public:
190  DisplayAny4(lcduint_t width, lcduint_t height);
191 
195  void begin() override;
196 
200  void end() override;
201 
202 private:
203  InterfaceAny m_any;
204 };
205 
209 class DisplayAny8: public NanoDisplayOps<NanoDisplayOps8<InterfaceAny>, InterfaceAny>, DisplayInterface
210 {
211 public:
221  DisplayAny8(lcduint_t width, lcduint_t height);
222 
226  void begin() override;
227 
231  void end() override;
232 
233 private:
234  InterfaceAny m_any;
235 };
236 
240 class DisplayAny16: public NanoDisplayOps<NanoDisplayOps16<InterfaceAny>, InterfaceAny>, DisplayInterface
241 {
242 public:
252  DisplayAny16(lcduint_t width, lcduint_t height);
253 
257  void begin() override;
258 
262  void end() override;
263 
264 private:
265  InterfaceAny m_any;
266 };
267 
InterfaceAny(DisplayInterface &intf)
Definition: lcd_any.h:91
uint8_t lcduint_t
Definition: canvas_types.h:79
virtual void send(uint8_t data)=0
virtual void startBlock(lcduint_t x, lcduint_t y, lcduint_t w)=0
Sets block in RAM of lcd display controller to write data to.
void nextBlock()
Definition: lcd_any.h:118
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_any.h:109
virtual void endBlock()=0
void endBlock()
Definition: lcd_any.h:126
virtual void nextBlock()
Definition: lcd_any.h:64
void send(uint8_t data)
Definition: lcd_any.h:135