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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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_queue.h"
  24. #include "canvas.h"
  25. #include "tft_color.h"
  26. #include "tft_string.h"
  27. #include "tft_image.h"
  28. #include "../tft_io/tft_io.h"
  29. #include "../../inc/MarlinConfig.h"
  30. #if ENABLED(TFT_INTERFACE_FSMC_8BIT)
  31. // When we have a 8 bit interface, we need to invert the bytes of the color
  32. #define ENDIAN_COLOR(C) (((C) >> 8) | ((C) << 8))
  33. #else
  34. #define ENDIAN_COLOR(C) (C)
  35. #endif
  36. #if HAS_UI_320x240
  37. #define TFT_WIDTH 320
  38. #define TFT_HEIGHT 240
  39. #elif HAS_UI_480x320
  40. #define TFT_WIDTH 480
  41. #define TFT_HEIGHT 320
  42. #elif HAS_UI_480x272
  43. #define TFT_WIDTH 480
  44. #define TFT_HEIGHT 272
  45. #elif HAS_UI_1024x600
  46. #define TFT_WIDTH 1024
  47. #define TFT_HEIGHT 600
  48. #else
  49. #error "Unsupported display resolution!"
  50. #endif
  51. #ifndef TFT_BUFFER_SIZE
  52. #ifdef STM32F103xB
  53. #define TFT_BUFFER_SIZE 1024
  54. #elif defined(STM32F103xE)
  55. #define TFT_BUFFER_SIZE 19200 // 320 * 60
  56. #elif defined(STM32F1)
  57. #define TFT_BUFFER_SIZE 8192
  58. #else
  59. #define TFT_BUFFER_SIZE 19200 // 320 * 60
  60. #endif
  61. #endif
  62. #if TFT_BUFFER_SIZE > 65535
  63. // DMA Count parameter is uint16_t
  64. #error "TFT_BUFFER_SIZE can not exceed 65535"
  65. #endif
  66. class TFT {
  67. private:
  68. static TFT_String string;
  69. static TFT_IO io;
  70. public:
  71. static TFT_Queue queue;
  72. static uint16_t buffer[TFT_BUFFER_SIZE];
  73. static void init();
  74. static void set_font(const uint8_t *Font) { string.set_font(Font); }
  75. static void add_glyphs(const uint8_t *Font) { string.add_glyphs(Font); }
  76. static bool is_busy() { return io.isBusy(); }
  77. static void abort() { io.Abort(); }
  78. static void write_multiple(uint16_t Data, uint16_t Count) { io.WriteMultiple(Data, Count); }
  79. static void write_sequence(uint16_t *Data, uint16_t Count) { io.WriteSequence(Data, Count); }
  80. static void set_window(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax) { io.set_window(Xmin, Ymin, Xmax, Ymax); }
  81. static void fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.fill(x, y, width, height, color); }
  82. static void canvas(uint16_t x, uint16_t y, uint16_t width, uint16_t height) { queue.canvas(x, y, width, height); }
  83. static void set_background(uint16_t color) { queue.set_background(color); }
  84. static void add_text(uint16_t x, uint16_t y, uint16_t color, TFT_String tft_string, uint16_t maxWidth = 0) { queue.add_text(x, y, color, tft_string.string(), maxWidth); }
  85. static void add_text(uint16_t x, uint16_t y, uint16_t color, const char *string, uint16_t maxWidth = 0) { queue.add_text(x, y, color, string, maxWidth); }
  86. static void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t *colors) { queue.add_image(x, y, image, colors); }
  87. static void add_image(int16_t x, int16_t y, MarlinImage image, uint16_t color_main = COLOR_WHITE, uint16_t color_background = COLOR_BACKGROUND, uint16_t color_shadow = COLOR_BLACK) { queue.add_image(x, y, image, color_main, color_background, color_shadow); }
  88. static void add_bar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_bar(x, y, width, height, color); }
  89. static void add_rectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.add_rectangle(x, y, width, height, color); }
  90. static void draw_edit_screen_buttons();
  91. };
  92. extern TFT tft;