My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ssd1963.h 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 SSD1963_MADCTL_MY 0x80 // Row Address Order
  26. #define SSD1963_MADCTL_MX 0x40 // Column Address Order
  27. #define SSD1963_MADCTL_MV 0x20 // Row/Column Exchange
  28. #define SSD1963_MADCTL_MH 0x10 // Horizontal Refresh Order
  29. #define SSD1963_MADCTL_BGR 0x08 // RGB-BGR ORDER
  30. #define SSD1963_MADCTL_RGB 0x00
  31. #define SSD1963_MADCTL_ML 0x04 // Vertical Refresh Order
  32. #define SSD1963_MADCTL_FH 0x02 // Flip Horizontal
  33. #define SSD1963_MADCTL_FV 0x01 // Flip Vertical
  34. #define SSD1963_ORIENTATION IF_0((TFT_ORIENTATION) & TFT_EXCHANGE_XY, SSD1963_MADCTL_MV) | \
  35. IF_0((TFT_ORIENTATION) & TFT_INVERT_X, SSD1963_MADCTL_FH) | \
  36. IF_0((TFT_ORIENTATION) & TFT_INVERT_Y, SSD1963_MADCTL_FV)
  37. #if !defined(TFT_COLOR) || TFT_COLOR == TFT_COLOR_BGR
  38. #define SSD1963_COLOR SSD1963_MADCTL_BGR
  39. #elif TFT_COLOR == TFT_COLOR_RGB
  40. #define SSD1963_COLOR SSD1963_MADCTL_RGB
  41. #endif
  42. #define SSD1963_MADCTL_DATA (SSD1963_ORIENTATION) | (SSD1963_COLOR)
  43. #define SSD1963_NOP 0x00 // No Operation
  44. #define SSD1963_SWRESET 0x01 // Software reset
  45. #define SSD1963_RDDPM 0x0A // Read Display Power Mode
  46. #define SSD1963_RDDMADCTL 0x0B // Read Display MADCTL
  47. #define SSD1963_RDDCOLMOD 0x0C // Read Display Pixel Format
  48. #define SSD1963_RDDIM 0x0D // Read Display Image Mode
  49. #define SSD1963_RDDSM 0x0E // Read Display Signal Mode
  50. #define SSD1963_SLPIN 0x10 // Sleep In
  51. #define SSD1963_SLPOUT 0x11 // Sleep Out
  52. #define SSD1963_PTLON 0x12 // Partial Display Mode On
  53. #define SSD1963_NORON 0x13 // Normal Display Mode On
  54. #define SSD1963_INVOFF 0x20 // Display Inversion Off
  55. #define SSD1963_INVON 0x21 // Display Inversion On
  56. #define SSD1963_GAMSET 0x26 // Gamma Set
  57. #define SSD1963_DISPOFF 0x28 // Display Off
  58. #define SSD1963_DISPON 0x29 // Display On
  59. #define SSD1963_CASET 0x2A // Column Address Set
  60. #define SSD1963_RASET 0x2B // Row Address Set
  61. #define SSD1963_RAMWR 0x2C // Memory Write
  62. #define SSD1963_RAMRD 0x2E // Memory Read
  63. #define SSD1963_PTLAR 0x30 // Partial Area
  64. #define SSD1963_VSCRDEF 0x33 // Vertical Scrolling Definition
  65. #define SSD1963_TEOFF 0x34 // Tearing Effect Line OFF
  66. #define SSD1963_TEON 0x35 // Tearing Effect Line ON
  67. #define SSD1963_MADCTL 0x36 // Memory Data Access Control
  68. #define SSD1963_VSCSAD 0x37 // Vertical Scroll Start Address of RAM
  69. #define SSD1963_IDMOFF 0x38 // Idle Mode Off
  70. #define SSD1963_IDMON 0x39 // Idle Mode On
  71. #define SSD1963_WRMEMC 0x3C // Write Memory Continue
  72. #define SSD1963_RDMEMC 0x3E // Read Memory Continue
  73. #define SSD1963_STE 0x44 // Set Tear Scanline
  74. #define SSD1963_GSCAN 0x45 // Get Scanline
  75. #define SSD1963_WRDISBV 0x51 // Write Display Brightness
  76. #define SSD1963_RDDISBV 0x52 // Read Display Brightness
  77. #define SSD1963_WRCTRLD 0x53 // Write CTRL Display
  78. #define SSD1963_RDCTRLD 0x54 // Read CTRL Value Display
  79. #define SSD1963_WRCACE 0x55 // Write Content Adaptive Brightness Control and Color Enhancement
  80. #define SSD1963_RDCABC 0x56 // Read Content Adaptive Brightness Control
  81. #define SSD1963_WRCABCMB 0x5E // Write CABC Minimum Brightness
  82. #define SSD1963_RDCABCMB 0x5F // Read CABC Minimum Brightness
  83. #define SSD1963_RDABCSDR 0x68 // Read Automatic Brightness Control Self-Diagnostic Result
  84. #define SSD1963_RDDDB 0xA1 // Read Device Descriptor Block
  85. #define SSD1963_SLCDMODE 0xB0 // Set the LCD panel mode and resolution
  86. #define SSD1963_SHSYNC 0xB4 // Set HSYNC
  87. #define SSD1963_GHSYNC 0xB5 // Get HSYNC
  88. #define SSD1963_SVSYNC 0xB6 // Set VSYNC
  89. #define SSD1963_GVSYNC 0xB7 // Get VSYNC
  90. #define SSD1963_SGPIOCFG 0xB8 // Set GPIO Conf
  91. #define SSD1963_SGPIOV 0xBA // Set GPIO Value
  92. #define SSD1963_SPWMCFG 0xBE // Set PWM Conf
  93. #define SSD1963_GPWMCFG 0xBF // Get PWM Conf
  94. #define SSD1963_SDBCCFG 0xD0 // Set Dynamic Back Light Config
  95. #define SSD1963_GDBCCFG 0xD1 // Get Dynamic Back Light Config
  96. #define SSD1963_PLLON 0xE0 // PLL Enable
  97. #define SSD1963_PLLMN 0xE2 // Set PLL Multiplier
  98. #define SSD1963_SLSHIFT 0xE6 // Set the LSHIFT (pixel clock) frequency
  99. #define SSD1963_COLMOD 0xF0 // Interface Pixel Format
  100. static const uint16_t ssd1963_init[] = {
  101. DATASIZE_8BIT,
  102. ESC_REG(SSD1963_PLLMN), 0x0023, 0x0002, 0x0054,
  103. ESC_REG(SSD1963_PLLON), 0x0001, ESC_DELAY(10),
  104. ESC_REG(SSD1963_PLLON), 0x0003, ESC_DELAY(10),
  105. ESC_REG(SSD1963_SWRESET), ESC_DELAY(100),
  106. ESC_REG(SSD1963_SLSHIFT), 0x0001, 0x001F, 0x00FF,
  107. ESC_REG(SSD1963_SLCDMODE), 0x0020, 0x0000, 0x0001, 0x00DF, 0x0001, 0x000F, 0x0000,
  108. ESC_REG(SSD1963_SHSYNC), 0x0002, 0x0013, 0x0000, 0x0008, 0x002B, 0x0000, 0x0002, 0x0000,
  109. ESC_REG(SSD1963_SVSYNC), 0x0001, 0x0020, 0x0000, 0x0004, 0x000C, 0x0000, 0x0002,
  110. ESC_REG(SSD1963_SGPIOV), 0x000F,
  111. ESC_REG(SSD1963_SGPIOCFG), 0x0007, 0x0001,
  112. ESC_REG(SSD1963_MADCTL), SSD1963_MADCTL_DATA,
  113. ESC_REG(SSD1963_COLMOD), 0x0003, ESC_DELAY(1),//RBG 565
  114. ESC_REG(SSD1963_NORON),
  115. ESC_REG(SSD1963_DISPON),
  116. ESC_REG(SSD1963_SPWMCFG), 0x0006, 0x00f0, 0x0001, 0x00f0, 0x0000, 0x0000,
  117. ESC_REG(SSD1963_SDBCCFG), 0x000D,
  118. ESC_END
  119. };