lcd.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef __LCD_Hx__
  2. #define __LCD_Hx__
  3. #include "font.h"
  4. #define LCD_COLOR COLOR_WB
  5. #define LCD_WIDTH 128
  6. #define LCD_HEIGHT 64
  7. /* 颜色 */
  8. #if (LCD_COLOR==COLOR_WB)
  9. #define COLOR_WHITE 1
  10. #define COLOR_BLACK 0
  11. #elif (LCD_COLOR==COLOR_RGB565)
  12. #define COLOR_WHITE 0xFFFF
  13. #define COLOR_BLACK 0x0000
  14. #define COLOR_BLUE 0x001F
  15. #define COLOR_BRED 0XF81F
  16. #define COLOR_GRED 0XFFE0
  17. #define COLOR_GBLUE 0X07FF
  18. #define COLOR_RED 0xF800
  19. #define COLOR_MAGENTA 0xF81F
  20. #define COLOR_GREEN 0x07E0
  21. #define COLOR_CYAN 0x7FFF
  22. #define COLOR_YELLOW 0xFFE0
  23. #define COLOR_BROWN 0XBC40
  24. #define COLOR_BRRED 0XFC07
  25. #define COLOR_GRAY 0X8430
  26. #elif (LCD_COLOR==COLOR_RGB666)
  27. #elif (LCD_COLOR==COLOR_RGB888)
  28. #else
  29. #endif
  30. enum {
  31. HORIZONTAL_LEFT=0,
  32. HORIZONTAL_CENTER,
  33. HORIZONTAL_RIGHT,
  34. };
  35. enum {
  36. VERTICAL_TOP=0,
  37. VERTICAL_CENTER,
  38. VERTICAL_BOTTOM,
  39. };
  40. enum {
  41. COLOR_WB=0,
  42. COLOR_RGB8,
  43. COLOR_RGB565,
  44. COLOR_RGB666,
  45. COLOR_RGB888,
  46. COLOR_RGBA,
  47. };
  48. void lcd_init(int width, int height, int color);
  49. void lcd_deinit(void);
  50. void lcd_rotate(int angle);
  51. int lcd_get_rotate(void);
  52. void lcd_set_backlight(int on);
  53. void lcd_fill(int color);
  54. void lcd_draw_line(int x1, int y1, int x2, int y2, int color);
  55. void lcd_draw_rect(int x1, int y1, int w, int h, int color);
  56. void lcd_fill_rect(int x1, int y1, int w, int h, int color);
  57. void lcd_draw_string(int x, int y, int width, int height, char *str, int font, int color, int bgcolor, int hori, int vert);
  58. void lcd_refresh(void);
  59. #endif