亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ili9320l_16bit.c

?? PIC 驅動9320 Module for Microchip Graphics Library ILITEK ILI9320 LCD controller driver Landscape o
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*****************************************************************************
 *  Module for Microchip Graphics Library
 *  ILITEK ILI9320 LCD controller driver
 *  Landscape orientation in 16-bit mode
 *****************************************************************************
 
 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Juh醩z R骲ert     	24 Dec 2007		Version 1.0 release
 * John Leung     		7 Dec 2007		Version 1.0 release
 *****************************************************************************/
#include "Graphics.h"

// Color
WORD_VAL    _color;
// Clipping region control
SHORT _clipRgn;
// Clipping region borders
SHORT _clipLeft;
SHORT _clipTop;
SHORT _clipRight;
SHORT _clipBottom;

/////////////////////// LOCAL FUNCTIONS PROTOTYPES ////////////////////////////
void SetReg(BYTE index, WORD value);
void PutImage1BPP(SHORT left, SHORT top, FLASH_BYTE* bitmap, BYTE stretch);
void PutImage4BPP(SHORT left, SHORT top, FLASH_BYTE* bitmap, BYTE stretch);
void PutImage8BPP(SHORT left, SHORT top, FLASH_BYTE* bitmap, BYTE stretch);
void PutImage16BPP(SHORT left, SHORT top, FLASH_BYTE* bitmap, BYTE stretch);

void PutImage1BPPExt(SHORT left, SHORT top, void* bitmap, BYTE stretch);
void PutImage4BPPExt(SHORT left, SHORT top, void* bitmap, BYTE stretch);
void PutImage8BPPExt(SHORT left, SHORT top, void* bitmap, BYTE stretch);
void PutImage16BPPExt(SHORT left, SHORT top, void* bitmap, BYTE stretch);



/*********************************************************************
* Function:  void  DelayMs(WORD time)
*
* PreCondition: none
*
* Input: time - delay in ms
*
* Output: none
*
* Side Effects: none
*
* Overview: delays execution on time specified in ms
*
* Note: delay is defined for 16MIPS
*
********************************************************************/
#define DELAY_1MS 16000/9
void  DelayMs(WORD time){
unsigned delay;
	while(time--)
		for(delay=0; delay<DELAY_1MS; delay++);	
}

/*********************************************************************
* Function:  void  SetReg(BYTE index, WORD value)
*
* PreCondition: none
*
* Input: index - register number
*        value - value to be set
*
* Output: none
*
* Side Effects: none
*
* Overview: sets graphics controller register
*
* Note: none
*
********************************************************************/
void  SetReg(BYTE index, WORD value){
    SetIndex(index);
    WriteData(((WORD_VAL)value).v[1],((WORD_VAL)value).v[0]);
}

