⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hw_lq035q1dg01.c

📁 瑞星微公司RK27XX系列芯片的SDK开发包
💻 C
字号:
/******************************************************************/
/*   Copyright (C) 2007 ROCK-CHIPS FUZHOU . All Rights Reserved.  */
/*******************************************************************
File :  hw_8238a.c
Desc :  hw_8238a寄存器初始化

Author :  nzy
Date :
Notes :

$Log :
*********************************************************************/

#include "hw_include.h"
#include "hw_LQ035Q1DG01.h"

//UINT16 PosX,PosY;
/******************************************************************/
/*   Copyright (C) 2007 ROCK-CHIPS FUZHOU . All Rights Reserved.  */
/*******************************************************************
File :  hw_8238a.c
Desc :  hw_8238a寄存器初始化

Author :  nzy
Date :
Notes :

$Log :
*********************************************************************/

#include "hw_include.h"
#include "hw_LQ035Q1DG01.h"

//UINT16 PosX,PosY;

#if(LCDPANEL == RGBIF_LQ035Q1DG01)


// LCD's SPI bus configuration interface
//  LCD_nCS ---- LCDVF0 ---- GPC1
//  LCD_SCL ---- LCDVF1 ---- GPB6
//  LCD_SDI ---- LCDVF2 ---- GPB7




extern void USDELAY(UINT32 usec);
#define Delay2us                     USDELAY(2)

#define Set_CLK()                    GPIO_SetPinLevel(SCL_PIN,GPIO_HIGH)
#define Clr_CLK()                    GPIO_SetPinLevel(SCL_PIN,GPIO_LOW)
#define Set_Dat()                    GPIO_SetPinLevel(SDA_PIN,GPIO_HIGH)
#define Clr_Dat()                    GPIO_SetPinLevel(SDA_PIN,GPIO_LOW)

#define LCD_nCS_H       cs_set()
#define LCD_nCS_L       cs_clr()
#define LCD_SCL_H       Set_CLK()
#define LCD_SCL_L       Clr_CLK()
#define LCD_SDI_H       Set_Dat()
#define LCD_SDI_L       Clr_Dat()



void SpiDelay(int t)
{
    volatile int i;
    t = t * 1000;
    for (i = 0; i < t; i++)
    {
        ;
    }


}

void LCD_Reg_Set(unsigned int flag, unsigned int data)
{
    unsigned int i;

    data = (flag << 8) | data;

    LCD_nCS_L;
    // SpiDelay(4);
    USDELAY(2);
    //write Index register(address)
    for (i = 0; i < 9; i++)
    {
        LCD_SCL_L ;
        SpiDelay(4);


        if ((data&(1 << (9 - i - 1))) > 0) LCD_SDI_H ;
        else LCD_SDI_L ;
        SpiDelay(4);

        LCD_SCL_H ;
        SpiDelay(4);
    }
    LCD_SDI_L;
    LCD_SCL_L;
    USDELAY(2);
//   SpiDelay(4);
    LCD_nCS_H;
    USDELAY(2);
    //  SpiDelay(150);
}

void LCDsetReg(unsigned int reg, unsigned int data)
{
    unsigned int datah;
    unsigned int datal;
    unsigned int regh;
    unsigned int regl;

    scl_out();
    sda_out();
    cs_out();

//   regh  = (reg & 0xff00) >>8;
//   regl  = (reg & 0x00ff);
    datah = (data & 0xff00) >> 8;
    datal = (data & 0x00ff);

    //LCD_Reg_Set(0, regh);
    LCD_Reg_Set(0, reg);
    LCD_Reg_Set(1, datah);
    LCD_Reg_Set(1, datal);
}




/*---------------------------------------------------------
Name  :  HWLQ035Q1DG01_PowerOnInit
Desc  :
Params:
Return:
Author:  nzy
Date  :
-----------------------------------------------------------*/
void HWLQ035Q1DG01_PowerOnInit(void)
{
    int i = 0;
    scl_out();
    sda_out();
    cs_out();
    LCD_nCS_H;
    LCD_SCL_H;
    LCD_SDI_L;
    /*reset for least 80us*/
    DelayMs_nops(400);


    //for(i = 0;i++;i<1024){
    // LCDsetReg( 0x01, 0x29ef);
    // LCDsetReg( 0x01, 0x5a5a);
    //}

#if 0
    LCDsetReg(0x01, 0x2aef); //driver output control
    LCDsetReg(0x02, 0x0300); //lcd drive ac control
    LCDsetReg(0x03, 0x7a7e); //power control(1)
    LCDsetReg(0x0c, 0x0005); //power control(2)
    LCDsetReg(0x0d, 0x0002); //power control(3)
    LCDsetReg(0x0e, 0x3200); //power control(4) 0x2600
    LCDsetReg(0x1e, 0x0000); //power control(5)

    LCDsetReg(0x2e, 0xb945); //3Gamma
    LCDsetReg(0x30, 0x0707); //gamma control(1)
    LCDsetReg(0x31, 0x0307); //gamma control(1)
    LCDsetReg(0x32, 0x0507); //gamma control(1)
    LCDsetReg(0x33, 0x0104); //gamma control(1)
    LCDsetReg(0x34, 0x0002); //gamma control(1)
    LCDsetReg(0x35, 0x0004); //gamma control(1)
    LCDsetReg(0x36, 0x0000); //gamma control(1)
    LCDsetReg(0x37, 0x0501); //gamma control(1)
    LCDsetReg(0x3a, 0x0d0b); //gamma control(1)
    LCDsetReg(0x3b, 0x0d0b); //gamma control(1)

    LCDsetReg(0x28, 0x0006);  //extern command
    LCDsetReg(0x2c, 0xc88c); //extern command

    LCDsetReg(0x16, 0x9f86); //horizontal porch //0x9f86 0x7786
    LCDsetReg(0x17, 0x0002); //vertical porch 0x00ef 0x013f
#endif






#if 1
    LCDsetReg(0x28, 0x0006);
    LCDsetReg(0x2d, 0x7f06);
    LCDsetReg(0x01, 0x29ef);   //0x2aef //屏的翻转设置 0x29ef
    LCDsetReg(0x02, 0x0300);
    LCDsetReg(0x03, 0x0a0e);
    LCDsetReg(0x0c, 0x0005);
    LCDsetReg(0x0d, 0x0002);
    LCDsetReg(0x0e, 0x2600);
    LCDsetReg(0x1e, 0x0000);

    LCDsetReg(0x2e, 0xb945);

    LCDsetReg(0x30, 0x0707); //gamma control(1)
    LCDsetReg(0x31, 0x0307); //gamma control(1)
    LCDsetReg(0x32, 0x0507); //gamma control(1)
    LCDsetReg(0x33, 0x0104); //gamma control(1)
    LCDsetReg(0x34, 0x0002); //gamma control(1)
    LCDsetReg(0x35, 0x0004); //gamma control(1)
    LCDsetReg(0x36, 0x0000); //gamma control(1)
    LCDsetReg(0x37, 0x0501); //gamma control(1)

    LCDsetReg(0x3a, 0x0d0b); //gamma control(1)
    LCDsetReg(0x3b, 0x0d0b); //gamma control(1)

    LCDsetReg(0x2c, 0xc88c); //extern command

    LCDsetReg(0x2d, 0x7f04);

    DelayMs_nops(10);

#endif



}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -