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_ssd1327.inl
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 !!! */
25 #include "lcd_hal/io.h"
26 #ifdef SDL_EMULATION
27 #include "sdl_core.h"
28 #endif
29 #include "nano_gfx_types.h"
30 
31 #ifndef CMD_ARG
32 #define CMD_ARG 0xFF
33 #endif
34 
36 {
37  lcduint_t rx = w ? (x + w - 1) : (m_base.width() - 1);
38  commandStart();
39  this->send(0x15);
40  this->send(x / 2);
41  this->send( (rx < m_base.width() ? rx : (m_base.width() - 1)) / 2 );
42  this->send(0x75);
43  this->send(y);
44  this->send(m_base.height() - 1);
45  if ( m_dc >= 0 )
46  {
47  setDataMode(1);
48  }
49  else
50  {
51  this->stop();
52  this->start();
53  this->send(0x40);
54  }
55 }
56 
57 template <class I> void InterfaceSSD1327<I>::nextBlock()
58 {
59 
60 }
61 
62 template <class I> void InterfaceSSD1327<I>::endBlock()
63 {
64  this->stop();
65 }
66 
67 template <class I> void InterfaceSSD1327<I>::setDataMode(uint8_t mode)
68 {
69  if ( m_dc >= 0 )
70  {
71  lcd_gpioWrite(m_dc, mode ? LCD_HIGH : LCD_LOW);
72  }
73 }
74 
75 template <class I> void InterfaceSSD1327<I>::commandStart()
76 {
77  this->start();
78  if ( m_dc >= 0 )
79  setDataMode(0);
80  else
81  this->send(0x00);
82 }
83 
84 
86 // SSD1327 basic 4-bit implementation
88 
89 template <class I> void DisplaySSD1327<I>::beginDisplay()
90 {
91 }
92 
93 template <class I> void DisplaySSD1327<I>::endDisplay()
94 {
95 }
96 
97 static const PROGMEM uint8_t s_SSD1327_lcd128x128_initData[] = {
98 #ifdef SDL_EMULATION
99  SDL_LCD_SSD1327, 0x00,
100  SDL_LCD_SSD1327_GENERIC, 0x00,
101 #endif
102  0xFD, 0x01, 0x12, // Unlock OLED
103  0xAE, 0x00, // OFF /* display off */
104  0xA8, 0x01, 0x7F, // multiplex 128
105  0xA1, 0x01, 0x00, // Start line
106  0xA2, 0x01, 0x00, // Display offset
107  0xA0, 0x01, 0x40 | 0x10 | (0x02 | 0x01), // REMAP: horizontal increment mode
108  0xAB, 0x01, 0x01, // VDD internal
109  0x81, 0x01, 0x70, // CONTRAST
110  0xB1, 0x01, 0x55, // PHASE 0x51
111  0xB3, 0x01, 0x01, // CLK
112 // 0xB9, //Reload grey scale
113  0xBC, 0x01, 0x08, // PRECHARGE
114  0xBE, 0x01, 0x07, // VCOMH voltage
115  0xB6, 0x01, 0x01, // Second pre-charge
116  0xA4, 0x00, // NORMAL
117  0x2E, 0x00, // Deactivate scroll
118  0xAF, 0x00, // Display ON
119 };
120 
122 // SSD1327 basic 4-bit implementation
124 
126 {
127  ssd1306_resetController2(this->m_rstPin, 10);
128  this->m_w = 128;
129  this->m_h = 128;
130  // Give LCD some time to initialize. Refer to SSD1327 datasheet
131  lcd_delay(0);
132  _configureSpiDisplayCmdModeOnly<I>(this->m_intf,
133  s_SSD1327_lcd128x128_initData,
134  sizeof(s_SSD1327_lcd128x128_initData));
135 
136 }
137 
139 {
140 }
uint8_t lcduint_t
Definition: canvas_types.h:79
void lcd_gpioWrite(int pin, int level)
void beginDisplay()
Definition: lcd_ssd1327.inl:89
void ssd1306_resetController2(int8_t rstPin, uint8_t delayMs)
Does hardware reset for oled controller.
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:35
#define LCD_LOW
Definition: io.h:175
void setDataMode(uint8_t mode)
Definition: lcd_ssd1327.inl:67
#define LCD_HIGH
Definition: io.h:177
void lcd_delay(unsigned long ms)