/*********************************************************************
* Function:  void ResetDevice()
*
* PreCondition: none
*
* Input: none
*
* Output: none
*
* Side Effects: none
*
* Overview: resets LCD, initializes PMP
*
* Note: none
*
********************************************************************/
void ResetDevice(void){

   // Set LCD CS pin as output
    CS_TRIS_BIT = 0;
    // Disable LCD 
    CS_LAT_BIT = 1;
    
    // Set reset pin as output
    RST_TRIS_BIT = 0;
    // Hold in reset
    RST_LAT_BIT = 0;
    
    // PMP setup
    PMMODEbits.MODE  = 0b10;  // Master 2
    PMMODEbits.WAITB = 0b00;
    PMMODEbits.WAITM = 0b0001;
    PMMODEbits.WAITE = 0b00;
    PMAEN			 = 0x01FF;     	// Address line 8 is enabled for RS & PMA[7:0] for DATA LINES DB[7:0]
    PMCONbits.PTRDEN = 1;    
    PMCONbits.PTWREN = 1;
    PMCONbits.PMPEN  = 1; 	  		//enable PMP module

    // Reset controller
    RST_LAT_BIT = 0;
    DelayMs(2);
    RST_LAT_BIT = 1;
    DelayMs(2);

	Nop();
	Nop();

    // Enable LCD 
    CS_LAT_BIT = 0;

	/*** Setup display for ILI9320 driver IC ***/ 
    SetReg(0xe5,0x8000);		//start osc
	SetReg(0x00,0x0001);
    DelayMs(10);
    SetReg(0xa4,0x0001);       	//calb
    
    SetReg(0x07,0x0000);		//display control(1)
	DelayMs(10);	

	/*** Display Setting ***/	
	SetReg(0x01, 0x0100);	//Driver output control (1)
	SetReg(0x02, 0x0700);	//LCD driving control
	SetReg(0x03, 0x1028); 	//Entry mode  //1030
	SetReg(0x04, 0x0000);	//Resize control
	SetReg(0x08, 0x0202);	//Display control (2)
	SetReg(0x09, 0x0000);	//Display control (3)

	/*** Power Control ***/
	SetReg(0x07, 0x0101);	//power control 1 BT, AP
	SetReg(0x17, 0x0001);
	SetReg(0x10, 0x0000);
	SetReg(0x11, 0x0007);	//power control 2 DC, VC
	SetReg(0x12, 0x0000);	//power control 3 VRH
	SetReg(0x13, 0x0000);	//power control 4 VCOM amplitude
	DelayMs(20);

  	SetReg(0x10, 0x16B0);             //power control 1 BT,AP
    SetReg(0x11, 0x0037);             //power control 2 DC,VC
	DelayMs(50);
    SetReg(0x12, 0x013E);             //power control 3 VRH
	DelayMs(50);
    SetReg(0x13, 0x1A00);             //power control 4 vcom amplitude
    SetReg(0x29, 0x000F);             //power control 7 VCOMH
	DelayMs(50);
    SetReg(0x20, 0x0000);              //Horizontal GRAM Address Set
    SetReg(0x21, 0x0000);              //Vertical GRAM Address Set

    SetReg(0x50, 0x0000);              //Horizontal Address Start Position
    SetReg(0x51, 0x00EF);              //Horizontal Address end Position (239)
    SetReg(0x52, 0x0000);              //Vertical Address Start Position
    SetReg(0x53, 0x013F);              //Vertical Address end Position (319)

    SetReg(0x60, 0x2700);              //Driver Output Control 2
    SetReg(0x61, 0x0001);              //Base Image Display Control
    SetReg(0x6a, 0x0000);              //Base Image Display Control

    SetReg(0x90, 0x0010);              //Panel Interface Control 1
    SetReg(0x92, 0x0000);              //Panel Interface Control 2
    SetReg(0x93, 0x0000);              //Panel Interface Control 3
    
 	/*** GAMMA Control ***/
    SetReg(0x30, 0x0007);
    SetReg(0x31, 0x0403);
    SetReg(0x32, 0x0404);   
    SetReg(0x35, 0x0002);
    SetReg(0x36, 0x0707);
    SetReg(0x37, 0x0606);
    SetReg(0x38, 0x0106);
    SetReg(0x39, 0x0007);
    SetReg(0x3c, 0x0700);
    SetReg(0x3d, 0x0707);

    SetReg(0x07, 0x0173);

    // Disable LCD 
    CS_LAT_BIT = 1;

    DelayMs(30);
}

/*********************************************************************
* Function: void PutPixel(SHORT x, SHORT y)
*
* PreCondition: none
*
* Input: x,y - pixel coordinates
*
* Output: none
*
* Side Effects: none
*
* Overview: puts pixel
*
* Note: none
*
********************************************************************/
void PutPixel(SHORT x, SHORT y){
DWORD_VAL address;
    if(_clipRgn){
        if(x<_clipLeft)
            return;
        if(x>_clipRight)
            return;
        if(y<_clipTop)
            return;
        if(y>_clipBottom)
            return;
    }
    
    y = GetMaxY() - y;
    CS_LAT_BIT = 0;
    address.Val = (long)LINE_MEM_PITCH*x + y;
    
    SetAddress(address.v[2],address.v[1],address.v[0]);
    WriteData(_color.v[1],_color.v[0]);   
    CS_LAT_BIT = 1;
}

/*********************************************************************
* Function: WORD GetPixel(SHORT x, SHORT y)
*
* PreCondition: none
*
* Input: x,y - pixel coordinates 
*
* Output: pixel color
*
* Side Effects: none
*
* Overview: return pixel color at x,y position
*
* Note: not finished yet!!!
*
********************************************************************/
WORD GetPixel(SHORT x, SHORT y){
DWORD_VAL address;
WORD_VAL  result;

    y = GetMaxY() - y;
    address.Val = (long)LINE_MEM_PITCH*x + y;


    CS_LAT_BIT = 0;

    SetAddress(address.v[2],address.v[1],address.v[0]);

    // Temporary change wait cycles for reading (250ns = 4 cycles)
    PMMODE =  0x0210;
    PMADDR =  0x0001;

    // First RD cycle to move data from GRAM to Read Data Latch
    result.v[1] = PMDIN1;

    // For reading there's 4 wait cycles > 250ns /RD pulse.
    // Only 4 instruction cycles are needed for PMP.
    Nop(); Nop(); Nop(); Nop();

    // Second RD cycle to move data from GRAM to Read Data Latch
    result.v[1] = PMDIN1;

    // For reading there's 4 wait cycles > 250ns /RD pulse.
    // Only 4 instruction cycles are needed for PMP.
    Nop(); Nop(); Nop(); Nop();    


    // First RD cycle to get data from Read Data Latch
    // Read previous dummy value
    result.v[1] = PMDIN1;

    // For reading there's 4 wait cycles > 250ns /RD pulse.
    // Only 4 instruction cycles are needed for PMP.
    Nop(); Nop(); Nop(); Nop();    


    // Second RD cycle to get data from Read Data Latch
    // Read MSB
    result.v[1] = PMDIN1;

    // For reading there's 4 wait cycles > 250ns /RD pulse.
    // Only 4 instruction cycles are needed for PMP.
    Nop(); Nop(); Nop();


    // Disable LCD (it will not accept extra /RD pulse)
    CS_LAT_BIT = 1;

    // Read LSB
    result.v[0] = PMDIN1;

    // For reading there's 4 wait cycles > 250ns /RD pulse.
    // Only 4 instruction cycles are needed for PMP.
    Nop(); Nop(); Nop(); Nop();
 
    // Restore wait cycles for writing (60ns = 1 cycle)    
    PMMODE = 0x0204;

    return result.Val;
}

