123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527 |
- /**
- * Marlin 3D Printer Firmware
- * Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
- *
- * Based on Sprinter and grbl.
- * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- */
- #pragma once
-
- /**
- * DWIN Enhanced implementation for PRO UI
- * Author: Miguel A. Risco-Castillo (MRISCOC)
- * Version: 3.17.1
- * Date: 2022/04/12
- *
- * Modded for JYERSUI by LCH-77
- * Version: 1.9
- * Date: Jun 16, 2022
- */
-
- #include "dwin_lcd.h"
- #include "../common/dwin_set.h"
- #include "../common/dwin_font.h"
- #include "../common/dwin_color.h"
- #include "../common/dwin_api.h"
-
- // Custom icons
- //#define DWIN_CREALITY_LCD_CUSTOM_ICONS
- #if ENABLED(DWIN_CREALITY_LCD_CUSTOM_ICONS)
- // index of every custom icon should be >= CUSTOM_ICON_START
- #define CUSTOM_ICON_START ICON_Checkbox_F
- #define ICON_Checkbox_F 200
- #define ICON_Checkbox_T 201
- #define ICON_Fade 202
- #define ICON_Mesh 203
- #define ICON_Tilt 204
- #define ICON_Brightness 205
- #define ICON_AxisD 249
- #define ICON_AxisBR 250
- #define ICON_AxisTR 251
- #define ICON_AxisBL 252
- #define ICON_AxisTL 253
- #define ICON_AxisC 254
- #else
- #define ICON_Fade ICON_Version
- #define ICON_Mesh ICON_Version
- #define ICON_Tilt ICON_Version
- #define ICON_Brightness ICON_Version
- #define ICON_AxisD ICON_Axis
- #define ICON_AxisBR ICON_Axis
- #define ICON_AxisTR ICON_Axis
- #define ICON_AxisBL ICON_Axis
- #define ICON_AxisTL ICON_Axis
- #define ICON_AxisC ICON_Axis
- #define ICON_ESDiag ICON_Info
- #define ICON_Lock ICON_Cool
- #define ICON_Reboot ICON_ResumeEEPROM
- #define ICON_ProbeAlarm ICON_SetEndTemp
- #define ICON_ProbeMargin ICON_PrintSize
- #define ICON_ProbeSelfTest ICON_SetEndTemp
- #define ICON_ProbeSet ICON_SetEndTemp
- #define ICON_ProbeDeploy ICON_SetEndTemp
- #define ICON_ProbeTest ICON_SetEndTemp
- #define ICON_ProbeTestCount ICON_SetEndTemp
- #define ICON_ProbeZSpeed ICON_MaxSpeedZ
- #define ICON_FWRetLength ICON_StepE
- #define ICON_FWRetSpeed ICON_Setspeed
- #define ICON_FWRetZRaise ICON_MoveZ
- #define ICON_FWRecExtLength ICON_StepE
- #define ICON_FWRecSpeed ICON_Setspeed
- #define ICON_HSMode ICON_StockConfiguration
- #define ICON_Sound ICON_Cool
- #define ICON_CaseLight ICON_Motion
- #define ICON_LedControl ICON_Motion
- #define ICON_MeshActive ICON_HotendTemp
- #define ICON_Park ICON_Motion
- #endif
-
- // Buttons
- #define BTN_Continue 85
- #define BTN_Cancel 87
- #define BTN_Confirm 89
- #define BTN_Print 90
- #define BTN_Save 91
- #define BTN_Purge 92
-
- // Extended UI Colors
- #define Color_Aqua RGB(0,63,31)
- #define Color_Light_White 0xBDD7
- #define Color_Green RGB(0,63,0)
- #define Color_Light_Green 0x3460
- #define Color_Cyan 0x07FF
- #define Color_Light_Cyan 0x04F3
- #define Color_Blue RGB(0,0,31)
- #define Color_Light_Blue 0x3A6A
- #define Color_Magenta 0xF81F
- #define Color_Light_Magenta 0x9813
- #define Color_Light_Red 0x8800
- #define Color_Orange 0xFA20
- #define Color_Light_Orange 0xFBC0
- #define Color_Light_Yellow 0x8BE0
- #define Color_Brown 0xCC27
- #define Color_Light_Brown 0x6204
- #define Color_Black 0x0000
- #define Color_Grey 0x18E3
- #define Check_Color 0x4E5C
- #define Confirm_Color 0x34B9
- #define Cancel_Color 0x3186
-
- // UI element defines and constants
- #define DWIN_FONT_MENU font8x16
- #define DWIN_FONT_STAT font10x20
- #define DWIN_FONT_HEAD font10x20
- #define DWIN_FONT_ALERT font10x20
- #define STATUS_Y 354
- #define LCD_WIDTH (DWIN_WIDTH / 8) // only if the default font is font8x16
-
- // Minimum unit (0.1) : multiple (10)
- #define UNITFDIGITS 1
- #define MINUNITMULT POW(10, UNITFDIGITS)
-
- constexpr uint8_t TITLE_HEIGHT = 30, // Title bar height
- MLINE = 53, // Menu line height
- TROWS = (STATUS_Y - TITLE_HEIGHT) / MLINE, // Total rows
- MROWS = TROWS - 1, // Other-than-Back
- ICOX = 26, // Menu item icon X position
- LBLX = 60, // Menu item label X position
- VALX = 210, // Menu item value X position
- MENU_CHR_W = 8, MENU_CHR_H = 16, // Menu font 8x16
- STAT_CHR_W = 10;
-
- // Menuitem Y position
- #define MYPOS(L) (TITLE_HEIGHT + MLINE * (L))
-
- // Menuitem caption Offset
- #define CAPOFF ((MLINE - MENU_CHR_H) / 2)
-
- // Menuitem caption Y position
- #define MBASE(L) (MYPOS(L) + CAPOFF)
-
- typedef struct { uint16_t left, top, right, bottom; } rect_t;
- typedef struct { uint16_t x, y, w, h; } frame_rect_t;
-
- namespace DWINUI {
- extern xy_int_t cursor;
- extern uint16_t pencolor;
- extern uint16_t textcolor;
- extern uint16_t backcolor;
- extern uint16_t buttoncolor;
- extern uint8_t font;
- extern FSTR_P const Author;
-
- // DWIN LCD Initialization
- void init();
-
- // Set text/number font
- void setFont(uint8_t cfont);
-
- // Get font character width
- uint8_t fontWidth(uint8_t cfont);
- inline uint8_t fontWidth() { return fontWidth(font); };
-
- // Get font character height
- uint8_t fontHeight(uint8_t cfont);
- inline uint8_t fontHeight() { return fontHeight(font); };
-
- // Get screen x coordinates from text column
- uint16_t ColToX(uint8_t col);
-
- // Get screen y coordinates from text row
- uint16_t RowToY(uint8_t row);
-
- // Set text/number color
- void SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor);
- void SetTextColor(uint16_t fgcolor);
- void SetBackgroundColor(uint16_t bgcolor);
-
- // Moves cursor to point
- // x: abscissa of the display
- // y: ordinate of the display
- // point: xy coordinate
- void MoveTo(int16_t x, int16_t y);
- void MoveTo(xy_int_t point);
-
- // Moves cursor relative to the actual position
- // x: abscissa of the display
- // y: ordinate of the display
- // point: xy coordinate
- void MoveBy(int16_t x, int16_t y);
- void MoveBy(xy_int_t point);
-
- // Draw a line from the cursor to xy position
- // color: Line segment color
- // x/y: End point
- inline void LineTo(uint16_t color, uint16_t x, uint16_t y) {
- DWIN_Draw_Line(color, cursor.x, cursor.y, x, y);
- }
- inline void LineTo(uint16_t x, uint16_t y) {
- DWIN_Draw_Line(pencolor, cursor.x, cursor.y, x, y);
- }
-
- // Extend a frame box
- // v: value to extend
- inline frame_rect_t ExtendFrame(frame_rect_t frame, uint8_t v) {
- frame_rect_t t;
- t.x = frame.x - v;
- t.y = frame.y - v;
- t.w = frame.w + 2 * v;
- t.h = frame.h + 2 * v;
- return t;
- }
-
- // Draw an Icon with transparent background from the library ICON
- // icon: Icon ID
- // x/y: Upper-left point
- inline void Draw_Icon(uint8_t icon, uint16_t x, uint16_t y) {
- DWIN_ICON_Show(ICON, icon, x, y);
- }
-
- // Draw an Icon from the library ICON with its background
- // icon: Icon ID
- // x/y: Upper-left point
- inline void Draw_IconWB(uint8_t icon, uint16_t x, uint16_t y) {
- DWIN_ICON_Show(true, false, false, ICON, icon, x, y);
- }
- inline void DRAW_IconWB(uint8_t libID, uint8_t icon, uint16_t x, uint16_t y) {
- DWIN_ICON_Show(true, false, false, libID, icon, x, y);
- }
-
- // Draw a numeric integer value
- // bShow: true=display background color; false=don't display background color
- // signedMode: 1=signed; 0=unsigned
- // size: Font size
- // color: Character color
- // bColor: Background color
- // iNum: Number of digits
- // x/y: Upper-left coordinate
- // value: Integer value
- void Draw_Int(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value);
-
- // Draw a positive integer
- inline void Draw_Int(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
- Draw_Int(bShow, 0, size, color, bColor, iNum, x, y, value);
- }
- inline void Draw_Int(uint8_t iNum, long value) {
- Draw_Int(false, 0, font, textcolor, backcolor, iNum, cursor.x, cursor.y, value);
- MoveBy(iNum * fontWidth(font), 0);
- }
- inline void Draw_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) {
- Draw_Int(false, 0, font, textcolor, backcolor, iNum, x, y, value);
- }
- inline void Draw_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) {
- Draw_Int(false, 0, font, color, backcolor, iNum, x, y, value);
- }
- inline void Draw_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
- Draw_Int(true, 0, font, color, bColor, iNum, x, y, value);
- }
- inline void Draw_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
- Draw_Int(true, 0, size, color, bColor, iNum, x, y, value);
- }
-
- // Draw a signed integer
- inline void Draw_Signed_Int(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
- Draw_Int(bShow, 1, size, color, bColor, iNum, x, y, value);
- }
- inline void Draw_Signed_Int(uint8_t iNum, long value) {
- Draw_Int(false, 1, font, textcolor, backcolor, iNum, cursor.x, cursor.y, value);
- MoveBy(iNum * fontWidth(font), 0);
- }
- inline void Draw_Signed_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) {
- Draw_Int(false, 1, font, textcolor, backcolor, iNum, x, y, value);
- }
- inline void Draw_Signed_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) {
- Draw_Int(false, 1, font, color, backcolor, iNum, x, y, value);
- }
- inline void Draw_Signed_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
- Draw_Int(true, 1, font, color, bColor, iNum, x, y, value);
- }
- inline void Draw_Signed_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
- Draw_Int(true, 1, size, color, bColor, iNum, x, y, value);
- }
-
- // Draw a numeric float value
- // bShow: true=display background color; false=don't display background color
- // signedMode: 1=signed; 0=unsigned
- // size: Font size
- // color: Character color
- // bColor: Background color
- // iNum: Number of digits
- // fNum: Number of decimal digits
- // x/y: Upper-left coordinate
- // value: float value
- void Draw_Float(uint8_t bShow, bool signedMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value);
-
- // Draw a positive floating point number
- inline void Draw_Float(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
- Draw_Float(bShow, 0, size, color, bColor, iNum, fNum, x, y, value);
- }
- inline void Draw_Float(uint8_t iNum, uint8_t fNum, float value) {
- Draw_Float(false, 0, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value);
- MoveBy((iNum + fNum + 1) * fontWidth(font), 0);
- }
- inline void Draw_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
- Draw_Float(false, 0, font, textcolor, backcolor, iNum, fNum, x, y, value);
- }
- inline void Draw_Float(uint8_t size, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
- Draw_Float(false, 0, size, textcolor, backcolor, iNum, fNum, x, y, value);
- }
- inline void Draw_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
- Draw_Float(true, 0, font, color, bColor, iNum, fNum, x, y, value);
- }
- inline void Draw_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
- Draw_Float(true, 0, size, color, bColor, iNum, fNum, x, y, value);
- }
-
- // Draw a signed floating point number
- inline void Draw_Signed_Float(uint8_t bShow, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
- Draw_Float(bShow, 1, size, color, bColor, iNum, fNum, x, y, value);
- }
- inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, float value) {
- Draw_Float(false, 1, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value);
- MoveBy((iNum + fNum + 1) * fontWidth(font), 0);
- }
- inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
- Draw_Float(false, 1, font, textcolor, backcolor, iNum, fNum, x, y, value);
- }
- inline void Draw_Signed_Float(uint8_t size, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
- Draw_Float(false, 1, size, textcolor, backcolor, iNum, fNum, x, y, value);
- }
- inline void Draw_Signed_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
- Draw_Float(true, 1, font, color, bColor, iNum, fNum, x, y, value);
- }
- inline void Draw_Signed_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
- Draw_Float(true, 1, size, color, bColor, iNum, fNum, x, y, value);
- }
-
- // Draw a char
- // color: Character color
- // x: abscissa of the display
- // y: ordinate of the display
- // c: ASCII code of char
- void Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c);
- inline void Draw_Char(uint16_t x, uint16_t y, const char c) { Draw_Char(textcolor, x, y, c); };
- // Draw a char at cursor position and increment cursor
- void Draw_Char(uint16_t color, const char c);
- inline void Draw_Char(const char c) { Draw_Char(textcolor, c); }
-
- // Draw a string at cursor position
- // color: Character color
- // *string: The string
- // rlimit: For draw less chars than string length use rlimit
- void Draw_String(const char * const string, uint16_t rlimit = 0xFFFF);
- void Draw_String(uint16_t color, const char * const string, uint16_t rlimit = 0xFFFF);
- inline void Draw_String(FSTR_P string, uint16_t rlimit = 0xFFFF) {
- Draw_String(FTOP(string), rlimit);
- }
- inline void Draw_String(uint16_t color, FSTR_P string, uint16_t rlimit = 0xFFFF) {
- Draw_String(color, FTOP(string), rlimit);
- }
-
- // Draw a string
- // size: Font size
- // color: Character color
- // bColor: Background color
- // x/y: Upper-left coordinate of the string
- // *string: The string
- inline void Draw_String(uint16_t x, uint16_t y, const char * const string) {
- DWIN_Draw_String(false, font, textcolor, backcolor, x, y, string);
- }
- inline void Draw_String(uint16_t x, uint16_t y, FSTR_P title) {
- DWIN_Draw_String(false, font, textcolor, backcolor, x, y, FTOP(title));
- }
- inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const char * const string) {
- DWIN_Draw_String(false, font, color, backcolor, x, y, string);
- }
- inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, FSTR_P title) {
- DWIN_Draw_String(false, font, color, backcolor, x, y, title);
- }
- inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) {
- DWIN_Draw_String(true, font, color, bgcolor, x, y, string);
- }
- inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) {
- DWIN_Draw_String(true, font, color, bgcolor, x, y, title);
- }
- inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) {
- DWIN_Draw_String(true, size, color, bgcolor, x, y, string);
- }
- inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) {
- DWIN_Draw_String(true, size, color, bgcolor, x, y, title);
- }
-
- // Draw a centered string using DWIN_WIDTH
- // bShow: true=display background color; false=don't display background color
- // size: Font size
- // color: Character color
- // bColor: Background color
- // y: Upper coordinate of the string
- // *string: The string
- void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string);
- inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) {
- Draw_CenteredString(bShow, size, color, bColor, 0, DWIN_WIDTH, y, string);
- }
- inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) {
- Draw_CenteredString(bShow, size, color, bColor, y, FTOP(string));
- }
- inline void Draw_CenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) {
- Draw_CenteredString(true, font, color, bcolor, y, string);
- }
- inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, const char * const string) {
- Draw_CenteredString(false, size, color, backcolor, y, string);
- }
- inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, FSTR_P title) {
- Draw_CenteredString(false, size, color, backcolor, y, title);
- }
- inline void Draw_CenteredString(uint16_t color, uint16_t y, const char * const string) {
- Draw_CenteredString(false, font, color, backcolor, y, string);
- }
- inline void Draw_CenteredString(uint16_t color, uint16_t y, FSTR_P title) {
- Draw_CenteredString(false, font, color, backcolor, y, title);
- }
- inline void Draw_CenteredString(uint16_t y, const char * const string) {
- Draw_CenteredString(false, font, textcolor, backcolor, y, string);
- }
- inline void Draw_CenteredString(uint16_t y, FSTR_P title) {
- Draw_CenteredString(false, font, textcolor, backcolor, y, title);
- }
-
- // Draw a box
- // mode: 0=frame, 1=fill, 2=XOR fill
- // color: Rectangle color
- // frame: Box coordinates and size
- inline void Draw_Box(uint8_t mode, uint16_t color, frame_rect_t frame) {
- DWIN_Draw_Box(mode, color, frame.x, frame.y, frame.w, frame.h);
- }
-
- // Draw a circle
- // Color: circle color
- // x: abscissa of the center of the circle
- // y: ordinate of the center of the circle
- // r: circle radius
- void Draw_Circle(uint16_t color, uint16_t x,uint16_t y,uint8_t r);
- inline void Draw_Circle(uint16_t color, uint8_t r) {
- Draw_Circle(color, cursor.x, cursor.y, r);
- }
-
- // Draw a checkbox
- // Color: frame color
- // bColor: Background color
- // x/y: Upper-left point
- // checked : 0 : unchecked, 1 : checked
- void Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked);
- inline void Draw_Checkbox(uint16_t x, uint16_t y, bool checked=false) {
- Draw_Checkbox(textcolor, backcolor, x, y, checked);
- }
-
- // Color Interpolator
- // val : Interpolator minv..maxv
- // minv : Minimum value
- // maxv : Maximum value
- // color1 : Start color
- // color2 : End color
- uint16_t ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2);
-
- // ------------------------- Buttons ------------------------------//
-
- void Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption);
- inline void Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, FSTR_P caption) {
- Draw_Button(color, bcolor, x1, y1, x2, y2, FTOP(caption));
- }
- inline void Draw_Button(FSTR_P caption, uint16_t x, uint16_t y) {
- Draw_Button(textcolor, buttoncolor, x, y, x + 99, y + 37, caption);
- }
- void Draw_Button(uint8_t id, uint16_t x, uint16_t y);
-
- // -------------------------- Extra -------------------------------//
-
- // Draw a circle filled with color
- // bcolor: fill color
- // x: abscissa of the center of the circle
- // y: ordinate of the center of the circle
- // r: circle radius
- void Draw_FillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r);
- inline void Draw_FillCircle(uint16_t bcolor, uint8_t r) {
- Draw_FillCircle(bcolor, cursor.x, cursor.y, r);
- }
-
- // Color Interpolator through Red->Yellow->Green->Blue
- // val : Interpolator minv..maxv
- // minv : Minimum value
- // maxv : Maximum value
- uint16_t RainbowInt(int16_t val, int16_t minv, int16_t maxv);
-
- // Write buffer data to the SRAM
- // addr: SRAM start address 0x0000-0x7FFF
- // length: Bytes to write
- // data: address of the buffer with data
- inline void WriteToSRAM(uint16_t addr, uint16_t length, uint8_t *data) {
- DWIN_WriteToMem(0x5A, addr, length, data);
- }
-
- // Write buffer data to the Flash
- // addr: Flash start address 0x0000-0x3FFF
- // length: Bytes to write
- // data: address of the buffer with data
- inline void WriteToFlash(uint16_t addr, uint16_t length, uint8_t *data) {
- DWIN_WriteToMem(0xA5, addr, length, data);
- }
-
- // Clear by filling the area with background color
- // Area (0, TITLE_HEIGHT, DWIN_WIDTH, STATUS_Y - 1)
- void ClearMainArea();
-
- };
|