lcd.c

来自「Keil工程例子,NXP新出的芯片lpc2478的示例代码」· C语言 代码 · 共 126 行

C
126
字号
/***********************************************************************
 * File:   lcd.c
 * Rev:    1.0
 * Author: Chun Sing Chu
 * Date:   March 26 2007
 *
 * Description:
 *     This example shows how to use LCD driver
 *
 * Revision History:
 * Rev 1.0 March 26 2007
 * Initial revision.
 *
 **********************************************************************/
#include "LPC24xx.H"
#include "type.h"
#include "data_types.h"
#include "clcdc.h"
#include "lcd_params.h"
#include "lcd_driver.h"
#include "uCdragon_LOGO.h"
#include "low_level_init.h"
#include "lcd_params.h"
#include "uart.h"
#include "irq.h"
#include "touch_screen.h"
#include "fio.h"

#define SW_JP14800      0x00000002 /* P2.1 */
#define LCD_DISPLAY dh240
#define X_MIN 136
#define X_MAX 896
#define Y_MIN 152
#define Y_MAX 864

static INT32S dev_lcd;
static INT32S dev_lcd;
static INT32U num_frms;
volatile DWORD UART0Status;


void Lcd_ClearScr(INT32S x,INT32S y,INT32S c);
void Glib_Line(INT32S x1,INT32S y1,INT32S x2,INT32S y2,INT32S color);
void Glib_Rectangle(INT32S x1,INT32S y1,INT32S x2,INT32S y2,INT32S color);
void Glib_FilledRectangle(INT32S x1,INT32S y1,INT32S x2,INT32S y2,INT32S color);


/***********************************************************************
 *
 * Function: main
 *
 * Purpose: Function entry point from the startup code.
 *
 * Processing:
 *
 * Parameters: 	None
 *
 * Outputs: None
 *
 * Returns: None
 *
 **********************************************************************/
INT32S main(void)
{

    INT32U swap,i;
    TargetResetInit();	/*初始化PLL,RAM,GPIO..*/
	UARTInit(115200);

	 FIO3DIR=0x00FF0000;
     FIO3CLR=0x00FF0000;


    /* Open LCD */
 	 if ((dev_lcd = lcd_open(CLCDC, (INT32S)&LCD_DISPLAY)) == 0x0)
    {
        /* Error opening the device */
        return 0;
    }


    /* Set LCD display pointer */
	 lcd_ioctl(dev_lcd, LCD_SET_BUFFER, (INT32S)SDRAM_BASE);

    /* Turn on LCD */
    lcd_ioctl(dev_lcd, LCD_PWR_ON, 1);
   	
    /* Enable LCD */
    lcd_ioctl(dev_lcd, LCD_ENABLE, 1);
    
    swap = *(volatile INT32U *)(0xFFE10018);
     *(volatile INT32U *)(0xFFE10018) = swap |(1 << 8);//swap red and blue     
   
    Lcd_ClearScr(320,240,0xffff);//black
    delayMs(1500);

	
	 EINTInit();
	 touch_init();
	
	  while(1) 
	{
	 fillmosaic();
	 FIO3CLR=0X00FF0000;
 	 delayMs(100);
    D6_ON();
      delayMs(100);
     D6_OFF();
     
     D5_ON();
      delayMs(100);
     D5_OFF();
     
     D4_ON();
      delayMs(100);
     D4_OFF();
     
     D7_ON();
      delayMs(100);
     D7_OFF();
	 
	 }
}


⌨️ 快捷键说明

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