/*********************************************************************
* Function: void Bar(SHORT left, SHORT top, SHORT right, SHORT bottom)
*
* PreCondition: none
*
* Input: left,top - top left corner coordinates,
*        right,bottom - bottom right corner coordinates
*
* Output: none
*
* Side Effects: none
*
* Overview: draws rectangle filled with current color
*
* Note: none
*
********************************************************************/
void Bar(SHORT left, SHORT top, SHORT right, SHORT bottom){
DWORD_VAL address;
register SHORT  x,y;

    if(_clipRgn){
        if(left<_clipLeft)
           left = _clipLeft;
        if(right>_clipRight)
           right= _clipRight;
        if(top<_clipTop)
           top = _clipTop;
        if(bottom>_clipBottom)
           bottom = _clipBottom;
    }

    top = GetMaxY() - top;
    bottom = GetMaxY() - bottom;
 
    address.Val = (DWORD)LINE_MEM_PITCH*left + top;

    CS_LAT_BIT = 0;
    for(y=bottom; y<top+1; y++){

        SetAddress(address.v[2],address.v[1],address.v[0]);
        for(x=left; x<right+1; x++){
            WriteData(_color.v[1],_color.v[0]);
        }
        address.Val -= 1;

    }
    CS_LAT_BIT = 1;
}

