drv_lcd.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2018-08-14 flybreak the first version
  9. * 2018-09-18 balanceTWK add sleep mode function
  10. */
  11. #ifndef __DRV_LCD_H__
  12. #define __DRV_LCD_H__
  13. #include <rtthread.h>
  14. #define LCD_W 240
  15. #define LCD_H 240
  16. #ifndef BSP_USING_LVGL
  17. #define WHITE 0xFFFF
  18. #define BLACK 0x0000
  19. #define BLUE 0x001F
  20. #define BRED 0XF81F
  21. #define GRED 0XFFE0
  22. #define GBLUE 0X07FF
  23. #define RED 0xF800
  24. #define MAGENTA 0xF81F
  25. #define GREEN 0x07E0
  26. #define CYAN 0x7FFF
  27. #define YELLOW 0xFFE0
  28. #define BROWN 0XBC40
  29. #define BRRED 0XFC07
  30. #define GRAY 0X8430
  31. #define GRAY175 0XAD75
  32. #define GRAY151 0X94B2
  33. #define GRAY187 0XBDD7
  34. #define GRAY240 0XF79E
  35. extern rt_uint16_t BACK_COLOR, FORE_COLOR;
  36. void lcd_clear(rt_uint16_t color);
  37. void lcd_set_color(rt_uint16_t back, rt_uint16_t fore);
  38. void lcd_draw_point(rt_uint16_t x, rt_uint16_t y);
  39. void lcd_draw_point_color(rt_uint16_t x, rt_uint16_t y, rt_uint16_t color);
  40. void lcd_draw_circle(rt_uint16_t x0, rt_uint16_t y0, rt_uint8_t r);
  41. void lcd_draw_line(rt_uint16_t x1, rt_uint16_t y1, rt_uint16_t x2, rt_uint16_t y2);
  42. void lcd_draw_rectangle(rt_uint16_t x1, rt_uint16_t y1, rt_uint16_t x2, rt_uint16_t y2);
  43. void lcd_fill(rt_uint16_t x_start, rt_uint16_t y_start, rt_uint16_t x_end, rt_uint16_t y_end, rt_uint16_t color);
  44. void lcd_show_num(rt_uint16_t x, rt_uint16_t y, rt_uint32_t num, rt_uint8_t len, rt_uint32_t size);
  45. rt_err_t lcd_show_string(rt_uint16_t x, rt_uint16_t y, rt_uint32_t size, const char *fmt, ...);
  46. rt_err_t lcd_show_image(rt_uint16_t x, rt_uint16_t y, rt_uint16_t length, rt_uint16_t wide, const rt_uint8_t *p);
  47. #endif /* BSP_USING_LVGL */
  48. void lcd_enter_sleep(void);
  49. void lcd_exit_sleep(void);
  50. void lcd_display_on(void);
  51. void lcd_display_off(void);
  52. void lcd_display_brightness(rt_uint8_t percent);
  53. void lcd_address_set(rt_uint16_t x1, rt_uint16_t y1, rt_uint16_t x2, rt_uint16_t y2);
  54. void lcd_fill_array(rt_uint16_t x_start, rt_uint16_t y_start, rt_uint16_t x_end, rt_uint16_t y_end, void *pcolor);
  55. #endif