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 template <class I> void InterfaceSSD1327<I>::setContrast(uint8_t contrast)
85 {
86  commandStart();
87  this->send(0x81); // set contrast
88  this->send(contrast);
89  this->stop();
90 }
91 
92 
94 // SSD1327 basic 4-bit implementation
96 
97 template <class I> void DisplaySSD1327<I>::beginDisplay()
98 {
99 }
100 
101 template <class I> void DisplaySSD1327<I>::endDisplay()
102 {
103 }
104 
105 static const PROGMEM uint8_t s_SSD1327_lcd128x128_initData[] = {
106 #ifdef SDL_EMULATION
107  SDL_LCD_SSD1327, 0x00,
108  SDL_LCD_SSD1327_GENERIC, 0x00,
109 #endif
110  0xFD, 0x01, 0x12, // Unlock OLED
111  0xAE, 0x00, // OFF /* display off */
112  0xA8, 0x01, 0x7F, // multiplex 128
113  0xA1, 0x01, 0x00, // Start line
114  0xA2, 0x01, 0x00, // Display offset
115  0xA0, 0x01, 0x40 | 0x10 | (0x02 | 0x01), // REMAP: horizontal increment mode
116  0xAB, 0x01, 0x01, // VDD internal
117  0x81, 0x01, 0x70, // CONTRAST
118  0xB1, 0x01, 0x55, // PHASE 0x51
119  0xB3, 0x01, 0x01, // CLK
120 // 0xB9, //Reload grey scale
121  0xBC, 0x01, 0x08, // PRECHARGE
122  0xBE, 0x01, 0x07, // VCOMH voltage
123  0xB6, 0x01, 0x01, // Second pre-charge
124  0xA4, 0x00, // NORMAL
125  0x2E, 0x00, // Deactivate scroll
126  0xAF, 0x00, // Display ON
127 };
128 
130 // SSD1327 basic 4-bit implementation
132 
134 {
135  ssd1306_resetController2(this->m_rstPin, 10);
136  this->m_w = 128;
137  this->m_h = 128;
138  // Give LCD some time to initialize. Refer to SSD1327 datasheet
139  lcd_delay(0);
140  _configureSpiDisplayCmdModeOnly<I>(this->m_intf,
141  s_SSD1327_lcd128x128_initData,
142  sizeof(s_SSD1327_lcd128x128_initData));
143 
144 }
145 
147 {
148 }
uint8_t lcduint_t
Definition: canvas_types.h:79
void lcd_gpioWrite(int pin, int level)
void beginDisplay()
Definition: lcd_ssd1327.inl:97
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
void setContrast(uint8_t contrast)
Definition: lcd_ssd1327.inl:84
#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)