/*********************************************************************
* Function: void ClearDevice(void)
*
* PreCondition: none
*

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人午夜av在线| 粉嫩aⅴ一区二区三区四区五区| 久久精品人人做人人综合 | 色诱视频网站一区| 99久久99久久精品免费观看| 国产宾馆实践打屁股91| 国产麻豆一精品一av一免费| 精品在线你懂的| 极品少妇xxxx精品少妇偷拍| 激情综合五月婷婷| 国产精品69毛片高清亚洲| 国产电影精品久久禁18| 成人免费毛片a| 色婷婷综合激情| 欧美精品一二三| 亚洲国产精品传媒在线观看| 精品日韩成人av| 中文字幕乱码日本亚洲一区二区 | 色老汉一区二区三区| 日韩精品一卡二卡三卡四卡无卡| 亚洲成人av资源| 日韩av一区二区三区四区| 日本不卡中文字幕| 日韩精品乱码免费| 国产资源在线一区| av在线一区二区| www.一区二区| 韩国理伦片一区二区三区在线播放 | 91麻豆精品国产自产在线观看一区 | 亚洲影视在线播放| 久88久久88久久久| 欧美电影免费提供在线观看| 日韩精品乱码av一区二区| 欧美理论电影在线| 亚洲国产欧美一区二区三区丁香婷| 99久久精品国产毛片| 国产精品国产三级国产aⅴ原创| 国产精品亚洲第一| 久久久一区二区三区| 国产高清不卡一区二区| 国产欧美日韩另类一区| 成人天堂资源www在线| 国产精品护士白丝一区av| 99re在线精品| 亚洲一区视频在线| 欧美日韩成人综合在线一区二区| 日韩精品免费专区| 精品国产成人系列| 国产高清久久久久| 亚洲色图制服诱惑| 7799精品视频| 国产主播一区二区| 国产女同性恋一区二区| 91免费视频观看| 亚洲成av人影院| 精品国产1区二区| 成人国产一区二区三区精品| 一区av在线播放| 在线综合亚洲欧美在线视频| 国产中文一区二区三区| 亚洲丝袜自拍清纯另类| 欧美老肥妇做.爰bbww视频| 激情文学综合网| 亚洲免费在线播放| 日韩一区二区不卡| 99免费精品在线| 热久久国产精品| 中文字幕在线观看不卡视频| 欧美日本在线一区| 国产电影精品久久禁18| 视频一区视频二区中文字幕| 久久久久久久久久久久久久久99 | 五月婷婷综合网| 久久久久久久久久久久久夜| 在线观看成人小视频| 狠狠久久亚洲欧美| 亚洲午夜在线观看视频在线| 欧美精品一区二区三区蜜臀| 色欧美88888久久久久久影院| 久久国产精品露脸对白| 一区二区三区四区不卡在线| 精品国产乱子伦一区| 色999日韩国产欧美一区二区| 精品午夜一区二区三区在线观看| 一区二区三区四区在线| 久久美女高清视频| 欧美蜜桃一区二区三区| 成人免费毛片app| 九色综合国产一区二区三区| 亚洲电影中文字幕在线观看| 国产精品午夜在线| 欧美精品一区二区三区蜜桃| 911精品产国品一二三产区| 91丨porny丨国产| 国产成人免费在线视频| 久久国产精品无码网站| 亚洲一区二区三区在线| 国产精品丝袜久久久久久app| 欧美一级免费大片| 欧美日韩一区成人| 色8久久人人97超碰香蕉987| 成人一级视频在线观看| 国模冰冰炮一区二区| 日韩精品国产精品| 爽爽淫人综合网网站| 亚洲无人区一区| 亚洲精品国产第一综合99久久 | 国产乱码精品1区2区3区| 日韩av中文字幕一区二区三区| 一区二区欧美国产| 一区二区三区在线观看视频| 亚洲色图一区二区| 日韩一区中文字幕| 中文字幕日本不卡| 亚洲欧美色一区| 一区二区三区视频在线看| 亚洲人成网站影音先锋播放| 专区另类欧美日韩| 亚洲欧美日韩久久| 一区二区三区产品免费精品久久75| 亚洲欧美电影院| 亚洲一卡二卡三卡四卡无卡久久| 一区二区三区精品在线观看| 亚洲美女一区二区三区| 亚洲综合无码一区二区| 午夜免费久久看| 麻豆freexxxx性91精品| 韩国女主播一区| 成人丝袜视频网| 欧美在线啊v一区| 制服.丝袜.亚洲.另类.中文| 精品捆绑美女sm三区| 久久男人中文字幕资源站| 国产精品视频你懂的| 亚洲精品乱码久久久久久| 香蕉久久夜色精品国产使用方法| 日本欧美一区二区| 国产福利一区二区三区视频 | 国产精品第五页| 亚洲精选一二三| 免费人成精品欧美精品| 国产在线播精品第三| 成人免费毛片嘿嘿连载视频| 色天使色偷偷av一区二区| 67194成人在线观看| 国产亚洲欧美一级| 亚洲一区二区精品久久av| 六月丁香婷婷色狠狠久久| 9久草视频在线视频精品| 欧美体内she精高潮| 精品国产免费人成电影在线观看四季| 欧美激情一区二区三区四区| 一区二区三区国产精华| 精品亚洲aⅴ乱码一区二区三区| 不卡一二三区首页| 91精品国产综合久久福利软件| 国产午夜精品一区二区三区四区| 一区二区三区四区不卡在线| 国产一区二区日韩精品| 欧美三级视频在线播放| 国产亚洲自拍一区| 午夜电影网亚洲视频| 成人福利视频在线| 欧美mv日韩mv亚洲| 亚洲影视在线播放| fc2成人免费人成在线观看播放| 91精品国产入口在线| 国产精品视频看| 激情小说亚洲一区| 欧美在线观看18| 中文字幕日本乱码精品影院| 久久电影网站中文字幕| 欧美午夜精品久久久久久孕妇| 中文字幕乱码一区二区免费| 美腿丝袜在线亚洲一区| 日本精品视频一区二区三区| 国产日韩精品久久久| 美国三级日本三级久久99| 欧美视频在线观看一区二区| 国产精品欧美久久久久无广告| 极品少妇xxxx精品少妇偷拍| 91 com成人网| 亚洲成人av中文| 欧美系列一区二区| 亚洲靠逼com| 91免费国产在线| 中文字幕中文乱码欧美一区二区| 国内外精品视频| 日韩视频一区二区三区在线播放| 亚洲一区二区三区中文字幕| 91麻豆视频网站| 亚洲欧美日韩久久| 91美女在线观看| 日韩美女视频一区| 成人精品一区二区三区四区| 国产婷婷色一区二区三区四区 | 日韩午夜在线播放| 肉肉av福利一精品导航| 欧美男人的天堂一二区| 亚洲国产精品天堂|