My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ili9328.h 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. #include "tft.h"
  24. #include "../../inc/MarlinConfig.h"
  25. #define ILI9328_DRVCTL_SM 0x0400
  26. #define ILI9328_DRVCTL_SS 0x0100 // Select the shift direction of outputs from the source driver. 0 - from S1 to S720 / 1 - from S720 to S1
  27. #define ILI9328_GATE_SCANCTL_GS 0x8000 // Sets the direction of scan by the gate driver in the range determined by SCN[4:0] and NL[4:0].
  28. #define ILI9328_ETMOD_TRI 0x8000
  29. #define ILI9328_ETMOD_DFM 0x4000
  30. #define ILI9328_ETMOD_BGR 0x1000 // RGB-BGR ORDER
  31. #define ILI9328_ETMOD_RGB 0x0000
  32. #define ILI9328_ETMOD_ORG 0x0080
  33. #define ILI9328_ETMOD_ID1 0x0020 // 0 - Vertical Decrement / 1 - Vertical Increment
  34. #define ILI9328_ETMOD_ID0 0x0010 // 0 - Horizontal Decrement / 1 - Horizontal Increment
  35. #define ILI9328_ETMOD_AM 0x0008 // 0 - Horizontal / 1 - Vertical
  36. // MKS Robin TFT v1.1 - 320x240 ; Cable on the left side
  37. #define ILI9328_DRVCTL_DATA ILI9328_DRVCTL_SS
  38. #define ILI9328_ETMOD_DATA ILI9328_ETMOD_BGR | ILI9328_ETMOD_ID1 | ILI9328_ETMOD_ID0 | ILI9328_ETMOD_AM
  39. #define ILI9328_RDDID 0x00 // ID code - 0x9328
  40. #define ILI9328_DRVCTL 0x01 // Driver Output Control
  41. #define ILI9328_LCDCTL 0x02 // LCD Driving Wave Control
  42. #define ILI9328_ETMOD 0x03 // Entry Mode - Control the GRAM update direction
  43. #define ILI9328_RESIZECTL 0x04 // Resizing Control Register
  44. #define ILI9328_DISCTRL1 0x07 // Display Control 1
  45. #define ILI9328_DISCTRL2 0x08 // Display Control 2
  46. #define ILI9328_DISCTRL3 0x09 // Display Control 3
  47. #define ILI9328_DISCTRL4 0x0A // Display Control 4
  48. #define ILI9328_RGBCTRL1 0x0C // RGB Display Interface Control 1
  49. #define ILI9328_FMARKERPOS 0x0D // Frame Marker Position
  50. #define ILI9328_RGBCTRL2 0x0F // RGB Display Interface Control 2
  51. #define ILI9328_PWCTRL1 0x10 // Power Control 1
  52. #define ILI9328_PWCTRL2 0x11 // Power Control 2
  53. #define ILI9328_PWCTRL3 0x12 // Power Control 3
  54. #define ILI9328_PWCTRL4 0x13 // Power Control 4
  55. // With landscape screen orientation 'Horizontal' is Y and 'Vertical' is X
  56. #define ILI9328_HASET 0x20 // GRAM Horizontal Address Set (0-255)
  57. #define ILI9328_VASET 0x21 // GRAM Vertical Address Set (0-511)
  58. #define ILI9328_RAMWR 0x22 // Write data to GRAM
  59. #define ILI9328_RAMRD 0x22 // Read Data from GRAM
  60. #define ILI9328_PWCTRL7 0x29 // Power Control 7
  61. #define ILI9328_FRMCTR 0x2B // Frame Rate and Color Control
  62. #define ILI9328_GAMCTRL1 0x30 // Gamma Control
  63. #define ILI9328_GAMCTRL2 0x31 // Gamma Control
  64. #define ILI9328_GAMCTRL3 0x32 // Gamma Control
  65. #define ILI9328_GAMCTRL4 0x35 // Gamma Control
  66. #define ILI9328_GAMCTRL5 0x36 // Gamma Control
  67. #define ILI9328_GAMCTRL6 0x37 // Gamma Control
  68. #define ILI9328_GAMCTRL7 0x38 // Gamma Control
  69. #define ILI9328_GAMCTRL8 0x39 // Gamma Control
  70. #define ILI9328_GAMCTRL9 0x3C // Gamma Control
  71. #define ILI9328_GAMCTRLA 0x3D // Gamma Control
  72. // With landscape screen orientation 'Horizontal' is Y and 'Vertical' is X
  73. #define ILI9328_HASTART 0x50 // Horizontal Address Start Position (0-255)
  74. #define ILI9328_HAEND 0x51 // Horizontal Address End Position (0-255)
  75. #define ILI9328_VASTART 0x52 // Vertical Address Start Position (0-511)
  76. #define ILI9328_VAEND 0x53 // Vertical Address End Position (0-511)
  77. #define ILI9328_GATE_SCANCTL1 0x60 // Gate Scan Control
  78. #define ILI9328_GATE_SCANCTL2 0x61 // Gate Scan Control
  79. #define ILI9328_GATE_SCANCTL3 0x6A // Gate Scan Control
  80. #define ILI9328_PLTPOS1 0x80 // Partial Image 1 Display Position
  81. #define ILI9328_PLTSTART1 0x81 // Partial Image 1 RAM Start Address
  82. #define ILI9328_PLTEND1 0x82 // Partial Image 1 RAM End Address
  83. #define ILI9328_PLTPOS2 0x83 // Partial Image 2 Display Position
  84. #define ILI9328_PLTSTART2 0x84 // Partial Image 2 RAM Start Address
  85. #define ILI9328_PLTEND2 0x85 // Partial Image 2 RAM End Address
  86. #define ILI9328_IFCTL1 0x90 // Panel Interface Control 1
  87. #define ILI9328_IFCTL2 0x92 // Panel Interface Control 2
  88. #define ILI9328_IFCTL4 0x95 // Panel Interface Control 4
  89. #define ILI9328_IFCTL5 0x97 // Panel Interface Control 5
  90. #define ILI9328_OTPWR 0xA1 // OTP VCM Programming Control
  91. #define ILI9328_RDOTP 0xA2 // OTP VCM Status and Enable
  92. #define ILI9328_OTPPKEY 0xA5 // OTP Programming ID Key
  93. static const uint16_t ili9328_init[] = {
  94. DATASIZE_16BIT,
  95. ESC_REG(ILI9328_DRVCTL), ILI9328_DRVCTL_DATA,
  96. ESC_REG(ILI9328_LCDCTL), 0x0400, // LCD Driving Wave Control
  97. ESC_REG(ILI9328_ETMOD), ILI9328_ETMOD_DATA,
  98. ESC_REG(ILI9328_RESIZECTL), 0x0000,
  99. ESC_REG(ILI9328_DISCTRL2), 0x0202,
  100. ESC_REG(ILI9328_DISCTRL3), 0x0000,
  101. ESC_REG(ILI9328_DISCTRL4), 0x0000,
  102. ESC_REG(ILI9328_RGBCTRL1), 0x0000,
  103. ESC_REG(ILI9328_FMARKERPOS), 0x0000,
  104. ESC_REG(ILI9328_RGBCTRL2), 0x0000,
  105. ESC_REG(ILI9328_PWCTRL1), 0x0000,
  106. ESC_REG(ILI9328_PWCTRL2), 0x0007,
  107. ESC_REG(ILI9328_PWCTRL3), 0x0000,
  108. ESC_REG(ILI9328_PWCTRL4), 0x0000,
  109. ESC_REG(ILI9328_DISCTRL1), 0x0001,
  110. ESC_DELAY(200),
  111. ESC_REG(ILI9328_PWCTRL1), 0x1690,
  112. ESC_REG(ILI9328_PWCTRL2), 0x0227,
  113. ESC_DELAY(50),
  114. ESC_REG(ILI9328_PWCTRL3), 0x008C,
  115. ESC_DELAY(50),
  116. ESC_REG(ILI9328_PWCTRL4), 0x1500,
  117. ESC_REG(ILI9328_PWCTRL7), 0x0004,
  118. ESC_REG(ILI9328_FRMCTR), 0x000D,
  119. ESC_DELAY(50),
  120. ESC_REG(ILI9328_GATE_SCANCTL1), 0x2700,
  121. ESC_REG(ILI9328_GATE_SCANCTL2), 0x0001,
  122. ESC_REG(ILI9328_GATE_SCANCTL3), 0x0000,
  123. ESC_REG(ILI9328_PLTPOS1), 0x0000,
  124. ESC_REG(ILI9328_PLTSTART1), 0x0000,
  125. ESC_REG(ILI9328_PLTEND1), 0x0000,
  126. ESC_REG(ILI9328_PLTPOS2), 0x0000,
  127. ESC_REG(ILI9328_PLTSTART2), 0x0000,
  128. ESC_REG(ILI9328_PLTEND2), 0x0000,
  129. ESC_REG(ILI9328_IFCTL1), 0x0010,
  130. ESC_REG(ILI9328_IFCTL2), 0x0600,
  131. ESC_REG(ILI9328_DISCTRL1), 0x0133,
  132. ESC_END
  133. };