luat_lcd_st7789.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "luat_base.h"
  2. #include "luat_lcd.h"
  3. #define LUAT_LOG_TAG "st7789"
  4. #include "luat_log.h"
  5. static const uint16_t st7789_init_cmds[] = {
  6. /* RGB 5-6-5-bit */
  7. 0x023A,0x0305,
  8. /* Porch Setting */
  9. 0x02B2,0x030C,0x030C,0x0300,0x0333,0x0333,
  10. /* Gate Control */
  11. 0x02B7,0x0335,
  12. /* VCOM Setting */
  13. 0x02BB,0x0332,
  14. /* LCM Control */
  15. // 0x02C0,
  16. // 0x032C,
  17. /* VDV and VRH Command Enable */
  18. 0x02C2,0x0301,
  19. /* VRH Set */
  20. 0x02C3,0x0315,
  21. /* VDV Set */
  22. 0x02C4,0x0320,
  23. /* Frame Rate Control in Normal Mode */
  24. 0x02C6,0x030F,
  25. /* Power Control 1 */
  26. 0x02D0,0x03A4,0x03A1,
  27. /* Positive Voltage Gamma Control */
  28. 0x02E0,0x03D0,0x0308,0x030E,0x0309,0x0309,0x0305,0x0331,0x0333,0x0348,0x0317,0x0314,0x0315,0x0331,0x0334,
  29. /* Negative Voltage Gamma Control */
  30. 0x02E1,0x03D0,0x0308,0x030E,0x0309,0x0309,0x0315,0x0331,0x0333,0x0348,0x0317,0x0314,0x0315,0x0331,0x0334,
  31. 0x0221,
  32. };
  33. luat_lcd_opts_t lcd_opts_st7789 = {
  34. .name = "st7789",
  35. .init_cmds_len = sizeof(st7789_init_cmds)/sizeof(st7789_init_cmds[0]),
  36. .init_cmds = st7789_init_cmds,
  37. .direction0 = 0x00,
  38. .direction90 = 0xC0,
  39. .direction180 = 0x70,
  40. .direction270 = 0xA0,
  41. .rb_swap = 1,
  42. };