GUI.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef __GUI_H_
  2. #define __GUI_H_
  3. #include "stm32f10x.h"
  4. #define LCD_TYPE 1 //新屏
  5. #define HZK16_FILE_NAME "HZK16"
  6. #define HZK12_FILE_NAME "HZK12"
  7. //以下定义各种颜色,原色按0xRRGGBB格式
  8. #define COLOR_BLACK 0x000000
  9. #define COLOR_WHITE 0xFFFFFF
  10. #define COLOR_RED 0x0000FF //0xB5003E
  11. #define COLOR_GREEN 0x00FF00
  12. #define COLOR_BLUE 0xFF0000
  13. #define COLOR_YELLOW 0xFFFF00
  14. #define COLOR_PURPLE 0x800080
  15. #define COLOR_SEL_BULUE 0xFF6464 //选定框颜色
  16. #define COLOR_DARKBLUE 0x8B0000 //RGB(139,0,0) ■★●◆darkblue(深红)
  17. #define USING_DRAW_WITH_COLOR_OPTION
  18. #define COLOR_DEFAULT_BLUE 1
  19. #define COLOR_WARN_RED 2
  20. #define COLOR_WHITE_BACK 3
  21. #define COLOR_SELECT_BLUE 4
  22. #define STATUS_BAR_HEIGH 13
  23. #define STATUS_ITEM_HEIGH (STATUS_BAR_HEIGH+14)
  24. #define MIDDLE_CONTENT_HEIGH 110
  25. #define SUBSCRIPT_LOCATION 114 //下方提示汉字位置
  26. //汉字库
  27. typedef struct SUT_HZK
  28. {
  29. unsigned char width;//字库点阵宽度
  30. unsigned char heigh;//字库点阵高度
  31. unsigned char len; //字库点阵数据长度,一般等于width*heigh/8
  32. int FileIndex; //字库文件在sFlash中索引
  33. int FileLen; //字库文件大小
  34. }SUT_HZK;
  35. void GuiInit(void); //GUI初始化
  36. void GuiSetColor(unsigned long ForeColor,unsigned long BackColor,unsigned long WarnColor,unsigned long SelColor);//设置前景色和背景色
  37. void GuiSetForeColor(unsigned long ForeColor);//设置前景色
  38. void GuiSetBackColor(unsigned long BackColor);//设置背景色
  39. void GuiShowStr(u16 x, u16 y,const char *string,u8 mode,u8 rev);//显示字符串 font=mode&0xf0 cover=mode&0x0f
  40. void GuiShowBmp(u16 x,u16 y,const char * filename);//显示BMP图片 filename为在sFlash中存储的BMP文件名
  41. void GuiDrawHLine(u16 x1, u16 x2, u16 y, u8 width);//画水平线
  42. #ifdef USING_DRAW_WITH_COLOR_OPTION
  43. void GuiDrawVLine(u16 y1, u16 y2, u16 x, u8 width, u8 colorIndex);//画垂直线
  44. void GuiFillRect(u16 x1, u16 y1, u16 x2, u16 y2,u8 colorIndex);//画矩形框并填充为前景色
  45. #else
  46. void GuiDrawVLine(u16 y1, u16 y2, u16 x, u8 width);
  47. void GuiFillRect(u16 x1, u16 y1, u16 x2, u16 y2);//画矩形框并填充为前景色
  48. #endif
  49. void GuiDrawRect(u16 x1, u16 y1, u16 x2, u16 y2,u8 width);//画矩形框,只画边框,内部不填充
  50. void GuiClearRect(u16 x1, u16 y1, u16 x2, u16 y2);//清空矩形区域,填充背景色
  51. void GuiClearArea(u16 x, u16 y, u16 width, u16 heigh);//清空一个区域,填充背景色,和GuiClearRect等效,只是入口参数有区别
  52. void GuiClearAll(void);
  53. void GuiShowArrow(u16 x,u16 y,u16 len,u8 mode);
  54. void GuiShowSingle(int CSQ);//显示信号
  55. void GuiShowBat(int bat);//显示电量
  56. u16 RGB888toRGB565(unsigned char R,unsigned char G, unsigned char B);//将RGB888格式转RGB565格式
  57. extern u8 g_ucWarnColorId;
  58. extern u8 g_ucBackColorId; //背景颜色索引
  59. void ShowButton(u16 x,u16 y,const char *str);
  60. void ShowMessageBox(char *msg);
  61. void lcdTestFlash();
  62. #endif