My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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_io.h"
  24. #include "../../inc/MarlinConfig.h"
  25. #define ST7735_MADCTL_MY 0x80 // Row Address Order
  26. #define ST7735_MADCTL_MX 0x40 // Column Address Order
  27. #define ST7735_MADCTL_MV 0x20 // Row/Column Exchange
  28. #define ST7735_MADCTL_ML 0x10 // Vertical Refresh Order
  29. #define ST7735_MADCTL_BGR 0x08 // RGB-BGR ORDER
  30. #define ST7735_MADCTL_RGB 0x00
  31. #define ST7735_MADCTL_MH 0x04 // Horizontal Refresh Order
  32. #define ST7735_ORIENTATION_UP 0x00 // 128x160 ; Cable on the upper side
  33. #define ST7735_ORIENTATION_RIGHT ST7735_MADCTL_MV | ST7735_MADCTL_MY // 160x128 ; Cable on the right side
  34. #define ST7735_ORIENTATION_LEFT ST7735_MADCTL_MV | ST7735_MADCTL_MX // 160x128 ; Cable on the left side
  35. #define ST7735_ORIENTATION_DOWN ST7735_MADCTL_MX | ST7735_MADCTL_MY // 128x160 ; Cable on the lower side
  36. #define ST7735_ORIENTATION IF_0((TFT_ORIENTATION) & TFT_EXCHANGE_XY, ST7735_MADCTL_MV) | \
  37. IF_0((TFT_ORIENTATION) & TFT_INVERT_X, ST7735_MADCTL_MX) | \
  38. IF_0((TFT_ORIENTATION) & TFT_INVERT_Y, ST7735_MADCTL_MY)
  39. #if !defined(TFT_COLOR) || TFT_COLOR == TFT_COLOR_RGB
  40. #define ST7735_COLOR ST7735_MADCTL_RGB
  41. #elif TFT_COLOR == TFT_COLOR_BGR
  42. #define ST7735_COLOR ST7735_MADCTL_BGR
  43. #endif
  44. #define ST7735_MADCTL_DATA (ST7735_ORIENTATION) | (ST7735_COLOR)
  45. #define ST7735_NOP 0x00 // No Operation
  46. #define ST7735_SWRESET 0x01 // Software reset
  47. #define ST7735_RDDID 0x04 // Read Display ID
  48. #define ST7735_RDDST 0x09 // Read Display Status
  49. #define ST7735_RDDPM 0x0A // Read Display Power Mode
  50. #define ST7735_RDDMADCTL 0x0B // Read Display MADCTL
  51. #define ST7735_RDDCOLMOD 0x0C // Read Display Pixel Format
  52. #define ST7735_RDDIM 0x0D // Read Display Image Mode
  53. #define ST7735_RDDSM 0x0E // Read Display Signal Mode
  54. #define ST7735_SLPIN 0x10 // Sleep In
  55. #define ST7735_SLPOUT 0x11 // Sleep Out
  56. #define ST7735_PTLON 0x12 // Partial Display Mode On
  57. #define ST7735_NORON 0x13 // Normal Display Mode On
  58. #define ST7735_INVOFF 0x20 // Display Inversion Off
  59. #define ST7735_INVON 0x21 // Display Inversion On
  60. #define ST7735_GAMSET 0x26 // Gamma Set
  61. #define ST7735_DISPOFF 0x28 // Display Off // The delay time between DISPON and DISPOFF needs 120ms at least.
  62. #define ST7735_DISPON 0x29 // Display On
  63. #define ST7735_CASET 0x2A // Column Address Set
  64. #define ST7735_RASET 0x2B // Row Address Set
  65. #define ST7735_RAMWR 0x2C // Memory Write
  66. #define ST7735_RAMRD 0x2E // Memory Read
  67. #define ST7735_PTLAR 0x30 // Partial Area
  68. #define ST7735_TEOFF 0x34 // Tearing Effect Line OFF
  69. #define ST7735_TEON 0x35 // Tearing Effect Line ON
  70. #define ST7735_MADCTL 0x36 // Memory Data Access Control
  71. #define ST7735_IDMOFF 0x38 // Idle Mode Off
  72. #define ST7735_IDMON 0x39 // Idle Mode On
  73. #define ST7735_COLMOD 0x3A // Interface Pixel Format
  74. #define ST7735_RDID1 0xDA // Read ID1 Value
  75. #define ST7735_RDID2 0xDB // Read ID2 Value
  76. #define ST7735_RDID3 0xDC // Read ID3 Value
  77. #define ST7735_FRMCTR1 0xB1 // Frame Rate Control (In normal mode/ Full colors)
  78. #define ST7735_FRMCTR2 0xB2 // Frame Rate Control (In Idle mode/ 8-colors)
  79. #define ST7735_FRMCTR3 0xB3 // Frame Rate Control (In Partial mode/ full colors)
  80. #define ST7735_INVCTR 0xB4 // Display Inversion Control
  81. #define ST7735_DISSET5 0xB6 // Display Function set 5
  82. #define ST7735_PWCTR1 0xC0 // Power Control 1
  83. #define ST7735_PWCTR2 0xC1 // Power Control 2
  84. #define ST7735_PWCTR3 0xC2 // Power Control 3 (in Normal mode/ Full colors)
  85. #define ST7735_PWCTR4 0xC3 // Power Control 4 (in Idle mode/ 8-colors)
  86. #define ST7735_PWCTR5 0xC4 // Power Control 5 (in Partial mode/ full-colors)
  87. #define ST7735_VMCTR1 0xC5 // VCOM Control 1
  88. #define ST7735_VMOFCTR 0xC7 // VCOM Offset Control
  89. #define ST7735_WRID2 0xD1 // Write ID2 Value
  90. #define ST7735_WRID3 0xD2 // Write ID3 Value
  91. #define ST7735_PWCTR6 0xFC // Power Control 5 (in Partial mode + Idle mode)
  92. #define ST7735_NVFCTR1 0xD9 // EEPROM Control Status
  93. #define ST7735_NVFCTR2 0xDE // EEPROM Read Command
  94. #define ST7735_NVFCTR3 0xDF // EEPROM Write Command
  95. #define ST7735_GMCTRP1 0xE0 // Gamma (‘+’polarity) Correction Characteristics Setting
  96. #define ST7735_GMCTRN1 0xE1 // GMCTRN1 (E1h): Gamma ‘-’polarity Correction Characteristics Setting
  97. #define ST7735_EXTCTRL 0xF0 // Extension Command Control
  98. #define ST7735_VCOM4L 0xFF // Vcom 4 Level Control
  99. static const uint16_t st7735_init[] = {
  100. DATASIZE_8BIT,
  101. ESC_REG(ST7735_SWRESET), ESC_DELAY(100),
  102. ESC_REG(ST7735_SLPOUT), ESC_DELAY(20),
  103. /*
  104. ESC_REG(ST7735_FRMCTR1), 0x0001, 0x002C, 0x002D,
  105. ESC_REG(ST7735_FRMCTR2), 0x0001, 0x002C, 0x002D,
  106. ESC_REG(ST7735_FRMCTR3), 0x0001, 0x002C, 0x002D, 0x0001, 0x002C, 0x002D,
  107. ESC_REG(ST7735_INVCTR), 0x0007,
  108. ESC_REG(ST7735_PWCTR1), 0x00A2, 0x0002, 0x0084,
  109. ESC_REG(ST7735_PWCTR2), 0x00C5,
  110. ESC_REG(ST7735_PWCTR3), 0x000A, 0x0000,
  111. ESC_REG(ST7735_PWCTR4), 0x008A, 0x002A,
  112. ESC_REG(ST7735_PWCTR5), 0x008A, 0x00EE,
  113. ESC_REG(ST7735_VMCTR1), 0x000E,
  114. ESC_REG(ST7735_INVOFF),
  115. */
  116. ESC_REG(ST7735_MADCTL), ST7735_MADCTL_DATA,
  117. ESC_REG(ST7735_COLMOD), 0x0005,
  118. /* Gamma Correction. Colors with 'after-reset' settings are bleak */
  119. ESC_REG(ST7735_GMCTRP1), 0x0002, 0x001C, 0x0007, 0x0012, 0x0037, 0x0032, 0x0029, 0x002D, 0x0029, 0x0025, 0x002B, 0x0039, 0x0000, 0x0001, 0x0003, 0x0010,
  120. ESC_REG(ST7735_GMCTRN1), 0x0003, 0x001D, 0x0007, 0x0006, 0x002E, 0x002C, 0x0029, 0x002D, 0x002E, 0x002E, 0x0037, 0x003F, 0x0000, 0x0000, 0x0002, 0x0010,
  121. ESC_REG(ST7735_NORON),
  122. ESC_REG(ST7735_DISPON),
  123. ESC_END
  124. };