📄 ssd1332.c
字号:
#include "ssd1332.h"
#include "io.h"
#include "os.h"
#include "sublcd.h"
int SUBLCD_WIDTH=96;
int SUBLCD_HEIGHT=64;
#define MAINSUB_P6800 1 // Parallel 6800 mode
#define MAINSUB_Sub16bpp 1 // Define 2 byte per pixel (16bpp) for Sub panel
void sublcd_hw_init(void)
{
SSD_REGWB(REG_Sub_Type,SSD_REGRB(REG_Sub_Type)|0x02);
// SSD1332 Initialization code
SubCmdWriteByte(0xae); // Display off
SubCmdWriteByte(0xad); // Set Master Configuration
SubCmdWriteByte(0x8e);
SubCmdWriteByte(0xa8); // Set MUX ratio
SubCmdWriteByte(0x3f);
SubCmdWriteByte(0xa2); // Set Display Offset
SubCmdWriteByte(0x00);
SubCmdWriteByte(0xa1); // Set Display Start line
SubCmdWriteByte(0x00);
SubCmdWriteByte(0xa0); // Set remap & data format
SubCmdWriteByte(0x60); // old is 40
SubCmdWriteByte(0x81); // Set contrast for color A
SubCmdWriteByte(0x80);
SubCmdWriteByte(0x82); // Set contrast for color B
SubCmdWriteByte(0x80);
SubCmdWriteByte(0x83); // Set contrast for color C
SubCmdWriteByte(0x80);
SubCmdWriteByte(0x87); // Set Master Current
SubCmdWriteByte(0x8f);
SubCmdWriteByte(0xbb); // Set color A VP
SubCmdWriteByte(0x80);
SubCmdWriteByte(0xbc); // Set color B VP
SubCmdWriteByte(0x80);
SubCmdWriteByte(0xbd); // Set color C VP
SubCmdWriteByte(0x80);
SubCmdWriteByte(0xbe); // Set VCOMH
SubCmdWriteByte(0x7f);
SubCmdWriteByte(0xb8); // Set Gray Scale LUT
SubCmdWriteByte(0x01);
SubCmdWriteByte(0x05);
SubCmdWriteByte(0x09);
SubCmdWriteByte(0x0d);
SubCmdWriteByte(0x11);
SubCmdWriteByte(0x15);
SubCmdWriteByte(0x19);
SubCmdWriteByte(0x1d);
SubCmdWriteByte(0x21);
SubCmdWriteByte(0x25);
SubCmdWriteByte(0x29);
SubCmdWriteByte(0x2d);
SubCmdWriteByte(0x31);
SubCmdWriteByte(0x35);
SubCmdWriteByte(0x39);
SubCmdWriteByte(0x3d);
SubCmdWriteByte(0x41);
SubCmdWriteByte(0x45);
SubCmdWriteByte(0x49);
SubCmdWriteByte(0x4d);
SubCmdWriteByte(0x51);
SubCmdWriteByte(0x55);
SubCmdWriteByte(0x59);
SubCmdWriteByte(0x5d);
SubCmdWriteByte(0x61);
SubCmdWriteByte(0x65);
SubCmdWriteByte(0x69);
SubCmdWriteByte(0x6d);
SubCmdWriteByte(0x71);
SubCmdWriteByte(0x75);
SubCmdWriteByte(0x79);
SubCmdWriteByte(0x7d);
SubCmdWriteByte(0xb0); // Set Driving Scheme
SubCmdWriteByte(0x00);
SubCmdWriteByte(0xb1); // Set Phase 1 & 2 timing
SubCmdWriteByte(0x74);
SubCmdWriteByte(0xb3); // Set Osc frequency
SubCmdWriteByte(0xd0);
SubCmdWriteByte(0xaf); // Display On
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -