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_pcd8544.inl
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 !!! */
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 
35 template <class I>
37 {
38  m_width = w;
39  m_column = x;
40  m_page = y;
41  this->start();
42  spiDataMode(0);
43  if (w == 1) this->send( 0x22 ); else this->send( 0x20 );
44  this->send(0x80 | x);
45  this->send(0x40 | y);
46  spiDataMode(1);
47 }
48 
49 template <class I>
51 {
52  if ( m_width != 1)
53  {
54  this->stop();
55  startBlock(m_column, m_page+1, m_width);
56  }
57 }
58 
59 template <class I>
61 {
62  spiDataMode(0);
63  this->send( 0x00 ); // Send NOP command to allow last data byte to pass (bug in PCD8544?)
64  // ssd1306 E3h is NOP command
65  this->stop();
66 }
67 
68 template <class I>
70 {
71  if ( m_dc >= 0 )
72  {
73  lcd_gpioWrite( m_dc, mode ? LCD_HIGH : LCD_LOW );
74  }
75 }
76 
77 template <class I>
79 {
80  this->start();
81  if (m_dc >= 0)
82  spiDataMode(0);
83  else
84  this->send(0x00);
85 }
86 
87 
89 // PCD8544 basic 1-bit implementation
91 
92 template <class I>
94 {
95 }
96 
97 template <class I>
99 {
100 }
101 
102 static const PROGMEM uint8_t s_PCD8544_lcd84x48_initData[] =
103 {
104 #ifdef SDL_EMULATION
105  SDL_LCD_PCD8544, 0x00,
106  0x00, 0x00,
107 #endif
108  0x20 | 0x01, 0x00, // switch to extented commands
109  0x80 | 0x16, 0x00, // Set vop contrast
110  0x04, 0x00, // set temp
111  0x10 | 0x04, 0x00, // Set bias mode
112  0x20, 0x00, // switch to basic commands
113  0x08 | 0x04, 0x00, // Normal display
114 };
115 
117 // PCD8544 basic 1-bit implementation
119 
120 template <class I>
122 {
123  ssd1306_resetController2( this->m_rstPin, 20 );
124  this->m_w = 84;
125  this->m_h = 48;
126  // Give LCD some time to initialize. Refer to PCD8544 datasheet
127  lcd_delay(0);
128  _configureSpiDisplayCmdModeOnly<I>(this->m_intf,
129  s_PCD8544_lcd84x48_initData,
130  sizeof(s_PCD8544_lcd84x48_initData));
131 }
132 
133 template <class I>
135 {
136 }
uint8_t lcduint_t
Definition: canvas_types.h:81
void lcd_gpioWrite(int pin, int level)
void end() override
void ssd1306_resetController2(int8_t rstPin, uint8_t delayMs)
Does hardware reset for oled controller.
void end() override
Definition: lcd_pcd8544.inl:98
void begin() override
Definition: lcd_pcd8544.inl:93
void begin() override
#define LCD_LOW
Definition: io.h:140
void spiDataMode(uint8_t mode)
Definition: lcd_pcd8544.inl:69
#define LCD_HIGH
Definition: io.h:142
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:36
void lcd_delay(unsigned long ms)