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.h 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. /********************************************************************************
  24. * @file dwin_lcd.h
  25. * @author LEO / Creality3D
  26. * @date 2019/07/18
  27. * @version 2.0.1
  28. * @brief 迪文屏控制操作函数
  29. ********************************************************************************/
  30. #include <stdint.h>
  31. #define RECEIVED_NO_DATA 0x00
  32. #define RECEIVED_SHAKE_HAND_ACK 0x01
  33. #define FHONE 0xAA
  34. #define DWIN_SCROLL_UP 2
  35. #define DWIN_SCROLL_DOWN 3
  36. #define DWIN_WIDTH 272
  37. #define DWIN_HEIGHT 480
  38. /*接收数据解析 返回值:true,接收到数据;false,未接收到数据*/
  39. bool DWIN_ReceiveAnalyze(void);
  40. /*发送当前BUF中的数据以及包尾数据 len:整包数据长度*/
  41. void DWIN_Send_BufTail(const uint8_t len);
  42. /*----------------------------------------------系统变量函数----------------------------------------------*/
  43. /*握手 1: 握手成功 2: 握手失败*/
  44. bool DWIN_Handshake(void);
  45. /*设定背光亮度 luminance:亮度(0x00~0xFF)*/
  46. void DWIN_Backlight_SetLuminance(const uint8_t luminance);
  47. /*设定画面显示方向 dir:0,0°; 1,90°; 2,180°; 3,270°*/
  48. void DWIN_Frame_SetDir(uint8_t dir);
  49. /*更新显示*/
  50. void DWIN_UpdateLCD(void);
  51. /*----------------------------------------------绘图相关函数----------------------------------------------*/
  52. /*画面清屏 color:清屏颜色*/
  53. void DWIN_Frame_Clear(const uint16_t color);
  54. /*画面画线 color:线段颜色 xStart:X起始坐标 yStart:Y起始坐标 xEnd:X终止坐标 yEnd:Y终止坐标*/
  55. void DWIN_Draw_Line(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd);
  56. /*画面画矩形 mode:0,外框;1,填充;2,异或填充 color:颜色 xStart/yStart:矩形左上坐标 xEnd/yEnd:矩形右下坐标*/
  57. void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color,
  58. uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd);
  59. /*画面区域移动 mode:0,环移;1,平移 dir:0,向左移动;1,向右移动;2,向上移动;3,向下移动 dis:移动距离
  60. color:填充颜色 xStart/yStart:选定区域左上坐标 xEnd/yEnd:选定区域右下坐标*/
  61. void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
  62. uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd);
  63. /*----------------------------------------------文本相关函数----------------------------------------------*/
  64. /*画面显示字符串 widthAdjust:true,自调整字符宽度;false,不调整字符宽度 bShow:true,显示背景色;false,不显示背景色 size:字号大小
  65. color:字符颜色 bColor:背景颜色 x/y:字符串左上坐标 *string:字符串*/
  66. void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size,
  67. uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, char *string);
  68. /*画面显示正整数 bShow:true,显示背景色;false,不显示背景色 zeroFill:true,补零;false,不补零 zeroMode:1,无效0显示为0; 0,无效0显示为空格 size:字号大小
  69. color:字符颜色 bColor:背景颜色 iNum:位数 x/y:变量左上坐标 value:整型变量*/
  70. void DWIN_Draw_IntValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
  71. uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, uint16_t value);
  72. /*画面显示浮点数 bShow:true,显示背景色;false,不显示背景色 zeroFill:true,补零;false,不补零 zeroMode:1,无效0显示为0; 0,无效0显示为空格 size:字号大小
  73. color:字符颜色 bColor:背景颜色 iNum:整数位数 fNum:小数位数 x/y:变量左上坐标 value:浮点数变量*/
  74. void DWIN_Draw_FloatValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
  75. uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value);
  76. /*----------------------------------------------图片相关函数----------------------------------------------*/
  77. /*jpg图片显示并缓存在#0虚拟显示区 id:图片ID*/
  78. void DWIN_JPG_ShowAndCache(const uint8_t id);
  79. /*图标显示 libID:图标库ID picID:图标ID x/y:图标左上坐标*/
  80. void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y);
  81. /*jpg图片解压到#1虚拟显示区 id:图片ID*/
  82. void DWIN_JPG_CacheToN(uint8_t n, uint8_t id);
  83. /*jpg图片解压到#1虚拟显示区 id:图片ID*/
  84. inline void DWIN_JPG_CacheTo1(uint8_t id) { DWIN_JPG_CacheToN(1, id); }
  85. /*从虚拟显示区复制区域至当前画面 cacheID:虚拟区号 xStart/yStart:虚拟区左上坐标 xEnd/yEnd:虚拟区右下坐标 x/y:当前画面粘贴坐标*/
  86. void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart,
  87. uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y);