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.

resolutions.h 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*****************
  2. * resolutions.h *
  3. *****************/
  4. /****************************************************************************
  5. * Written By Mark Pelletier 2019 - Aleph Objects, Inc. *
  6. * Written By Marcio Teixeira 2019 - Aleph Objects, Inc. *
  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. * To view a copy of the GNU General Public License, go to the following *
  19. * location: <http://www.gnu.org/licenses/>. *
  20. ****************************************************************************/
  21. #pragma once
  22. /***
  23. * The FT8xx has odd registers that don't correspond to timing values in
  24. * display datasheets. This macro computes the register values using the
  25. * formulas given in the document:
  26. *
  27. * Bridgetek Application Note
  28. * AN_336 FT8xx
  29. * Selecting an LCD Display
  30. * Version 2.1
  31. * Issue Date: 2017-11-14
  32. *
  33. */
  34. #define COMPUTE_REGS_FROM_DATASHEET \
  35. constexpr uint16_t Hoffset = thfp + thb - 1; \
  36. constexpr uint16_t Hcycle = th; \
  37. constexpr uint16_t Hsync0 = thfp - 1 ; \
  38. constexpr uint16_t Hsync1 = thfp + thpw - 1; \
  39. constexpr uint16_t Voffset = tvfp + tvb - 1; \
  40. constexpr uint16_t Vcycle = tv; \
  41. constexpr uint16_t Vsync0 = tvfp - 1; \
  42. constexpr uint16_t Vsync1 = tvfp + tvpw - 1; \
  43. static_assert(thfp + thb + Hsize == th, "Mismatch in display th"); \
  44. static_assert(tvfp + tvb + Vsize == tv, "Mismatch in display tv");
  45. #ifdef TOUCH_UI_320x240
  46. namespace FTDI {
  47. constexpr uint8_t Pclk = 8;
  48. constexpr uint8_t Pclkpol = 0;
  49. constexpr uint16_t Hsize = 320;
  50. constexpr uint16_t Vsize = 240;
  51. constexpr uint16_t Vsync0 = 0;
  52. constexpr uint16_t Vsync1 = 2;
  53. constexpr uint16_t Voffset = 13;
  54. constexpr uint16_t Vcycle = 263;
  55. constexpr uint16_t Hsync0 = 0;
  56. constexpr uint16_t Hsync1 = 10;
  57. constexpr uint16_t Hoffset = 70;
  58. constexpr uint16_t Hcycle = 408;
  59. constexpr uint32_t default_transform_a = 0x000054ad;
  60. constexpr uint32_t default_transform_b = 0xffffff52;
  61. constexpr uint32_t default_transform_c = 0xfff7f6e4;
  62. constexpr uint32_t default_transform_d = 0x00000065;
  63. constexpr uint32_t default_transform_e = 0xffffbe3b;
  64. constexpr uint32_t default_transform_f = 0x00f68e75;
  65. }
  66. #elif defined(TOUCH_UI_480x272)
  67. namespace FTDI {
  68. constexpr uint8_t Pclk = 7;
  69. constexpr uint8_t Pclkpol = 1;
  70. constexpr uint16_t Hsize = 480;
  71. constexpr uint16_t Vsize = 272;
  72. constexpr uint16_t th = 525; // One horizontal line
  73. constexpr uint16_t thfp = 43; // HS Front porch
  74. constexpr uint16_t thb = 2; // HS Back porch (blanking)
  75. constexpr uint16_t thpw = 41; // HS pulse width
  76. constexpr uint16_t tv = 286; // Vertical period time
  77. constexpr uint16_t tvfp = 12; // VS Front porch
  78. constexpr uint16_t tvb = 2; // VS Back porch (blanking)
  79. constexpr uint16_t tvpw = 10; // VS pulse width
  80. COMPUTE_REGS_FROM_DATASHEET
  81. constexpr uint32_t default_transform_a = 0x00008100;
  82. constexpr uint32_t default_transform_b = 0x00000000;
  83. constexpr uint32_t default_transform_c = 0xFFF18000;
  84. constexpr uint32_t default_transform_d = 0x00000000;
  85. constexpr uint32_t default_transform_e = 0xFFFFB100;
  86. constexpr uint32_t default_transform_f = 0x0120D000;
  87. }
  88. #elif defined(TOUCH_UI_800x480)
  89. namespace FTDI {
  90. constexpr uint8_t Pclk = 3;
  91. constexpr uint8_t Pclkpol = 1;
  92. constexpr uint16_t Hsize = 800;
  93. constexpr uint16_t Vsize = 480;
  94. constexpr uint16_t th = 1056; // One horizontal line
  95. constexpr uint16_t thfp = 210; // HS Front porch
  96. constexpr uint16_t thb = 46; // HS Back porch (blanking)
  97. constexpr uint16_t thpw = 23; // HS pulse width
  98. constexpr uint16_t tv = 525; // Vertical period time
  99. constexpr uint16_t tvfp = 22; // VS Front porch
  100. constexpr uint16_t tvb = 23; // VS Back porch (blanking)
  101. constexpr uint16_t tvpw = 10; // VS pulse width
  102. COMPUTE_REGS_FROM_DATASHEET
  103. constexpr uint32_t default_transform_a = 0x0000D8B9;
  104. constexpr uint32_t default_transform_b = 0x00000124;
  105. constexpr uint32_t default_transform_c = 0xFFE23926;
  106. constexpr uint32_t default_transform_d = 0xFFFFFF51;
  107. constexpr uint32_t default_transform_e = 0xFFFF7E4F;
  108. constexpr uint32_t default_transform_f = 0x01F0AF70;
  109. }
  110. #else
  111. #error "Unknown or no TOUCH_UI_FTDI_EVE display resolution specified. To add a display resolution, modify 'ftdi_eve_resolutions.h'."
  112. #endif