
/******************************************
*   画面サイズ指定用定数の定義
******************************************/
#define ENDPAGE     128		// Y方向
#define PAGEEDGE    132
#define ENDCOL      160		// X方向
#define COLEDGE     162
#define XChar		(uint8_t)(ENDCOL/12)
#define YLine       (uint8_t)(ENDPAGE/14)
               
/*******************************************
*  16ビットカラー　基本色定義
*******************************************/
#define RED         0xF800
#define GREEN		0x07E0
#define BLUE		0x001F
#define CYAN		0x07FF
#define MAGENTA     0xF81F
#define YELLOW      0xFFE0
#define BROWN		0x8000
#define ORANGE      0xFC00
#define PERPLE      0x8010
#define COBALT      0x041F
#define WHITE		0xFFFF
#define PINC        0xF53D
#define LIGHT       0xE7A6
#define BLACK		0x0000
/*****************************************
* Sitronics　ST7735S Command Set
*****************************************/
#define SWRESET     0x01
#define SLPIN		0x10
#define SLPOUT      0x11
#define PTLON		0x12
#define NORON		0x13
#define INVOFF      0x20
#define INVON		0x21
#define GAMSET      0x26
#define DISPOFF     0x28
#define DISPON      0x29
#define CASET		0x2A
#define RASET		0x2B
#define RAMWR		0x2C
#define RAMRD		0x2E
#define PTLAR		0x30
#define TEOFF		0x34
#define TEON		0x35
#define MADCTL      0x36
#define IDMOFF      0x38
#define IDMON		0x39
#define COLMOD      0x3A
#define FRMCTR1     0xB1
#define FRMCTR2     0xB2
#define FRMCTR3     0xB3
#define INVCTR      0xB4
#define DISSET5     0xB6
#define PWCTR1      0xC0
#define PWCTR2      0xC1
#define PWCTR3      0xC2
#define PWCTR4      0xC3
#define PWCTR5      0xC4
#define VMCTR1      0xC5
#define VMOFCTR     0xC7
#define WRID2		0xD1
#define WRID3		0xD2
#define PWCTR6      0xFC
#define NVCTR1      0xD9
#define NVCTR2      0xDE
#define NVCTR3      0xDF
#define GAMCTRP1	0xE0
#define GAMCTRN1	0xE1
#define EXTCTRL     0xF0
#define VCOM4L      0xFF


/*******************************************
*  関数プロトタイプ 
*******************************************/
void lcd_cmd(uint8_t cmnd);
void lcd_data(uint8_t data);
void lcd_Init(void);
void lcd_Clear(uint16_t Color);
void lcd_Pixel(int Xpos, int Ypos, uint16_t Color);
void lcd_Char(uint8_t line, uint8_t colum, uint8_t letter, uint16_t Color1, uint16_t Color2);
void lcd_Str(uint8_t line, uint8_t colum, uint8_t *s, uint16_t Color1, uint16_t Color2);
void lcd_Line(int x0, int y0, int x1, int y1, uint16_t Color);
void lcd_Circle(int x0, int y0, int r, uint16_t color);
void lcd_Image(const uint8_t *ptr, uint16_t Color1, uint16_t Color2);
void GetKanji(uint16_t kanji, uint8_t * rbuf);
void lcd_kanji(uint8_t colum, uint8_t line, const uint16_t *JIScode, uint16_t Color1, uint16_t Color2);
void GetASCII(uint8_t ASCIIcode, uint8_t *rbuf);
void lcd_ascii(int colum, int line, const uint8_t *ASCII, uint16_t Color1, uint16_t Color2);
void lcd_sChar(uint8_t colum, uint8_t line, const uint8_t letter, uint16_t Color1, uint16_t Color2);
void lcd_sStr(uint8_t colum, uint8_t line, const uint8_t *s, uint16_t Color1, uint16_t Color2);
void KanjiCode(uint8_t colum, uint8_t line, uint16_t upcode, uint16_t lowcode, uint16_t Color1, uint16_t Color2);
void Kanji_Str(uint8_t colum, uint8_t line, const uint8_t *Mesg, uint16_t Color1, uint16_t Color2);
void Delay_ms(int time);