LCDGFX LCD display driver  2.0.1
This library is developed to control SSD1306/SSD1325/SSD1327/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
lcd_st7735.h
Go to the documentation of this file.
1 /*
2  MIT License
3 
4  Copyright (c) 2019, 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 InterfaceST7735: public I
45 {
46 public:
54  template <typename... Args>
55  InterfaceST7735(NanoDisplayBase<InterfaceST7735<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 
110  void setRotation(uint8_t rotation);
111 
112 private:
113  const int8_t m_dc = -1;
115 
116  uint8_t m_rotation = 0x00;
117  static const uint8_t m_rgb_bit = 0b00000000;
118 };
119 
120 
124 template <class I>
125 class DisplayST7735x16: public NanoDisplayOps<NanoDisplayOps16<I>,I>
126 {
127 public:
134  DisplayST7735x16(I &intf, int8_t rstPin)
135  : NanoDisplayOps<NanoDisplayOps16<I>, I>(intf)
136  , m_rstPin( rstPin ) { }
137 
138 protected:
139  int8_t m_rstPin;
140 
144  void begin() override;
145 
149  void end() override;
150 };
151 
155 template <class I>
157 {
158 public:
165  DisplayST7735_128x128x16(I &intf, int8_t rstPin)
166  : DisplayST7735x16<I>(intf, rstPin) { }
167 
168 protected:
169 
173  void begin() override;
174 
178  void end() override;
179 };
180 
184 class DisplayST7735_128x128x16_SPI: public DisplayST7735_128x128x16<InterfaceST7735<PlatformSpi>>
185 {
186 public:
194  DisplayST7735_128x128x16_SPI( int8_t rstPin, const SPlatformSpiConfig &config = { -1, { -1 }, -1, 0, -1, -1 } )
195  : DisplayST7735_128x128x16(m_spi, rstPin)
196  , m_spi( *this, config.dc,
197  SPlatformSpiConfig{ config.busId,
198  { config.cs },
199  config.dc,
200  config.frequency ?: 8000000,
201  config.scl,
202  config.sda } ) {}
203 
207  void begin() override;
208 
212  void end() override;
213 
214 private:
216 };
217 
221 template <class I>
223 {
224 public:
231  DisplayST7735_128x160x16(I &intf, int8_t rstPin)
232  : DisplayST7735x16<I>(intf, rstPin) { }
233 
234 protected:
235 
239  void begin() override;
240 
244  void end() override;
245 };
246 
250 class DisplayST7735_128x160x16_SPI: public DisplayST7735_128x160x16<InterfaceST7735<PlatformSpi>>
251 {
252 public:
260  DisplayST7735_128x160x16_SPI( int8_t rstPin, const SPlatformSpiConfig &config = { -1, { -1 }, -1, 0, -1, -1 } )
261  : DisplayST7735_128x160x16(m_spi, rstPin)
262  , m_spi( *this, config.dc,
263  SPlatformSpiConfig{ config.busId,
264  { config.cs },
265  config.dc,
266  config.frequency ?: 8000000,
267  config.scl,
268  config.sda } ) {}
269 
273  void begin() override;
274 
278  void end() override;
279 
280 private:
282 };
283 
284 #include "lcd_st7735.inl"
285 
uint8_t lcduint_t
Definition: canvas_types.h:81
DisplayST7735_128x160x16_SPI(int8_t rstPin, const SPlatformSpiConfig &config={ -1, { -1 }, -1, 0, -1, -1 })
Inits 128x160x16 lcd display over spi (based on ST7735 controller): 16-bit mode.
Definition: lcd_st7735.h:260
int8_t m_rstPin
indicates hardware reset pin used, -1 if it is not required
Definition: lcd_st7735.h:139
DisplayST7735_128x160x16(I &intf, int8_t rstPin)
Definition: lcd_st7735.h:231
void commandStart()
Definition: lcd_st7735.inl:89
void setRotation(uint8_t rotation)
Sets screen orientation (rotation)
Definition: lcd_st7735.inl:99
DisplayST7735_128x128x16_SPI(int8_t rstPin, const SPlatformSpiConfig &config={ -1, { -1 }, -1, 0, -1, -1 })
Inits 128x128x16 lcd display over spi (based on ST7735 controller): 16-bit mode.
Definition: lcd_st7735.h:194
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_st7735.inl:36
InterfaceST7735(NanoDisplayBase< InterfaceST7735< I >> &base, int8_t dc, Args &&... data)
Definition: lcd_st7735.h:55
DisplayST7735_128x128x16(I &intf, int8_t rstPin)
Definition: lcd_st7735.h:165
DisplayST7735x16(I &intf, int8_t rstPin)
Definition: lcd_st7735.h:134
void spiDataMode(uint8_t mode)
Definition: lcd_st7735.inl:80