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