lcd.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef __LCD_H
  2. #define __LCD_H
  3. #include <rtthread.h>
  4. #include <rtdevice.h>
  5. #include <board.h>
  6. #include "st7735.h"
  7. #include <stdio.h>
  8. #define WHITE 0xFFFF
  9. #define BLACK 0x0000
  10. #define BLUE 0x001F
  11. #define BRED 0XF81F
  12. #define GRED 0XFFE0
  13. #define GBLUE 0X07FF
  14. #define RED 0xF800
  15. #define MAGENTA 0xF81F
  16. #define GREEN 0x07E0
  17. #define CYAN 0x7FFF
  18. #define YELLOW 0xFFE0
  19. #define BROWN 0XBC40 //棕色
  20. #define BRRED 0XFC07 //棕红色
  21. #define GRAY 0X8430 //灰色
  22. #define DARKBLUE 0X01CF //深蓝色
  23. #define LIGHTBLUE 0X7D7C //浅蓝色
  24. #define GRAYBLUE 0X5458 //灰蓝色
  25. // lcd spi
  26. #define LCD_SPI_DEVICE_NAME "spi40"
  27. #define LCD_PWM_DEV_NAME "pwm1"
  28. #define LCD_PWM_DEV_CHANNEL (2)
  29. #define LCD_PWM_DEV_TIME (10000)//pwm frequency:100K = 10000ns
  30. #define MAX_BRIGHTNESS LCD_PWM_DEV_TIME
  31. #define WR_RS_PIN GET_PIN(E, 13)
  32. #define CS_PIN GET_PIN(E, 11)
  33. //lcd display gpio
  34. #define LCD_DISP_GPIO_NUM GET_PIN(E, 10)
  35. // lcd brush color
  36. #define BRUSH_POINT_COLOR WHITE
  37. #define BRUSH_BACK_COLOR BLACK
  38. extern ST7735_Object_t st7735_pObj;
  39. extern uint32_t st7735_id;
  40. void LCD_SetBrightness(uint32_t Brightness);
  41. uint32_t LCD_GetBrightness(void);
  42. void LCD_ShowChar(uint16_t x,uint16_t y,uint8_t num,uint8_t size,uint8_t mode);
  43. void LCD_ShowString(uint16_t x,uint16_t y,uint16_t width,uint16_t height,uint8_t size,uint8_t *p);
  44. void LCD_FillRGBRect(uint32_t Xpos, uint32_t Ypos, uint8_t *pData, uint32_t Width, uint32_t Height);
  45. #endif