hal_lcd.c 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164
  1. ///****************************************************************************
  2. //* Filename: hal_lcd.c
  3. //* Author: Andy https://aldsz.taobao.com
  4. //* Date: 2015-06-16
  5. //* Version: 1.0
  6. //* Description: OLED driver
  7. //****************************************************************************/
  8. //#include "hal_types.h"
  9. //#include "hal_lcd.h"
  10. //#include "OSAL.h"
  11. //#include "OnBoard.h"
  12. //#include "hal_assert.h"
  13. //#include <string.h>
  14. //
  15. //#if defined (ZTOOL_P1) || defined (ZTOOL_P2)
  16. // #include "DebugTrace.h"
  17. //#endif
  18. //
  19. //
  20. ////------------------------------------------------------------------------------
  21. //#define LCD_COMMAND 0x00
  22. //#define LCD_DATA 0x01
  23. //
  24. //#define LCD_MAX_BUF 25
  25. //
  26. //#define SOFTWARE_SPI
  27. ////#define HARDWARE_SPI //采用硬件SPI通讯
  28. //
  29. //#define COL_SPACE 2 //字符间距
  30. //#define ROW_SPACE 4 //行间距
  31. //#define ALL_CNS 128
  32. //#define X_MAX_PIXEL 128
  33. //#define Y_MAX_PIXEL 128
  34. //
  35. //// SPI TFT LCD端口定义
  36. //#define LCD_DC P0_0 // 数据/命令选择
  37. //#define LCD_SDA P1_3 // 双向数据
  38. //#define LCD_SCL P1_2 // 时钟
  39. ////#define LCD_CS P1_2 // 片选, L_S 将片选接地
  40. //#define LCD_RST P1_7 // 控制lcd复位
  41. //
  42. ////液晶控制口置1操作语句宏定义
  43. ////#define LCD_CS_SET (LCD_CS_CLRx01)
  44. //#define LCD_DC_SET (LCD_DC = 0x01)
  45. //#define LCD_SDA_SET (LCD_SDA = 0x01)
  46. //#define LCD_SCL_SET (LCD_SCL = 0x01)
  47. //#define LCD_RST_SET (LCD_RST = 0x01)
  48. //
  49. ////液晶控制口置0操作语句宏定义
  50. ////#define LCD_CS_CLR (LCD_CS_CLRx00)
  51. //#define LCD_DC_CLR (LCD_DC = 0x00)
  52. //#define LCD_SDA_CLR (LCD_SDA = 0x00)
  53. //#define LCD_SCL_CLR (LCD_SCL = 0x00)
  54. //#define LCD_RST_CLR (LCD_RST = 0x00)
  55. //
  56. //
  57. //void SPI_Init(void);
  58. //void LCD_clear(unsigned int color);
  59. //void LCD_write_EN_string(unsigned char X,unsigned char Y,uint8 *s);
  60. //static void LCD_set_window(unsigned int X, unsigned int Y,
  61. // unsigned Width,unsigned int Height);
  62. //static void LCD_write_EN(unsigned int X, unsigned int Y, unsigned char c);
  63. //static void LCD_write_CN(unsigned int X, unsigned int Y, unsigned char c);
  64. //
  65. //unsigned int Color = BLUE; //默认前景颜色
  66. //unsigned int Color_BK = GREEN;//默认背景颜色
  67. ////------------------------------------------------------------------------------
  68. //
  69. //#define XLevelL 0x00
  70. //#define XLevelH 0x10
  71. //#define XLevel ((XLevelH&0x0F)*16+XLevelL)
  72. //#define Max_Column 128
  73. //#define Max_Row 64
  74. //#define Brightness 0xCF
  75. //#define X_WIDTH 128
  76. //#define Y_WIDTH 64
  77. //
  78. //#define LCD_MAX_BUF 25
  79. //#define HAL_LCD_MAX_CHARS 16 // Max number of chars on a single LCD line
  80. //
  81. //
  82. //#if (HAL_LCD == TRUE)
  83. //void HalLcd_HW_Init(void);
  84. //void HalLcd_HW_WaitUs(uint16 i);
  85. //void HalLcd_HW_Clear(void);
  86. //void HalLcd_HW_Control(uint8 cmd);
  87. //void HalLcd_HW_Write(uint8 data);
  88. //void HalLcd_HW_SetContrast(uint8 value);
  89. //void HalLcd_HW_WriteChar(uint8 line, uint8 col, char text);
  90. //void HalLcd_HW_WriteLine(uint8 line, const char *pText);
  91. //
  92. //void DelayMS(unsigned int msec);
  93. //void LCD_WrDat(unsigned char dat);
  94. //void LCD_WrCmd(unsigned char cmd);
  95. //void LCD_Set_Pos(unsigned char x, unsigned char y);
  96. //void LCD_Fill(unsigned char bmp_dat) ;
  97. //void LCD_CLS(void);
  98. //
  99. ////-----------------------------------------------------------------------------
  100. //void DrawRect(unsigned int Xpos, unsigned int Ypos, unsigned int Width,
  101. // unsigned int Height,unsigned Color);
  102. //void DrawRectFill(unsigned int Xpos , unsigned int Ypos, unsigned int Width,
  103. // unsigned int Height, unsigned Color);
  104. //void SendByte(unsigned char Data);
  105. //void SPI_WriteData(unsigned char Data);
  106. //void LCD_write_byte(unsigned char data, unsigned char command);
  107. //void LCD_WriteData_16Bit(unsigned short Data);
  108. //void LCD_write_CN_string(unsigned char X,unsigned char Y,uint8 *s);
  109. //void ShowImage(const unsigned char *p);
  110. //
  111. //void DrawPixel(unsigned int x, unsigned int y, unsigned int color);
  112. //void DrawVerticalLine(unsigned int x, unsigned int y,
  113. // unsigned int Length,unsigned int Color);
  114. //void DrawHorizonLine(unsigned int x, unsigned int y,
  115. // unsigned int Length,unsigned int Color);
  116. //void Lcd_Reset(void);
  117. //
  118. //
  119. ////中文14x14点阵字符索引 ALD
  120. //__code const unsigned char CN14x14_Index[] =
  121. //{
  122. // "科技用户登录帐号密码确定取消专业专注无线通讯诚信立足创新致远强大原:"
  123. //};
  124. //
  125. ////中文14x14点阵字符 ald
  126. // const unsigned char CN14x14[][28] =
  127. //{
  128. //0x00,0x20,0x0D,0x20,0x70,0xA0,0x10,0xA0,0x12,0x20,0xFD,0x20,0x11,0x20,0x30,0x38,
  129. //0x3B,0xE0,0x54,0x20,0x90,0x20,0x10,0x20,0x10,0x20,0x10,0x20,/*"科",6*/
  130. //
  131. //0x20,0x80,0x20,0x80,0x20,0x80,0xF7,0xF0,0x20,0x80,0x20,0x80,0x27,0xE0,0x32,0x20,
  132. //0xE2,0x20,0x21,0x40,0x20,0x80,0x21,0x40,0x22,0x20,0xEC,0x18,/*"技",7*/
  133. //
  134. //0x00,0x00,0x3F,0xF8,0x21,0x08,0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,0x21,0x08,
  135. //0x3F,0xF8,0x21,0x08,0x21,0x08,0x41,0x08,0x41,0x08,0x80,0x38,/*"用",8*/
  136. //
  137. //0x02,0x00,0x01,0x00,0x3F,0xF8,0x20,0x08,0x20,0x08,0x20,0x08,0x3F,0xF8,0x20,0x08,
  138. //0x20,0x00,0x20,0x00,0x20,0x00,0x40,0x00,0x40,0x00,0x80,0x00,/*"户",9*/
  139. //
  140. //0x01,0x20,0x7D,0x40,0x04,0x90,0x28,0xA0,0x10,0x40,0x2F,0xA0,0x40,0x18,0x9F,0xC0,
  141. //0x10,0x40,0x10,0x40,0x1F,0xC0,0x10,0x40,0x08,0x80,0xFF,0xF8,/*"登",10*/
  142. //
  143. //0x00,0x00,0x7F,0xE0,0x00,0x20,0x3F,0xE0,0x00,0x20,0xFF,0xF8,0x02,0x00,0x22,0x20,
  144. //0x13,0x40,0x0A,0x80,0x12,0x40,0x22,0x20,0xC2,0x18,0x0E,0x00,/*"录",11*/
  145. //
  146. //0x21,0x00,0x21,0x10,0x21,0x10,0xF9,0x20,0xA9,0x40,0xA9,0x00,0xAB,0xF8,0xA9,0x40,
  147. //0xA9,0x40,0xA9,0x20,0xB9,0x20,0x21,0x50,0x21,0x88,0x21,0x00,/*"帐",12*/
  148. //
  149. //0x3F,0xE0,0x20,0x20,0x20,0x20,0x3F,0xE0,0x00,0x00,0x00,0x00,0xFF,0xF8,0x08,0x00,
  150. //0x10,0x00,0x3F,0xE0,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0xC0,/*"号",13*/
  151. //
  152. //0x02,0x00,0xFF,0xF8,0x80,0x08,0x04,0x40,0x52,0x90,0x51,0x08,0x92,0x28,0x0F,0xE0,
  153. //0x30,0x00,0xC2,0x00,0x22,0x20,0x22,0x20,0x3F,0xE0,0x00,0x20,/*"密",14*/
  154. //
  155. //0x00,0x00,0x07,0xE0,0xF8,0x20,0x22,0x20,0x22,0x20,0x42,0x20,0x7B,0xF8,0xC8,0x08,
  156. //0x48,0x08,0x4F,0xE8,0x48,0x08,0x78,0x08,0x48,0x08,0x00,0x30,/*"码",15*/
  157. //
  158. //0x01,0x00,0x01,0xF0,0xFA,0x10,0x24,0x20,0x23,0xF8,0x42,0x48,0x7A,0x48,0xCB,0xF8,
  159. //0x4A,0x48,0x4A,0x48,0x4B,0xF8,0x7A,0x48,0x42,0x48,0x04,0x18,/*"确",16*/
  160. //
  161. //0x04,0x00,0x02,0x00,0xFF,0xF8,0x80,0x08,0x00,0x00,0x3F,0xE0,0x02,0x00,0x02,0x00,
  162. //0x22,0x00,0x23,0xE0,0x22,0x00,0x22,0x00,0x52,0x00,0x8F,0xF8,/*"定",17*/
  163. //
  164. //0x00,0x00,0xFC,0x00,0x4B,0xF0,0x49,0x10,0x79,0x10,0x49,0x10,0x49,0x10,0x78,0xA0,
  165. //0x48,0xA0,0x4E,0x40,0xF8,0x40,0x08,0xA0,0x09,0x10,0x0A,0x08,/*"取",18*/
  166. //
  167. //0x00,0x80,0x44,0x90,0x22,0xA0,0x10,0x80,0x07,0xF0,0x84,0x10,0x44,0x10,0x17,0xF0,
  168. //0x14,0x10,0x24,0x10,0x27,0xF0,0x44,0x10,0x44,0x10,0x04,0x70,/*"消",19*/
  169. //
  170. //0x02,0x00,0x02,0x00,0x7F,0xF0,0x04,0x00,0x04,0x00,0xFF,0xF8,0x08,0x00,0x10,0x00,
  171. //0x3F,0xE0,0x00,0x20,0x00,0x40,0x1C,0x80,0x03,0x00,0x00,0x80,/*"专",20*/
  172. //
  173. //0x08,0x80,0x08,0x80,0x08,0x80,0x88,0x90,0x48,0x90,0x48,0x90,0x28,0xA0,0x28,0xA0,
  174. //0x28,0xC0,0x08,0x80,0x08,0x80,0x08,0x80,0x08,0x80,0xFF,0xF8,/*"业",21*/
  175. //
  176. //0x02,0x00,0x02,0x00,0x7F,0xF0,0x04,0x00,0x04,0x00,0xFF,0xF8,0x08,0x00,0x10,0x00,
  177. //0x3F,0xE0,0x00,0x20,0x00,0x40,0x1C,0x80,0x03,0x00,0x00,0x80,/*"专",22*/
  178. //
  179. //0x01,0x00,0x40,0x80,0x20,0x00,0x17,0xF0,0x00,0x80,0x80,0x80,0x40,0x80,0x00,0x80,
  180. //0x17,0xF0,0x10,0x80,0x20,0x80,0x20,0x80,0x40,0x80,0x4F,0xF8,/*"注",23*/
  181. //
  182. //0x00,0x00,0x7F,0xF0,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0xFF,0xF8,0x05,0x00,
  183. //0x05,0x00,0x09,0x00,0x11,0x00,0x21,0x08,0x41,0x08,0x80,0xF8,/*"无",24*/
  184. //
  185. //0x20,0xA0,0x20,0x90,0x48,0x80,0x48,0xF0,0xF3,0x80,0x10,0x80,0x20,0xB8,0x43,0xC0,
  186. //0xF8,0x90,0x00,0xA0,0x00,0x48,0x18,0xA8,0xE3,0x18,0x00,0x08,/*"线",25*/
  187. //
  188. //0x47,0xF0,0x21,0x20,0x20,0xC0,0x07,0xF0,0x04,0x90,0xE4,0x90,0x27,0xF0,0x24,0x90,
  189. //0x24,0x90,0x27,0xF0,0x24,0x90,0x24,0xB0,0x50,0x00,0x8F,0xF8,/*"通",26*/
  190. //
  191. //0x40,0x00,0x2F,0xE0,0x22,0x20,0x02,0x20,0x02,0x20,0xE2,0x20,0x2F,0xE0,0x22,0x20,
  192. //0x22,0x20,0x22,0x28,0x2A,0x28,0x32,0x28,0x22,0x18,0x02,0x08,/*"讯",27*/
  193. //
  194. //0x40,0x50,0x20,0x48,0x20,0x40,0x07,0xF8,0xE4,0x40,0x24,0x48,0x27,0x48,0x25,0x50,
  195. //0x25,0x50,0x2D,0x20,0x35,0x28,0x2B,0x68,0x08,0x98,0x11,0x08,/*"诚",28*/
  196. //
  197. //0x11,0x00,0x10,0x80,0x2F,0xF8,0x20,0x00,0x67,0xF0,0xA0,0x00,0x27,0xF0,0x20,0x00,
  198. //0x27,0xF0,0x24,0x10,0x24,0x10,0x24,0x10,0x27,0xF0,0x24,0x10,/*"信",29*/
  199. //
  200. //0x04,0x00,0x02,0x00,0x00,0x00,0x7F,0xF0,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,
  201. //0x10,0x40,0x10,0x40,0x08,0x80,0x08,0x80,0x01,0x00,0xFF,0xF8,/*"立",30*/
  202. //
  203. //0x00,0x00,0x3F,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0xE0,0x02,0x00,0x02,0x00,
  204. //0x22,0x00,0x23,0xF0,0x22,0x00,0x22,0x00,0x52,0x00,0x8F,0xF8,/*"足",31*/
  205. //
  206. //0x10,0x10,0x10,0x10,0x28,0x10,0x24,0x90,0x42,0x90,0x80,0x90,0x7C,0x90,0x44,0x90,
  207. //0x44,0x90,0x44,0x90,0x58,0x10,0x42,0x10,0x42,0x10,0x3E,0x70,/*"创",32*/
  208. //
  209. //0x20,0x18,0x10,0xE0,0xFE,0x80,0x44,0x80,0x28,0x80,0xFE,0xF8,0x00,0x90,0x10,0x90,
  210. //0xFE,0x90,0x10,0x90,0x54,0x90,0x92,0x90,0x11,0x10,0x72,0x10,/*"新",33*/
  211. //
  212. //0x00,0x80,0xFE,0x80,0x10,0x80,0x24,0xF8,0x43,0x10,0xFE,0x90,0x12,0x90,0x10,0x90,
  213. //0xFE,0xA0,0x10,0xA0,0x10,0x40,0x1E,0xA0,0xF1,0x10,0x02,0x08,/*"致",34*/
  214. //
  215. //0x00,0x00,0x47,0xE0,0x20,0x00,0x20,0x00,0x00,0x00,0x0F,0xF0,0xE2,0x40,0x22,0x40,
  216. //0x22,0x40,0x22,0x48,0x24,0x48,0x28,0x38,0x50,0x00,0x8F,0xF8,/*"远",35*/
  217. //
  218. //0x00,0x00,0xF3,0xE0,0x12,0x20,0x12,0x20,0xF3,0xE0,0x80,0x80,0x87,0xF0,0x84,0x90,
  219. //0xF4,0x90,0x17,0xF0,0x10,0x80,0x10,0x90,0x1F,0xF8,0x60,0x08,/*"强",36*/
  220. //
  221. //0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0xFF,0xF8,0x02,0x00,0x05,0x00,0x05,0x00,
  222. //0x05,0x00,0x08,0x80,0x08,0x80,0x10,0x40,0x20,0x20,0xC0,0x18,/*"大",37*/
  223. //
  224. //0x3F,0xF8,0x20,0x80,0x21,0x00,0x27,0xF0,0x24,0x10,0x27,0xF0,0x24,0x10,0x27,0xF0,
  225. //0x20,0x80,0x24,0x90,0x24,0x88,0x48,0x88,0x40,0x80,0x83,0x80,/*"原",38*/
  226. //
  227. //0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x18,0x00,
  228. //0x00,0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,/*":",41*/
  229. //
  230. //};
  231. //
  232. ////英文7x14点阵字符 andy
  233. //__code const unsigned char ASCII7x14[][14] =
  234. //{
  235. //{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//" ",0//
  236. //{0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x30,0x30,0x00,0x00},//"!",1//
  237. //{0x00,0x14,0x28,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//""",2//
  238. //{0x00,0x00,0x00,0x28,0x28,0xFC,0x28,0x48,0x50,0xFC,0x50,0x50,0x00,0x00},//"#",3//
  239. //{0x00,0x00,0x10,0x38,0x54,0x54,0x30,0x18,0x14,0x54,0x54,0x38,0x10,0x00},//"$",4//
  240. //{0x00,0x00,0x00,0x44,0xA8,0xA8,0xB0,0x54,0x1A,0x2A,0x2A,0x44,0x00,0x00},//"%",5//
  241. //{0x00,0x00,0x00,0x20,0x50,0x50,0x60,0xAC,0xA8,0x98,0x92,0x7C,0x00,0x00},//"&",6//
  242. //{0x00,0x60,0x60,0x20,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//"'",7//
  243. //{0x00,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x08,0x04,0x00},//"(",8//
  244. //{0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00,0x00},//">",9//
  245. //{0x00,0x00,0x00,0x10,0x10,0xD6,0x38,0x38,0xD6,0x10,0x10,0x00,0x00,0x00},//"*",10//
  246. //{0x00,0x00,0x00,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x00,0x00,0x00,0x00},//"+",11//
  247. //{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x20,0xC0},//",",12//
  248. //{0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//"-",13//
  249. //{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00},//".",14//
  250. //{0x00,0x02,0x04,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x40,0x00},//"/",15//
  251. //{0x00,0x00,0x00,0x30,0x48,0x84,0x84,0x84,0x84,0x84,0x48,0x30,0x00,0x00},//"0",16//
  252. //{0x00,0x00,0x00,0x10,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00},//"1",17//
  253. //{0x00,0x00,0x00,0x38,0x44,0x44,0x04,0x08,0x10,0x20,0x44,0x7C,0x00,0x00},//"2",18//
  254. //{0x00,0x00,0x00,0x38,0x44,0x44,0x18,0x04,0x04,0x44,0x44,0x38,0x00,0x00},//"3",19//
  255. //{0x00,0x00,0x08,0x08,0x18,0x28,0x48,0x48,0x88,0x7C,0x08,0x1C,0x00,0x00},//"4",20//
  256. //{0x00,0x00,0x00,0x7C,0x40,0x40,0x78,0x44,0x04,0x44,0x44,0x38,0x00,0x00},//"5",21//
  257. //{0x00,0x00,0x00,0x3C,0x44,0x80,0xB8,0xC4,0x84,0x84,0x84,0x78,0x00,0x00},//"6",22//
  258. //{0x00,0x00,0x00,0x7C,0x44,0x48,0x08,0x10,0x10,0x10,0x10,0x10,0x00,0x00},//"7",23//
  259. //{0x00,0x00,0x00,0x78,0x84,0x84,0x48,0x78,0x84,0x84,0x84,0x78,0x00,0x00},//"8",24//
  260. //{0x00,0x00,0x00,0x78,0x84,0x84,0x84,0x8C,0x74,0x04,0x88,0xF0,0x00,0x00},//"9",25//
  261. //{0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x00},//":",26//
  262. //{0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x10,0x10,0x20},//";",27//
  263. //{0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00,0x00},//"<",28//
  264. //{0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00},//"=",29//
  265. //{0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00,0x00},//">",30//
  266. //{0x00,0x00,0x78,0x84,0x84,0x84,0x08,0x10,0x10,0x00,0x30,0x30,0x00,0x00},//"?",31//
  267. //{0x00,0x00,0x00,0x38,0x44,0x9A,0xAA,0xAA,0xAA,0xB4,0x42,0x3C,0x00,0x00},//"@",32//
  268. //{0x00,0x00,0x00,0x10,0x10,0x28,0x28,0x28,0x38,0x44,0x44,0xEE,0x00,0x00},//"A",33//
  269. //{0x00,0x00,0x00,0xF8,0x44,0x44,0x78,0x44,0x44,0x44,0x44,0xF8,0x00,0x00},//"B",34//
  270. //{0x00,0x00,0x00,0x3C,0x44,0x84,0x80,0x80,0x80,0x80,0x44,0x38,0x00,0x00},//"C",35//
  271. //{0x00,0x00,0x00,0xF0,0x48,0x44,0x44,0x44,0x44,0x44,0x48,0xF0,0x00,0x00},//"D",36//
  272. //{0x00,0x00,0x00,0xFC,0x44,0x40,0x48,0x78,0x48,0x40,0x44,0xFC,0x00,0x00},//"E",37//
  273. //{0x00,0x00,0x00,0xFC,0x42,0x40,0x48,0x78,0x48,0x40,0x40,0xE0,0x00,0x00},//"F",38//
  274. //{0x00,0x00,0x00,0x3C,0x44,0x84,0x80,0x80,0x8E,0x84,0x44,0x38,0x00,0x00},//"G",39//
  275. //{0x00,0x00,0x00,0xEE,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0xEE,0x00,0x00},//"H",40//
  276. //{0x00,0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00},//"I",41//
  277. //{0x00,0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0xE0},//"J",42//
  278. //{0x00,0x00,0x00,0xEE,0x44,0x48,0x50,0x70,0x48,0x48,0x44,0xEE,0x00,0x00},//"K",43//
  279. //{0x00,0x00,0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x44,0xFC,0x00,0x00},//"L",44//
  280. //{0x00,0x00,0x00,0xEE,0x6C,0x6C,0x6C,0x54,0x54,0x54,0x54,0xD6,0x00,0x00},//"M",45//
  281. //{0x00,0x00,0x00,0xEE,0x64,0x64,0x54,0x54,0x54,0x4C,0x4C,0xE4,0x00,0x00},//"N",46//
  282. //{0x00,0x00,0x00,0x30,0x48,0x84,0x84,0x84,0x84,0x84,0x48,0x30,0x00,0x00},//"O",47//
  283. //{0x00,0x00,0x00,0xF8,0x44,0x44,0x44,0x78,0x40,0x40,0x40,0xE0,0x00,0x00},//"P",48//
  284. //{0x00,0x00,0x00,0x30,0x48,0x84,0x84,0x84,0x84,0xB4,0x48,0x38,0x0C,0x00},//"Q",49//
  285. //{0x00,0x00,0x00,0xF8,0x44,0x44,0x78,0x50,0x48,0x48,0x44,0xE6,0x00,0x00},//"R",50//
  286. //{0x00,0x00,0x00,0x3C,0x44,0x40,0x20,0x18,0x04,0x04,0x44,0x78,0x00,0x00},//"S",51//
  287. //{0x00,0x00,0x00,0xFE,0x92,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00},//"T",52//
  288. //{0x00,0x00,0x00,0xEE,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x38,0x00,0x00},//"U",53//
  289. //{0x00,0x00,0x00,0xEE,0x44,0x44,0x28,0x28,0x28,0x28,0x10,0x10,0x00,0x00},//"V",54//
  290. //{0x00,0x00,0x00,0xD6,0x54,0x54,0x54,0x54,0x6C,0x28,0x28,0x28,0x00,0x00},//"W",55//
  291. //{0x00,0x00,0x00,0xEE,0x44,0x28,0x28,0x10,0x28,0x28,0x44,0xEE,0x00,0x00},//"X",56//
  292. //{0x00,0x00,0x00,0xEE,0x44,0x28,0x28,0x10,0x10,0x10,0x10,0x38,0x00,0x00},//"Y",57//
  293. //{0x00,0x00,0x00,0x7C,0x88,0x08,0x10,0x20,0x20,0x40,0x44,0xFC,0x00,0x00},//"Z",58//
  294. //{0x00,0x1C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1C,0x00},//"[",59//
  295. //{0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00},//"]",60//
  296. //{0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00},//"]",61//
  297. //{0x00,0x10,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//"^",62//
  298. //{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE},//"_",63//
  299. //{0x00,0x60,0x60,0x20,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},//"'",64//
  300. //{0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x1C,0x24,0x44,0x3E,0x00,0x00},//"a",65//
  301. //{0x00,0x00,0x00,0xC0,0x40,0x40,0x78,0x44,0x44,0x44,0x44,0x78,0x00,0x00},//"b",66//
  302. //{0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x44,0x40,0x40,0x44,0x38,0x00,0x00},//"c",67//
  303. //{0x00,0x00,0x00,0x0C,0x04,0x04,0x3C,0x44,0x44,0x44,0x44,0x3E,0x00,0x00},//"d",68//
  304. //{0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x7C,0x40,0x44,0x38,0x00,0x00},//"e",69//
  305. //{0x00,0x00,0x00,0x1C,0x24,0x20,0xF8,0x20,0x20,0x20,0x20,0x78,0x00,0x00},//"f",70//
  306. //{0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x48,0x48,0x30,0x40,0x78,0x44,0x38},//"g",71//
  307. //{0x00,0x00,0x00,0xC0,0x40,0x40,0x58,0x64,0x44,0x44,0x44,0xEE,0x00,0x00},//"h",72//
  308. //{0x00,0x00,0x00,0x10,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x7C,0x00,0x00},//"i",73//
  309. //{0x00,0x00,0x00,0x08,0x00,0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x70},//"j",74//
  310. //{0x00,0x00,0x00,0xC0,0x40,0x40,0x5C,0x48,0x50,0x70,0x48,0xEC,0x00,0x00},//"k",75//
  311. //{0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00},//"l",76//
  312. //{0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x54,0x54,0x54,0x54,0xD6,0x00,0x00},//"m",77//
  313. //{0x00,0x00,0x00,0x00,0x00,0x00,0xD8,0x64,0x44,0x44,0x44,0xEE,0x00,0x00},//"n",78//
  314. //{0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x44,0x38,0x00,0x00},//"o",79//
  315. //{0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x44,0x44,0x44,0x44,0x78,0x40,0xE0},//"p",80//
  316. //{0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x44,0x44,0x44,0x44,0x3C,0x04,0x0E},//"q",81//
  317. //{0x00,0x00,0x00,0x00,0x00,0x00,0xEC,0x30,0x20,0x20,0x20,0xF8,0x00,0x00},//"r",82//
  318. //{0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x44,0x30,0x08,0x44,0x78,0x00,0x00},//"s",83//
  319. //{0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x10,0x10,0x0C,0x00,0x00},//"t",84//
  320. //{0x00,0x00,0x00,0x00,0x00,0x00,0xCC,0x44,0x44,0x44,0x44,0x3E,0x00,0x00},//"u",85//
  321. //{0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0x44,0x28,0x28,0x28,0x10,0x00,0x00},//"v",86//
  322. //{0x00,0x00,0x00,0x00,0x00,0x00,0xD6,0x54,0x54,0x54,0x28,0x28,0x00,0x00},//"w",87//
  323. //{0x00,0x00,0x00,0x00,0x00,0x00,0xDC,0x48,0x30,0x30,0x48,0xEC,0x00,0x00},//"x",88//
  324. //{0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0x44,0x28,0x28,0x10,0x10,0x20,0xE0},//"y",89//
  325. //{0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x48,0x10,0x10,0x24,0x7C,0x00,0x00},//"z",90//
  326. //{0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10},//"|",91//
  327. //};
  328. ////-----------------------------------------------------------------------------
  329. //#endif //LCD
  330. //
  331. //
  332. ///**************************************************************************************************
  333. // * @fn HalLcdInit
  334. // *
  335. // * @brief Initilize LCD Service
  336. // *
  337. // * @param init - pointer to void that contains the initialized value
  338. // *
  339. // * @return None
  340. // **************************************************************************************************/
  341. //void HalLcdInit(void)
  342. //{
  343. //#if (HAL_LCD == TRUE)
  344. // HalLcd_HW_Init();
  345. //#endif
  346. //}
  347. //
  348. ///**************************************************************************************************
  349. // * @fn HalLcdWriteValue
  350. // *
  351. // * @brief Write a value to the LCD
  352. // *
  353. // * @param value - value that will be displayed
  354. // * radix - 8, 10, 16
  355. // * option - display options
  356. // *
  357. // * @return None
  358. // **************************************************************************************************/
  359. //void HalLcdWriteValue ( uint32 value, const uint8 radix, uint8 option)
  360. //{
  361. //#if (HAL_LCD == TRUE)
  362. // uint8 buf[LCD_MAX_BUF];
  363. //
  364. // _ltoa( value, &buf[0], radix );
  365. // HalLcdWriteString( (char*)buf, option );
  366. //#endif
  367. //}
  368. //
  369. ///**************************************************************************************************
  370. // * @fn HalLcdWriteScreen
  371. // *
  372. // * @brief Write a value to the LCD
  373. // *
  374. // * @param line1 - string that will be displayed on line 1
  375. // * line2 - string that will be displayed on line 2
  376. // *
  377. // * @return None
  378. // **************************************************************************************************/
  379. //void HalLcdWriteScreen( char *line1, char *line2 )
  380. //{
  381. //#if (HAL_LCD == TRUE)
  382. // HalLcdWriteString( line1, 0 );//andy
  383. // HalLcdWriteString( line2, 1 );
  384. //#endif
  385. //}
  386. //
  387. ///**************************************************************************************************
  388. // * @fn HalLcdWriteStringValue
  389. // *
  390. // * @brief Write a string followed by a value to the LCD
  391. // *
  392. // * @param title - Title that will be displayed before the value
  393. // * value - value
  394. // * format - redix
  395. // * line - line number
  396. // *
  397. // * @return None
  398. // **************************************************************************************************/
  399. //void HalLcdWriteStringValue( char *title, uint16 value, uint8 format, uint8 line )
  400. //{
  401. //#if (HAL_LCD == TRUE)
  402. // uint8 tmpLen;
  403. // uint8 buf[LCD_MAX_BUF];
  404. // uint32 err;
  405. //
  406. // tmpLen = (uint8)osal_strlen( (char*)title );
  407. // osal_memcpy( buf, title, tmpLen );
  408. // //buf[tmpLen] = ' ';
  409. // err = (uint32)(value);
  410. // _ltoa( err, &buf[tmpLen], format );
  411. // HalLcdWriteString( (char*)buf, line );
  412. //#endif
  413. //}
  414. //
  415. ///**************************************************************************************************
  416. // * @fn HalLcdWriteStringValue
  417. // *
  418. // * @brief Write a string followed by a value to the LCD
  419. // *
  420. // * @param title - Title that will be displayed before the value
  421. // * value1 - value #1
  422. // * format1 - redix of value #1
  423. // * value2 - value #2
  424. // * format2 - redix of value #2
  425. // * line - line number
  426. // *
  427. // * @return None
  428. // **************************************************************************************************/
  429. //void HalLcdWriteStringValueValue( char *title, uint16 value1, uint8 format1,
  430. // uint16 value2, uint8 format2, uint8 line )
  431. //{
  432. //#if (HAL_LCD == TRUE)
  433. //
  434. // uint8 tmpLen;
  435. // uint8 buf[LCD_MAX_BUF];
  436. // uint32 err;
  437. //
  438. // tmpLen = (uint8)osal_strlen( (char*)title );
  439. // if ( tmpLen )
  440. // {
  441. // osal_memcpy( buf, title, tmpLen );
  442. // //buf[tmpLen++] = ' ';
  443. // }
  444. //
  445. // err = (uint32)(value1);
  446. // _ltoa( err, &buf[tmpLen], format1 );
  447. // tmpLen = (uint8)osal_strlen( (char*)buf );
  448. //
  449. // buf[tmpLen++] = ',';
  450. // buf[tmpLen++] = ' ';
  451. // err = (uint32)(value2);
  452. // _ltoa( err, &buf[tmpLen], format2 );
  453. //
  454. // HalLcdWriteString( (char *)buf, line );
  455. //
  456. //#endif
  457. //}
  458. //
  459. //#if (HAL_LCD == TRUE)
  460. //void DelayMS(unsigned int msec)
  461. //{
  462. // unsigned int i;
  463. // while(msec >0)
  464. // {
  465. // for (i=0; i<8000; i++) asm("NOP"); //1ms
  466. // msec--;
  467. // }
  468. //}
  469. //
  470. ////option 1=第1行 2=第2行 其它类推
  471. //void HalLcdWriteString (char *s, uint8 option)
  472. //{
  473. // Color = BLUE;
  474. // Color_BK = WHITE;
  475. // DrawRectFill(7,option*15+20,118,15,WHITE);
  476. // LCD_write_EN_string(7,option*15+20,(unsigned char *)s);
  477. //}
  478. //
  479. ////向SPI总线传输一个8位数据
  480. //void SendByte(unsigned char Data)
  481. //{
  482. // unsigned char i=0;
  483. //
  484. // for(i=8;i>0;i--)
  485. // {
  486. // if(Data&0x80)
  487. // LCD_SDA_SET;//输出数据
  488. // else
  489. // LCD_SDA_CLR;
  490. //
  491. // LCD_SCL_CLR;
  492. // LCD_SCL_SET;
  493. // Data<<=1;
  494. // }
  495. //}
  496. //
  497. ////向SPI总线传输一个8位数据
  498. //void SPI_WriteData(unsigned char Data)
  499. //{
  500. // unsigned char i=0;
  501. //
  502. // for(i=8;i>0;i--)
  503. // {
  504. // if(Data&0x80)
  505. // LCD_SDA_SET;//输出数据
  506. // else
  507. // LCD_SDA_CLR;
  508. //
  509. // LCD_SCL_CLR;
  510. // LCD_SCL_SET;
  511. // Data<<=1;
  512. // }
  513. //}
  514. //
  515. ////向液晶屏写一个8位指令
  516. //void LCD_WrCmd(unsigned char Index)
  517. //{
  518. // //LCD_CS_CLR; //ALD del SPI写命令时序开始
  519. // LCD_DC_CLR;
  520. // SPI_WriteData(Index);
  521. // //LCD_CS_SET; //ALD del
  522. //}
  523. //
  524. ////向液晶屏写一个8位数据
  525. //void LCD_WrDat(unsigned char Data)
  526. //{
  527. // //LCD_CS_CLR; //ALD del
  528. // LCD_DC_SET;
  529. // SPI_WriteData(Data);
  530. // //LCD_CS_SET; //ALD del
  531. //}
  532. //
  533. ////向液晶屏写一个16位数据
  534. //void LCD_WriteData_16Bit(unsigned short Data)
  535. //{
  536. // //LCD_CS_CLR; //ALD del
  537. // LCD_DC_SET;
  538. // SPI_WriteData(Data>>8); //写入高8位数据
  539. // SPI_WriteData(Data); //写入低8位数据
  540. // //LCD_CS_SET; //ALD del
  541. //}
  542. //
  543. ///****************************************************************************
  544. //* 名 称: LCD_write_byte()
  545. //* 功 能: 数据到LCD
  546. //* 入口参数: data —写入的数据
  547. //* command —写数据/命令选择
  548. //* 出口参数: 无
  549. //****************************************************************************/
  550. //static void LCD_write_byte(unsigned char data, unsigned char command)
  551. //{
  552. // ////LCD_CS_CLR ;// 使能LCD
  553. // if (command == 0)
  554. // LCD_WrCmd(data); // 传送命令
  555. // else
  556. // LCD_WrDat(data) ; // 传送数据
  557. // //SendByte(data);
  558. // //LCD_CS_SET; // 关闭LCD
  559. // //LCD_DC_SET;
  560. //}
  561. //
  562. //// 复位lcd
  563. //void Lcd_Reset(void)
  564. //{
  565. // LCD_RST_CLR;
  566. // DelayMS(110);
  567. // LCD_RST_SET;
  568. // DelayMS(50);
  569. //}
  570. //
  571. ///****************************************************************************
  572. //* 名 称: LCD_set_window()
  573. //* 功 能: 设置显示窗口
  574. //* 入口参数: X - 显示窗口左上角横坐标 Y —显示窗口左上角纵坐标
  575. //* Width —显示窗口宽度 Height —显示窗口高度
  576. //* 出口参数: 无
  577. //****************************************************************************/
  578. //static void LCD_set_window(unsigned int X , unsigned int Y,
  579. // unsigned int Width, unsigned int Height)
  580. //{
  581. // LCD_write_byte(0x2A,LCD_COMMAND); //列地址设置命令
  582. // LCD_write_byte(X>>8,LCD_DATA) ; //设置显示窗口左上角横坐标高位
  583. // LCD_write_byte((X+2)&0xFF,LCD_DATA); //设置显示窗口左上角横坐标低位
  584. // LCD_write_byte((X+Width+1)>>8,LCD_DATA); //设置宽度高位
  585. // LCD_write_byte((X+Width+1)&0xFF,LCD_DATA);// 设置宽度低位
  586. //
  587. // LCD_write_byte(0x2B,LCD_COMMAND); //行地址设置命令
  588. // LCD_write_byte(Y>>8,LCD_DATA) ; //设置显示窗口左上角纵坐标高位
  589. // LCD_write_byte((Y+3)&0xFF,LCD_DATA); //设置显示窗口左上角纵坐标低位
  590. // LCD_write_byte((Y+Height+2)>>8,LCD_DATA); // 设置显示窗口高度高位
  591. // LCD_write_byte((Y+Height+2)&0xFF,LCD_DATA);// 设置显示窗口高度低位
  592. // LCD_write_byte(0x2C,LCD_COMMAND) ;
  593. //}
  594. //
  595. ///****************************************************************************
  596. //* 名 称: DrawPixel()
  597. //* 功 能: 在指定位置以指定颜色显示像素
  598. //****************************************************************************/
  599. //void DrawPixel(unsigned int x, unsigned int y, unsigned int color)
  600. //{
  601. // //LCD_set_XY(x,y); //设定显示位置 andy
  602. // LCD_write_byte(color>>8,LCD_DATA); //发送显示颜色数据高位字节
  603. // LCD_write_byte(color&0xFF,LCD_DATA);//发送显示颜色数据低位字节
  604. //}
  605. //
  606. ///****************************************************************************
  607. //* 名 称: DrawVerticalLine()
  608. //* 功 能: 在指定位置以指定颜色画垂直线
  609. //* 入口参数: X - 垂直线起始位置横坐标 Y —垂直线起始位置纵坐标
  610. //* Length —垂直线长度 Color —垂直线颜色
  611. //* 出口参数: 无
  612. //****************************************************************************/
  613. //void DrawVerticalLine(unsigned int x, unsigned int y,
  614. // unsigned int Length,unsigned int Color)
  615. //{
  616. // register int index = 0;
  617. // register char ch,cl;
  618. //
  619. // ch = (unsigned char)(Color>>8);
  620. // cl = (unsigned char)(Color);
  621. // LCD_set_window(x,y,1,Length);
  622. // for(index=0;index<Length;index++)
  623. // {
  624. // LCD_write_byte(ch,LCD_DATA) ;
  625. // LCD_write_byte(cl,LCD_DATA) ;
  626. // }
  627. //}
  628. //
  629. ///****************************************************************************
  630. //* 名 称: DrawHorizonLine()
  631. //* 功 能: 在指定位置以指定颜色画水平线
  632. //* 入口参数: X - 水平线起始位置横坐标 Y —水平线起始位置纵坐标
  633. //* Length —水平线长度 Color —水平线颜色
  634. //* 出口参数: 无
  635. //****************************************************************************/
  636. //void DrawHorizonLine(unsigned int x, unsigned int y,
  637. // unsigned int Length,unsigned int Color)
  638. //{
  639. // register int index = 0;
  640. // register char ch,cl;
  641. //
  642. // ch = (unsigned char)(Color>>8);
  643. // cl = (unsigned char)(Color);
  644. // LCD_set_window(x,y,Length,1);
  645. // for(index=0;index<Length;index++)
  646. // {
  647. // LCD_write_byte(ch,LCD_DATA);
  648. // LCD_write_byte(cl,LCD_DATA);
  649. // }
  650. //}
  651. //
  652. ///****************************************************************************
  653. //* 名 称: DrawRect()
  654. //* 功 能: 在指定位置以指定颜色画矩形
  655. //* 入口参数: X - 矩形起始位置横坐标 Y —矩形起始位置纵坐标
  656. //* Width —矩形宽度 Height —矩形高度
  657. //* Color —矩形颜色
  658. //* 出口参数: 无
  659. //****************************************************************************/
  660. //void DrawRect(unsigned int Xpos, unsigned int Ypos, unsigned int Width,
  661. // unsigned int Height,unsigned Color)
  662. //{
  663. // DrawHorizonLine(Xpos, Ypos, Width, Color) ;
  664. // DrawHorizonLine(Xpos, (Ypos + Height), Width, Color) ;
  665. // DrawVerticalLine(Xpos, Ypos, Height, Color) ;
  666. // DrawVerticalLine((Xpos+Width-1) ,Ypos, Height, Color);
  667. //}
  668. //
  669. ///****************************************************************************
  670. //* 名 称: DrawRectFill()
  671. //* 功 能: 在指定位置以指定颜色画矩形
  672. //* 入口参数: X - 矩形起始位置横坐标 Y —矩形起始位置纵坐标
  673. //* Width —矩形宽度 Height —矩形高度
  674. //* Color —矩形填充颜色
  675. //* 出口参数: 无
  676. //****************************************************************************/
  677. //void DrawRectFill(unsigned int Xpos , unsigned int Ypos, unsigned int Width,
  678. // unsigned int Height, unsigned Color )
  679. //{
  680. // register unsigned int i;
  681. // register unsigned int index = Width*Height/16+1;
  682. // register char ch,cl;
  683. //
  684. // ch = (unsigned char)(Color>>8);
  685. // cl = (unsigned char)(Color);
  686. // LCD_set_window(Xpos,Ypos,Width,Height);
  687. // LCD_write_byte(0x2C,LCD_COMMAND);
  688. // //LCD_CS_CLR ; andy
  689. // LCD_DC_SET ;
  690. // for(i=0;i<index;i++)
  691. // {
  692. // SendByte(ch);
  693. // SendByte(cl);
  694. // SendByte(ch);
  695. // SendByte(cl);
  696. // SendByte(ch);
  697. // SendByte(cl);
  698. // SendByte(ch);
  699. // SendByte(cl);
  700. // SendByte(ch);
  701. // SendByte(cl);
  702. // SendByte(ch);
  703. // SendByte(cl);
  704. // SendByte(ch);
  705. // SendByte(cl);
  706. // SendByte(ch);
  707. // SendByte(cl);
  708. // SendByte(ch);
  709. // SendByte(cl);
  710. // SendByte(ch);
  711. // SendByte(cl);
  712. // SendByte(ch);
  713. // SendByte(cl);
  714. // SendByte(ch);
  715. // SendByte(cl);
  716. // SendByte(ch);
  717. // SendByte(cl);
  718. // SendByte(ch);
  719. // SendByte(cl);
  720. // SendByte(ch);
  721. // SendByte(cl);
  722. // SendByte(ch);
  723. // SendByte(cl);
  724. // }
  725. //}
  726. //
  727. ///****************************************************************************
  728. //* 名 称: LCD_clear()
  729. //* 功 能: 以指定颜色清屏
  730. //* 入口参数: color —清屏颜色
  731. //* 出口参数: 无
  732. //****************************************************************************/
  733. //void LCD_clear(unsigned int color)
  734. //{
  735. // register unsigned int i=0,j=0;
  736. // register unsigned char ch;
  737. // register unsigned char cl;
  738. //
  739. // LCD_set_window(0,0,X_MAX_PIXEL,Y_MAX_PIXEL);
  740. // ch = color>>8;
  741. // cl = color&0xFF;
  742. // LCD_write_byte(0x2C,LCD_COMMAND);
  743. // //LCD_CS_CLR;
  744. // LCD_DC_SET;
  745. // for (i=0;i<Y_MAX_PIXEL;i++)
  746. // for (j=0;j<2;j++)
  747. // {
  748. // SendByte(ch);
  749. // SendByte(cl);
  750. // SendByte(ch);
  751. // SendByte(cl);
  752. // SendByte(ch);
  753. // SendByte(cl);
  754. // SendByte(ch);
  755. // SendByte(cl);
  756. // SendByte(ch);
  757. // SendByte(cl);
  758. // SendByte(ch);
  759. // SendByte(cl);
  760. // SendByte(ch);
  761. // SendByte(cl);
  762. // SendByte(ch);
  763. // SendByte(cl);
  764. // SendByte(ch);
  765. // SendByte(cl);
  766. // SendByte(ch);
  767. // SendByte(cl);
  768. // SendByte(ch);
  769. // SendByte(cl);
  770. // SendByte(ch);
  771. // SendByte(cl);
  772. // SendByte(ch);
  773. // SendByte(cl);
  774. // SendByte(ch);
  775. // SendByte(cl);
  776. // SendByte(ch);
  777. // SendByte(cl);
  778. // SendByte(ch);
  779. // SendByte(cl);
  780. // SendByte(ch);
  781. // SendByte(cl);
  782. // SendByte(ch);
  783. // SendByte(cl);
  784. // SendByte(ch);
  785. // SendByte(cl);
  786. // SendByte(ch);
  787. // SendByte(cl);
  788. // SendByte(ch);
  789. // SendByte(cl);
  790. // SendByte(ch);
  791. // SendByte(cl);
  792. // SendByte(ch);
  793. // SendByte(cl);
  794. // SendByte(ch);
  795. // SendByte(cl);
  796. // SendByte(ch);
  797. // SendByte(cl);
  798. // SendByte(ch);
  799. // SendByte(cl);
  800. // SendByte(ch);
  801. // SendByte(cl);
  802. // SendByte(ch);
  803. // SendByte(cl);
  804. // SendByte(ch);
  805. // SendByte(cl);
  806. // SendByte(ch);
  807. // SendByte(cl);
  808. // SendByte(ch);
  809. // SendByte(cl);
  810. // SendByte(ch);
  811. // SendByte(cl);
  812. // SendByte(ch);
  813. // SendByte(cl);
  814. // SendByte(ch);
  815. // SendByte(cl);
  816. // SendByte(ch);
  817. // SendByte(cl);
  818. // SendByte(ch);
  819. // SendByte(cl);
  820. // SendByte(ch);
  821. // SendByte(cl);
  822. // SendByte(ch);
  823. // SendByte(cl);
  824. // SendByte(ch);
  825. // SendByte(cl);
  826. // SendByte(ch);
  827. // SendByte(cl);
  828. // SendByte(ch);
  829. // SendByte(cl);
  830. // SendByte(ch);
  831. // SendByte(cl);
  832. // SendByte(ch);
  833. // SendByte(cl);
  834. // SendByte(ch);
  835. // SendByte(cl);
  836. // SendByte(ch);
  837. // SendByte(cl);
  838. // SendByte(ch);
  839. // SendByte(cl);
  840. // SendByte(ch);
  841. // SendByte(cl);
  842. // SendByte(ch);
  843. // SendByte(cl);
  844. // SendByte(ch);
  845. // SendByte(cl);
  846. // SendByte(ch);
  847. // SendByte(cl);
  848. // SendByte(ch);
  849. // SendByte(cl);
  850. // SendByte(ch);
  851. // SendByte(cl);
  852. // SendByte(ch);
  853. // SendByte(cl);
  854. // SendByte(ch);
  855. // SendByte(cl);
  856. // SendByte(ch);
  857. // SendByte(cl);
  858. // SendByte(ch);
  859. // SendByte(cl);
  860. // SendByte(ch);
  861. // SendByte(cl);
  862. // SendByte(ch);
  863. // SendByte(cl);
  864. // SendByte(ch);
  865. // SendByte(cl);
  866. // SendByte(ch);
  867. // SendByte(cl);
  868. // SendByte(ch);
  869. // SendByte(cl);
  870. // SendByte(ch);
  871. // SendByte(cl);
  872. // SendByte(ch);
  873. // SendByte(cl);
  874. // SendByte(ch);
  875. // SendByte(cl);
  876. // }
  877. // LCD_DC_SET;
  878. // //LCD_CS_SET;
  879. //}
  880. //
  881. ///****************************************************************************
  882. //* 名 称: LCD_write_EN()
  883. //* 功 能: 在指定位置显示 7 ×14 点阵ASCII字符
  884. //* 入口参数: X - 显示位置左上角横坐标 Y —显示位置左上角纵坐标
  885. //* c —显示字符
  886. //* 出口参数: 无
  887. //****************************************************************************/
  888. //static void LCD_write_EN(unsigned int X, unsigned int Y, unsigned char c)
  889. //{
  890. // unsigned char i,j,temp;
  891. //
  892. // LCD_set_window(X,Y,7,14);
  893. // //LCD_CS_CLR ;
  894. // LCD_DC_SET ;
  895. // for(i=0;i<14;i++)
  896. // {
  897. // temp = ASCII7x14[c-32][i];
  898. // for(j=0;j<7;j++)
  899. // {
  900. // if(temp&0x80)
  901. // {
  902. // SendByte(Color>>8);
  903. // SendByte(Color) ;
  904. // }
  905. // else
  906. // {
  907. // SendByte(Color_BK>>8) ;
  908. // SendByte(Color_BK);
  909. // }
  910. // temp <<= 1 ;
  911. // }
  912. // }
  913. // //LCD_CS_SET ; andy
  914. // LCD_DC_SET ;
  915. //}
  916. //
  917. ///****************************************************************************
  918. //* 名 称: LCD_write_EN_string()
  919. //* 功 能: 在指定位置显示 7 ×14 点阵ASCII字符串
  920. //* 入口参数: X - 显示位置左上角横坐标 Y —显示位置左上角纵坐标
  921. //* s —字符串指针
  922. //* 出口参数: 无
  923. //****************************************************************************/
  924. //void LCD_write_EN_string(unsigned char X,unsigned char Y,uint8 *s)
  925. //{
  926. // unsigned char i=0;
  927. //
  928. // while (*s)
  929. // {
  930. // LCD_write_EN(X+i*7,Y,*s);
  931. // s++;
  932. // i++;
  933. // if(i>=HAL_LCD_MAX_CHARS)return;
  934. // }
  935. // return;
  936. //}
  937. //
  938. ///****************************************************************************
  939. //* 名 称: LCD_write_CN()
  940. //* 功 能: 在指定位置显示 14 ×14 点阵汉字字符
  941. //* 入口参数: X - 显示位置左上角横坐标 Y —显示位置左上角纵坐标
  942. //* c —显示字符指针
  943. //* 出口参数: 无
  944. //****************************************************************************/
  945. //static void LCD_write_CN(unsigned int X, unsigned int Y, unsigned char c)
  946. //{
  947. // unsigned char i,j,temp;
  948. //
  949. // LCD_set_window(X,Y,14,14); //按字符点阵大小设置显示窗口
  950. // //LCD_CS_CLR; //液晶SPI使能andy
  951. // LCD_DC_SET; //发送数据信号使能
  952. // for(i=0;i<28;i++) // 14x14字符点阵数据大小为2x14=28字节
  953. // {
  954. // temp = CN14x14[c][i] ; //读字模数组
  955. // for(j=0;j<8;j++) // 按位显示
  956. // {
  957. // if(temp&0x80) //如果位值为1,显示字符色
  958. // {
  959. // SendByte(Color>>8);
  960. // SendByte(Color) ;
  961. // }
  962. // else //如果位值为0,显示背景色
  963. // {
  964. // SendByte(Color_BK>>8) ;
  965. // SendByte(Color_BK);
  966. // }
  967. // temp <<= 1 ;
  968. // }
  969. // i++ ; //指向下一字节
  970. // temp = CN14x14[c][i];
  971. // for(j=0;j<6;j++) // 按位显示,点阵横向为14像素,
  972. // { // 所以每行第2字节最后2位抛弃
  973. // if(temp&0x80) // 如果位值为1,显示字符色
  974. // {
  975. // SendByte(Color>>8);
  976. // SendByte(Color) ;
  977. // }
  978. // else // 如果位值为0,显示背景色
  979. // {
  980. // SendByte(Color_BK>>8) ;
  981. // SendByte(Color_BK);
  982. // }
  983. // temp <<= 1 ;
  984. // }
  985. // }
  986. // //LCD_CS_SET; //液晶SPI禁止
  987. // LCD_DC_SET; //数据控制信号禁止
  988. //}
  989. //
  990. ///****************************************************************************
  991. //* 名 称: LCD_write_CN_string()
  992. //* 功 能: 在指定位置显示 14 ×14 点阵中文字符串
  993. //* 入口参数: X - 显示位置左上角横坐标 Y —显示位置左上角纵坐标
  994. //* s —字符串指针
  995. //* 出口参数: 无
  996. //****************************************************************************/
  997. //void LCD_write_CN_string(unsigned char X,unsigned char Y,uint8 *s)
  998. //{
  999. // unsigned char i=0;
  1000. // static unsigned char j=0;
  1001. //
  1002. // while (*s)
  1003. // {
  1004. // for(j=0;j<ALL_CNS;j++) //搜索点阵字模
  1005. // {
  1006. // if( *s ==CN14x14_Index[j*2]
  1007. // &&*(s+1)==CN14x14_Index[j*2+1]) //汉字内码存在于字模索引数组中
  1008. // {
  1009. // LCD_write_CN(X+i*14,Y,j) ; //显示汉字
  1010. // break;
  1011. // }
  1012. // }
  1013. // if(j>=ALL_CNS) //无此字的点阵字模
  1014. // {
  1015. // DrawRectFill(X+i*14,Y,14,14,Color_BK);//显示空格
  1016. // }
  1017. // s++; s++ ; //字符指针移位
  1018. // i++;
  1019. // if(i>=HAL_LCD_MAX_CHARS/2)
  1020. // return; //超过最大显示字符数,返回
  1021. // }
  1022. // return ;
  1023. //}
  1024. //
  1025. ///****************************************************************************
  1026. //* 名 称: ShowImage()
  1027. //* 功 能: 显示图片
  1028. //* 入口参数: p - 图片点阵数据 取模方式 水平扫描 从左到右 低位在前
  1029. //* 出口参数: 无
  1030. //****************************************************************************/
  1031. //void ShowImage(const unsigned char *p)
  1032. //{
  1033. // int i;
  1034. // unsigned char picH,picL;
  1035. //
  1036. // LCD_set_window(24,5,80,40); //坐标设置
  1037. // for(i=0;i<80*40;i++)
  1038. // {
  1039. // picL=*(p+i*2); //数据低位在前
  1040. // picH=*(p+i*2+1);
  1041. // LCD_WriteData_16Bit(picH<<8|picL);
  1042. // }
  1043. //}
  1044. //
  1045. ////初始化LCD
  1046. //void HalLcd_HW_Init(void)
  1047. //{
  1048. // P0SEL &= 0xFE; //设置P00为普通IO口,
  1049. // P0DIR |= 0x01; //设置P00为输出
  1050. // P1SEL &= 0x73; //设置P12,P13,P17为普通IO口
  1051. // P1DIR |= 0x8c; //设置P12,P13,P17为输出
  1052. //
  1053. // Lcd_Reset();
  1054. //
  1055. //#ifdef HARDWARE_SPI
  1056. // P1DIR &= 0x9F;
  1057. // SPI_Init(); //初始化SPI端口
  1058. //#endif
  1059. //
  1060. // LCD_write_byte(0x11,LCD_COMMAND); //退出睡眠模式
  1061. // DelayMS(1);
  1062. //
  1063. // ///ST7735R Frame Rate
  1064. // LCD_write_byte(0xB1,LCD_COMMAND);
  1065. // LCD_write_byte(0x01,LCD_DATA);
  1066. // LCD_write_byte(0x2C,LCD_DATA);
  1067. // LCD_write_byte(0x2D,LCD_DATA);
  1068. // LCD_write_byte(0xB2,LCD_COMMAND);
  1069. // LCD_write_byte(0x01,LCD_DATA);
  1070. // LCD_write_byte(0x2C,LCD_DATA);
  1071. // LCD_write_byte(0x2D,LCD_DATA);
  1072. // LCD_write_byte(0xB3,LCD_COMMAND);
  1073. // LCD_write_byte(0x01,LCD_DATA);
  1074. // LCD_write_byte(0x2C,LCD_DATA);
  1075. // LCD_write_byte(0x2D,LCD_DATA);
  1076. // LCD_write_byte(0x01,LCD_DATA);
  1077. // LCD_write_byte(0x2C,LCD_DATA);
  1078. // LCD_write_byte(0x2D,LCD_DATA);
  1079. //
  1080. // LCD_write_byte(0xB4,LCD_COMMAND);//列对调
  1081. // LCD_write_byte(0x07,LCD_DATA);
  1082. // //ST7735R加电序列
  1083. // LCD_write_byte(0xC0,LCD_COMMAND);
  1084. // LCD_write_byte(0xA2,LCD_DATA);
  1085. // LCD_write_byte(0x02,LCD_DATA);
  1086. // LCD_write_byte(0x84,LCD_DATA);
  1087. // LCD_write_byte(0xC1,LCD_COMMAND);
  1088. // LCD_write_byte(0xC5,LCD_DATA);
  1089. // LCD_write_byte(0xC2,LCD_COMMAND);
  1090. // LCD_write_byte(0x0A,LCD_DATA);
  1091. // LCD_write_byte(0x00,LCD_DATA);
  1092. // LCD_write_byte(0xC3,LCD_COMMAND);
  1093. // LCD_write_byte(0x8A,LCD_DATA);
  1094. // LCD_write_byte(0x2A,LCD_DATA);
  1095. // LCD_write_byte(0xC4,LCD_COMMAND);
  1096. // LCD_write_byte(0x8A,LCD_DATA);
  1097. // LCD_write_byte(0xEE,LCD_DATA);
  1098. //
  1099. // LCD_write_byte(0xC5,LCD_COMMAND); //加VCOM
  1100. // LCD_write_byte(0x0E,LCD_DATA);
  1101. //
  1102. // LCD_write_byte(0x36,LCD_COMMAND); //RGB模式
  1103. // LCD_write_byte(0xC8,LCD_DATA);
  1104. //
  1105. // // ST7735R Gamma 校正序列
  1106. // LCD_write_byte(0xe0,LCD_COMMAND);
  1107. // LCD_write_byte(0x0f,LCD_DATA);
  1108. // LCD_write_byte(0x1a,LCD_DATA);
  1109. // LCD_write_byte(0x0f,LCD_DATA);
  1110. // LCD_write_byte(0x18,LCD_DATA);
  1111. // LCD_write_byte(0x2f,LCD_DATA);
  1112. // LCD_write_byte(0x28,LCD_DATA);
  1113. // LCD_write_byte(0x20,LCD_DATA);
  1114. // LCD_write_byte(0x22,LCD_DATA);
  1115. // LCD_write_byte(0x1f,LCD_DATA);
  1116. // LCD_write_byte(0x1b,LCD_DATA);
  1117. // LCD_write_byte(0x23,LCD_DATA);
  1118. // LCD_write_byte(0x37,LCD_DATA);
  1119. // LCD_write_byte(0x00,LCD_DATA);
  1120. //
  1121. // LCD_write_byte(0x07,LCD_DATA);
  1122. // LCD_write_byte(0x02,LCD_DATA);
  1123. // LCD_write_byte(0x10,LCD_DATA);
  1124. // LCD_write_byte(0xe1,LCD_COMMAND);
  1125. // LCD_write_byte(0x0f,LCD_DATA);
  1126. // LCD_write_byte(0x1b,LCD_DATA);
  1127. // LCD_write_byte(0x0f,LCD_DATA);
  1128. // LCD_write_byte(0x17,LCD_DATA);
  1129. // LCD_write_byte(0x33,LCD_DATA);
  1130. // LCD_write_byte(0x2c,LCD_DATA);
  1131. // LCD_write_byte(0x29,LCD_DATA);
  1132. // LCD_write_byte(0x2e,LCD_DATA);
  1133. // LCD_write_byte(0x30,LCD_DATA);
  1134. // LCD_write_byte(0x30,LCD_DATA);
  1135. // LCD_write_byte(0x39,LCD_DATA);
  1136. // LCD_write_byte(0x3f,LCD_DATA);
  1137. // LCD_write_byte(0x00,LCD_DATA);
  1138. // LCD_write_byte(0x07,LCD_DATA);
  1139. // LCD_write_byte(0x03,LCD_DATA);
  1140. // LCD_write_byte(0x10,LCD_DATA);
  1141. //
  1142. // LCD_write_byte(0x2a,LCD_COMMAND);
  1143. // LCD_write_byte(0x00,LCD_DATA);
  1144. // LCD_write_byte(0x00,LCD_DATA);
  1145. // LCD_write_byte(0x00,LCD_DATA);
  1146. // LCD_write_byte(0x7f,LCD_DATA);
  1147. // LCD_write_byte(0x2b,LCD_COMMAND);
  1148. // LCD_write_byte(0x00,LCD_DATA);
  1149. // LCD_write_byte(0x00,LCD_DATA);
  1150. // LCD_write_byte(0x00,LCD_DATA);
  1151. // LCD_write_byte(0x9f,LCD_DATA);
  1152. //
  1153. // LCD_write_byte(0xF0,LCD_COMMAND); //使能测试命令
  1154. // LCD_write_byte(0x01,LCD_DATA);
  1155. // LCD_write_byte(0xF6,LCD_COMMAND); //关闭ram省电模式
  1156. // LCD_write_byte(0x00,LCD_DATA);
  1157. //
  1158. // LCD_write_byte(0x3A,LCD_COMMAND); //色深16bit
  1159. // LCD_write_byte(0x05,LCD_DATA);
  1160. //
  1161. // LCD_write_byte(0x29,LCD_COMMAND); //开显示
  1162. // LCD_clear(GREEN); //清屏
  1163. //}
  1164. //#endif