SSD1306 I2C Display Driver  1.2.2
This library is developed to control SSD1306 I2C OLED Display
pcd8544_84x48.c
1 /*
2  Copyright (C) 2017 Alexey Dynda
3 
4  This file is part of SSD1306 library.
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "pcd8544_84x48.h"
21 #include "lcd_common.h"
22 #include "intf/pcd8544_commands.h"
23 #include "intf/ssd1306_interface.h"
24 #include "spi/ssd1306_spi.h"
25 
26 static const uint8_t PROGMEM s_lcd84x48_initData[] =
27 {
28  PCD8544_FUNCTIONSET | PCD8544_EXTENDEDINSTRUCTION, // switch to extented commands
29  PCD8544_SETVOP | 0x12, // Set vop contrast
30  PCD8544_SETTEMP,
31  PCD8544_SETBIAS | 0x04, // Set bias mode
32  PCD8544_FUNCTIONSET, // switch to basic commands
33  PCD8544_DISPLAYCONTROL | PCD8544_DISPLAYNORMAL
34 };
35 
36 void pcd8544_84x48_spi_init(int8_t rstPin, int8_t cesPin, int8_t dcPin)
37 {
38  if (cesPin >=0) pinMode(cesPin, OUTPUT);
39  if (dcPin >= 0) pinMode(dcPin, OUTPUT);
40  if (rstPin >=0)
41  {
42  pinMode(rstPin, OUTPUT);
43  digitalWrite(rstPin, HIGH);
44  /* Wait at least 30ms after VCC is up for LCD */
45  delay(30);
46  /* Perform reset operation of LCD display */
47  digitalWrite(rstPin, LOW);
48  delay(1);
49  digitalWrite(rstPin, HIGH);
50  }
52 
53  ssd1306_hwSpiInit(cesPin, dcPin);
55  s_displayHeight = 48;
56  s_displayWidth = 84;
57  for( uint8_t i=0; i<sizeof(s_lcd84x48_initData); i++)
58  {
59  ssd1306_sendByte(pgm_read_byte(&s_lcd84x48_initData[i]));
60  }
62 }
void(* ssd1306_endTransmission)()
void(* ssd1306_sendByte)(uint8_t data)
void pcd8544_84x48_spi_init(int8_t rstPin, int8_t cesPin, int8_t dcPin)
Definition: pcd8544_84x48.c:36
uint8_t g_lcd_type
Definition: ssd1306.cpp:30
uint8_t s_displayHeight
Definition: ssd1306.cpp:28
void(* ssd1306_commandStart)()
uint8_t s_displayWidth
Definition: ssd1306.cpp:29