📄 rgb_interface_init_2_8.txt
字号:
//==========OLED 2.4" parallel 24 bits RGB interface==========//
#define S6E63D6_ID 0x70 //0111,0 ID RS R/W
void SPI_Write_Command(uWORD wAddr)
{
uCHAR j,k;
uCHAR StartByte=S6E63D6_ID;
Set_SPIEN_Low;
for(j = 0; j < SPI_SHORT_TIME; j++) ;
Set_SPISCK_High; //make sure SCk is High
for(j = 0; j < SPI_SHORT_TIME; j++) ;
for(k=0; k<8; k++) //send start byte
{
Set_SPISCK_Low;
if(StartByte&0x80) Set_SPISDA_High;
else Set_SPISDA_Low;
for(j = 0; j < SPI_SHORT_TIME; j++) ;
Set_SPISCK_High;
for(j = 0; j < SPI_SHORT_TIME; j++);
StartByte<<=1;
}
for(k = 0; k < 16; k++) //send 16 bits data
{
Set_SPISCK_Low;
if(wAddr&0x8000) Set_SPISDA_High;
else Set_SPISDA_Low;
for(j = 0; j < SPI_SHORT_TIME; j++) ;
Set_SPISCK_High;
for(j = 0; j < SPI_SHORT_TIME; j++);
wAddr<<=1;
}
Set_SPISDA_High;
for(j = 0; j < SPI_SHORT_TIME; j++);
Set_SPIEN_High;
for(j = 0; j < SPI_SHORT_TIME; j++);
}
void SPI_Write_Data(uWORD wData)
{
uCHAR j,k;
uCHAR StartByte=(S6E63D6_ID|0x02);
Set_SPIEN_Low;
for(j = 0; j < SPI_SHORT_TIME; j++) ;
Set_SPISCK_High; //make sure SCk is High
for(j = 0; j < SPI_SHORT_TIME; j++) ;
for(k=0; k<8; k++) //send start byte
{
Set_SPISCK_Low;
if(StartByte&0x80) Set_SPISDA_High;
else Set_SPISDA_Low;
for(j = 0; j < SPI_SHORT_TIME; j++) ;
Set_SPISCK_High;
for(j = 0; j < SPI_SHORT_TIME; j++);
StartByte<<=1;
}
for(k = 0; k < 16; k++) //send 16 bits data
{
Set_SPISCK_Low;
if(wData&0x8000) Set_SPISDA_High;
else Set_SPISDA_Low;
for(j = 0; j < SPI_SHORT_TIME; j++) ;
Set_SPISCK_High;
for(j = 0; j < SPI_SHORT_TIME; j++);
wData<<=1;
}
Set_SPISDA_High;
for(j = 0; j < SPI_SHORT_TIME; j++);
Set_SPIEN_High;
for(j = 0; j < SPI_SHORT_TIME; j++);
}
void SPI_Write_Register(uWORD wAddr, uWORD wData)
{
SPI_Write_Command(wAddr);
SPI_Write_Data(wData);
}
void CMEL_DriverIC_Initial(void)
{
//===========Gamma Setting ===============//
SPI_Write_Register(0x0070, 0x2580);
SPI_Write_Register(0x0071, 0x2780);
SPI_Write_Register(0x0072, 0x3380);
SPI_Write_Register(0x0073, 0x1d18);
SPI_Write_Register(0x0074, 0x1f15);
SPI_Write_Register(0x0075, 0x2419);
SPI_Write_Register(0x0076, 0x1a14);
SPI_Write_Register(0x0077, 0x211a);
SPI_Write_Register(0x0078, 0x2013);
SPI_Write_Register(0x0002, 0x0182); //RGB interface control
SPI_Write_Register(0x00F8, 0x0014); //Power gen3,VGH4~VGH0
SPI_Write_Register(0x00F9, 0x0014); //Power gen4,VGL4~VGL0
#ifdef VERTICAL_DISPLAY
SPI_Write_Register(0x0003, 0x8020); //Entry mode
#else
SPI_Write_Register(0x0003, 0x8031); //Entry mode
#endif
SPI_Write_Register(0x0010, 0x0000); //Stand by mode off
SPI_Write_Register(0x0005, 0x0001); //Display control1, display on
#ifdef VERTICAL_DISPLAY
SPI_Write_Register(0x0020, 0x00ef);
//SPI_Write_Register(0x0021, 0x013f);
#endif
SPI_Write_Command(0x0022); //This command is very important!
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -