/*
2007-2-1 12:06
nokia 5110 driver program for 51 mcu
by zl0801

zhaoliang0801@gmail.com

*/

//#include <reg51.h>
#include "main.h"



// pin define for n5110lcd_8key board
// change this if your hardware changed!

#if 0
sbit SCLK = P2 ^ 5;		// pin 2	 header	5
sbit SDIN = P2 ^ 4;		// pin 3	 header	4
sbit LCD_DC = P2 ^ 3;		// pin 4	 header	3
sbit LCD_CE = P2 ^ 2;		// pin 5	 header	2
sbit LCD_RST = P2 ^ 1;	// pin 9	 header	1
#else

//#define PA_Bit0 ((volatile unsigned long *) (0x42210180))
//#define PA_Bit1 ((volatile unsigned long *) (0x42210184))
//#define PA_Bit2 ((volatile unsigned long *) (0x42210188))
//#define PA_Bit3 ((volatile unsigned long *) (0x4221018C))
//#define PA_Bit4 ((volatile unsigned long *) (0x42210190))
//#define PA_Bit5 ((volatile unsigned long *) (0x42210194))


#endif


/*Private define-------------------------*/
#define POINT_COLOR RED
#define BACK_COLOR	0xFFFF
/*--------16位颜色值---------------*/
#define WHITE        0xFFFF
#define BLACK        0x0000	  
#define BLUE         0x001F  
#define RED          0xF800
#define MAGENTA      0xF81F
#define GREEN        0x07E0
#define CYAN         0x7FFF
#define YELLOW       0xFFE0
#define BROWN 			 0XBC40 //棕色
#define BRRED 			 0XFC07 //棕红色
#define GRAY  			 0X8430 //灰色
#define LGRAY 			 0XC618 //浅灰色

#define MAX_HZ_POSX 224
#define MAX_HZ_POSY 304
#define MAX_CHAR_POSX 232
#define MAX_CHAR_POSY 304 


extern char n5110_string[6][14];

void LCD_init ( void );
void LCD_clear ( void );
void LCD_move_chinese_string ( unsigned char X, unsigned char Y, unsigned char T );
void LCD_write_english_string ( unsigned char X, unsigned char Y, char *s );
void LCD_write_chinese_string ( unsigned char X, unsigned char Y,
                                unsigned char ch_with, unsigned char num,
                                unsigned char line, unsigned char row );
void chinese_string ( unsigned char X, unsigned char Y, unsigned char T );
void LCD_write_char ( unsigned char c );
void LCD_draw_bmp_pixel ( unsigned char X, unsigned char Y, unsigned char *map,
                          unsigned char Pix_x, unsigned char Pix_y );
void LCD_write_byte ( unsigned char dat, unsigned char dc );
void LCD_set_XY ( unsigned char X, unsigned char Y );
void RefreshLCD ( void );

