ST7789V2+2.4CTC.TXT 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. Void ST7789SCMI24panelinitialcode(void)
  2. {
  3. //-----------------------------------ST7789S reset sequence------------------------------------//
  4. LCD_RESET=1;
  5. Delayms(1); //Delay 1ms
  6. LCD_RESET=0;
  7. Delayms(10); //Delay 10ms
  8. LCD_RESET=1;
  9. Delayms(120); //Delay 120ms
  10. //--------------------------------------------------------------------------------------------//
  11. Write command (0x11);
  12. Delayms(120); //Delay 120ms
  13. //--------------------------------------Display Setting---------------------------------------//
  14. Write command (0x36);
  15. Write data (0x00);
  16. Write command (0x3a);
  17. Write data (0x05);
  18. //--------------------------------ST7789S Frame rate setting----------------------------------//
  19. Write command (0xb2);
  20. Write data (0x0c);
  21. Write data (0x0c);
  22. Write data (0x00);
  23. Write data (0x33);
  24. Write data (0x33);
  25. Write command (0xb7);
  26. Write data (0x35);
  27. //---------------------------------ST7789S Power setting--------------------------------------//
  28. Write command (0xbb);
  29. Write data (0x35);
  30. Write command (0xc0);
  31. Write data (0x2c);
  32. Write command (0xc2);
  33. Write data (0x01);
  34. Write command (0xc3);
  35. Write data (0x11);
  36. Write command (0xc4);
  37. Write data (0x20);
  38. Write command (0xc6);
  39. Write data (0x0f);
  40. Write command (0xd0);
  41. Write data (0xa4);
  42. Write data (0xa1);
  43. //--------------------------------ST7789S gamma setting---------------------------------------//
  44. Write command (0xe0);
  45. Write data (0xd0);
  46. Write data (0x00);
  47. Write data (0x05);
  48. Write data (0x0e);
  49. Write data (0x15);
  50. Write data (0x0d);
  51. Write data (0x37);
  52. Write data (0x43);
  53. Write data (0x47);
  54. Write data (0x09);
  55. Write data (0x15);
  56. Write data (0x12);
  57. Write data (0x16);
  58. Write data (0x19);
  59. Write command (0xe1);
  60. Write data (0xd0);
  61. Write data (0x00);
  62. Write data (0x05);
  63. Write data (0x0d);
  64. Write data (0x0c);
  65. Write data (0x06);
  66. Write data (0x2d);
  67. Write data (0x44);
  68. Write data (0x40);
  69. Write data (0x0e);
  70. Write data (0x1c);
  71. Write data (0x18);
  72. Write data (0x16);
  73. Write data (0x19);
  74. Write command (0x29);
  75. }
  76. Void ST7789sPanelTurnOnDisplay (void)
  77. {
  78. Write command (0x29);
  79. }
  80. Void ST7789sPanelTurnOffDisplay (void)
  81. {
  82. Write command (0x28);
  83. }
  84. Void ST7789sPanelTurnOnPartial (void)
  85. {
  86. Write command (0x30);
  87. Write data (0x00);
  88. Write PSL); //PSL: Start Line
  89. Write data (0x00);
  90. Write PEL); //PEL: End Line
  91. Write command (0x12);
  92. }
  93. Void ST7789sPanelTurnOffPartial (void)
  94. {
  95. Write command (0x13);
  96. }
  97. Void ST7789sPanelTurnOnIdle (void)
  98. {
  99. Write command (0x39);
  100. }
  101. Void ST7789sPanelTurnOffIdle (void)
  102. {
  103. Write command (0x38);
  104. }
  105. Void ST7789sPanelSleepInMode (void)
  106. {
  107. Write command (0x10);
  108. Delayms (120);
  109. }
  110. Void ST7789sPanelSleepOutMode (void)
  111. {
  112. Write command (0x11);
  113. Delayms (120);
  114. }