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

📄 lcd.h

📁 mp3量不要让站长把时间都花费在为您修正说明上。压缩包解压时不能有密码。系统会自动删除debug和release目录
💻 H
字号:
/*****************************************************/
/*            File name : LCD.c                                                   */
/* Description : Code  for Nokia 3310LCD, display IC:PCD8544  */
/* Platform     : SourceInsight3.5 + WinARM20060606  for 7S256     */
/* Author       : Michael Zhang - 章其波                            */
/* Email         : sudazqb@163.com                                          */
/* MSN          : zhangqibo_1985@hotmail.com                          */
/* Date          : 2007-12-06                                                    */
/* NOT FOR COMMERCIAL USE,     ALL RIGHT RESERVED!         */
/*****************************************************/
/* Change Log:                                                                      */
/*  20080928: modify codes for ARM platform (NXP LPC2132)  */
/*                   20071222: modify for use another chip on board (mcuzone mp3) */
/*                   20071212: modify code for mcuzone's mp3 player */
/*                   20071206: modify code for Atmel ARM AT91SAM7S256 */
/*                   20071122: fix a bug for some 3310lcd will not work with display function */
/*                   20071021: original version                                 */
/*****************************************************/

#ifndef __LCD_H__
#define __LCD_H__

#if 0

#include "global.h"
#include "time.h"
#include "board.h"
#include "port.h"


#define _delay_ms wait	/* delay function */

/************************* SPI ***********************************/
/* 1: means use hardware SPI, while 0 means use GPIO to simulate SPI       */
#define HW_SPI 1

/******************* Hardware pins definition **********************/

/* pins of the signal */
#define LCD_RS		(1<<0)
#define LCD_E		(1<<6)

#define LCD_RST		(1<<29)
#define LCD_SCK		(1<<0)
#define LCD_MOSI	(1<<1)

/********************************************************************/

/********************  IO utilities ***************************/
/* suffix H: high, L: low */
//#define LCD_RS_H	pPIO->PIO_SODR = LCD_RS
//#define LCD_RS_L		pPIO->PIO_CODR = LCD_RS

//#define LCD_E_H		pPIO->PIO_SODR = LCD_E
//#define LCD_E_L		pPIO->PIO_CODR = LCD_E


#define LCD_RS_H	portSetAddr(0xbf)
#define LCD_RS_L		portSetAddr(0xbe)

#define LCD_E_H		portSetAddr(0xff)
#define LCD_E_L		portSetAddr(0xfe)

#define LCD_RST_H	pPIO->PIO_SODR = LCD_RST
#define LCD_RST_L	pPIO->PIO_CODR = LCD_RST


#define LCD_SCK_H	pPIO->PIO_SODR = LCD_SCK
#define LCD_SCK_L	pPIO->PIO_CODR= LCD_SCK

#define LCD_MOSI_H	pPIO->PIO_SODR = LCD_MOSI
#define LCD_MOSI_L	pPIO->PIO_CODR = LCD_MOSI


#define LCD_PORT_INI {				\
					pPIO->PIO_PER = LCD_SCK|LCD_MOSI|LCD_RST;	\
					pPIO->PIO_OER = LCD_SCK|LCD_MOSI|LCD_RST;	\
					pPIO->PIO_SODR = LCD_SCK|LCD_MOSI|LCD_RST;\
				}
/**************************************************************/
#endif

#include "global.h"
#define _delay_ms soft_delay_ms

#define HW_SPI 1

//P0.12
#define     LCD_RST						(0x01  << 12)
#define     LCD_RST_GPIO()				PINSEL0 &= ~(0x03 << 24)
#define		LCD_RST_OUT()				IO0DIR 	|= LCD_RST			
#define	 	LCD_RST_H				IO0SET 	|= LCD_RST			
#define  	LCD_RST_L				IO0CLR 	|= LCD_RST


//p0.11
#define     LCD_CS						(0x01  << 11)
#define     LCD_CS_GPIO()				PINSEL0 &= ~(0x03 << 22)
#define		LCD_CS_OUT()				IO0DIR 	|= LCD_CS			
#define	 	LCD_E_H				IO0SET 	|= LCD_CS			
#define  	LCD_E_L				IO0CLR 	|= LCD_CS

//P1.23
#define     LCD_DC						(0x01  << 23)
#define     LCD_DC_GPIO()				PINSEL2 &= ~(0x02 <<2)
#define		LCD_DC_OUT()				IO1DIR 	|= LCD_DC			
#define	 	LCD_RS_H				IO1SET 	|= LCD_DC			
#define  	LCD_RS_L				IO1CLR 	|= LCD_DC

#define LCD_PORT_INI {\
		\
		LCD_RST_GPIO();\
		LCD_RST_OUT();\
		LCD_RST_H;\
					\
		LCD_CS_GPIO();\
		LCD_CS_OUT();\
		LCD_E_H;\
				\
		LCD_DC_GPIO();\
		LCD_DC_OUT();\
		LCD_RS_H;\
				PINSEL0 &= ~((0x03 << 8) + (0x03 << 10) + (0x03 << 12));  \
	PINSEL0 |=  (0x01 << 8) + (0x01 << 10) + (0x01 << 12);	\
	}

extern void lcdInit(void);		/* LCD initialization */
extern void lcdClrDisBuf(void);	/* clear the buffer, but not the display, just the buffer in local ram */
extern void lcdUpdateDisplay(void);	/* update the display, send the buffer in local ram to LCD*/
extern void OnePixel(unsigned char x,unsigned char y,unsigned char val);	/* actually set one pixel of the buffer*/
extern unsigned char ReadPixel(unsigned char x,unsigned char y);	/* get one pixel's value */
extern void lcdTest(void);	/* a simple test utility,  you'll see the screen is filling dots  */

#endif

/* This is the end line of LCD.h */

⌨️ 快捷键说明

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