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.

dwin_lcd.cpp 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. /********************************************************************************
  23. * @file lcd/e3v2/creality/dwin_lcd.cpp
  24. * @author LEO / Creality3D
  25. * @date 2019/07/18
  26. * @version 2.0.1
  27. * @brief DWIN screen control functions
  28. ********************************************************************************/
  29. #include "../../../inc/MarlinConfigPre.h"
  30. #if ENABLED(DWIN_CREALITY_LCD)
  31. #include "../../../inc/MarlinConfig.h"
  32. #include "dwin_lcd.h"
  33. //#define DEBUG_OUT 1
  34. #include "../../../core/debug_out.h"
  35. /*-------------------------------------- System variable function --------------------------------------*/
  36. void DWIN_Startup() {
  37. DEBUG_ECHOPGM("\r\nDWIN handshake ");
  38. delay(750); // Delay here or init later in the boot process
  39. if (DWIN_Handshake()) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error.");
  40. DWIN_Frame_SetDir(1);
  41. #if DISABLED(SHOW_BOOTSCREEN)
  42. DWIN_Frame_Clear(Color_Bg_Black); // MarlinUI handles the bootscreen so just clear here
  43. #endif
  44. DWIN_JPG_ShowAndCache(3);
  45. DWIN_UpdateLCD();
  46. }
  47. /*---------------------------------------- Picture related functions ----------------------------------------*/
  48. // Draw an Icon
  49. // libID: Icon library ID
  50. // picID: Icon ID
  51. // x/y: Upper-left point
  52. void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
  53. DWIN_ICON_Show(true, false, false, libID, picID, x, y);
  54. }
  55. // Copy area from virtual display area to current screen
  56. // cacheID: virtual area number
  57. // xStart/yStart: Upper-left of virtual area
  58. // xEnd/yEnd: Lower-right of virtual area
  59. // x/y: Screen paste point
  60. void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) {
  61. size_t i = 0;
  62. DWIN_Byte(i, 0x27);
  63. DWIN_Byte(i, 0x80 | cacheID);
  64. DWIN_Word(i, xStart);
  65. DWIN_Word(i, yStart);
  66. DWIN_Word(i, xEnd);
  67. DWIN_Word(i, yEnd);
  68. DWIN_Word(i, x);
  69. DWIN_Word(i, y);
  70. DWIN_Send(i);
  71. }
  72. #endif // DWIN_CREALITY_LCD