/*
 * lcd_5110_solution.h
 *
 *  Created on: 2012-2-2
 *      Author: Administrator
 */

#ifndef LCD_5110_SOLUTION_H_
#define LCD_5110_SOLUTION_H_
#include "main.h"


//#include<unistd.h>
//#include"system.h"
//#include"altera_avalon_pio_regs.h"
#include"alt_types.h"
#include"Font6_8.h"
#include"Icon10_8.h"
#include"Font8_16.h"
#include"Font16_16.h"
#include"Bitmap.h"

/*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 //浅灰色


extern char n5110_string[6][14];

//write a byte
void LcdWrite(alt_u8 data,alt_u8 d_c);
//initial the 5110
void InitLcd(void);
//set the position of x axis and y axis
void SetXY(alt_u8 x,alt_u8 y);
//clear screen
void LcdClearAll();
//write a char(6*8),don't need coordinates
void WriteChar(alt_u8 value);
//write a char(6*8),need coordinates
void PutChar(alt_u8 value,alt_u8 x,alt_u8 y);
//write a string(6*8),don't need coordinates
void WriteStr(char * str);
//write a string(6*8),need coordinates,auto line breaks
void PutStr(char * str,alt_u8 x,alt_u8 y);
//draw a sign(6*8),don't need coordinates
void WriteSign(char * sign);
//draw a sign(6*8),need coordinates
void DrawSign(char * sign,alt_u8 x,alt_u8 y);
//draw a sign(10*8),don't need coordinates
void WriteIcon(char * icon);
//draw a sign(10*8),need coordinates,x is between 0 and 74
void DrawIcon(char * icon,alt_u8 x,alt_u8 y);
//write a char(8*16)
void WriteChar_8_16(alt_u8 value,alt_u8 x,alt_u8 y);
//write a string(8*16),auto line breaks,x is between 0 and 76
void WriteStr_8_16(char * str,alt_u8 x,alt_u8 y);
//write a Chinese character(16*16)
void WriteHanzi(char * Hanzi,alt_u8 x,alt_u8 y);
//write a Chinese sentence(16*16),auto line breaks,x is between 0 and 58
void WriteHanziStr(char * Hanzi,alt_u8 x,alt_u8 y,alt_u8 num);
//draw a picture(84*48),don't need coordinates
void DrawPicture(char bitmap[]);
//draw a picture(width*height(a multiple of 8)),need coordinates
void DrawBitmap(char bitmap[],alt_u8 x,alt_u8 y,alt_u8 width,alt_u8 height);

void RefreshLCD ( void );
void LCD_ShowString(u16 x0, u16 y0, u8 *pcStr, u16 PenColor, u16 BackColor);
void GUI_Put(u16 x, u16 y, u8 *str,u32 PenColor, u32 BackColor);

#endif /* LCD_5110_SOLUTION_H_ */
