Sfoglia il codice sorgente

Add more DWIN commands, docs (#19395)

enigmaquip 4 anni fa
parent
commit
5926bacea1
Nessun account collegato all'indirizzo email del committer
2 ha cambiato i file con 113 aggiunte e 0 eliminazioni
  1. 92
    0
      Marlin/src/lcd/dwin/dwin_lcd.cpp
  2. 21
    0
      Marlin/src/lcd/dwin/dwin_lcd.h

+ 92
- 0
Marlin/src/lcd/dwin/dwin_lcd.cpp Vedi File

@@ -153,6 +153,20 @@ void DWIN_Frame_Clear(const uint16_t color) {
153 153
   DWIN_Send(i);
154 154
 }
155 155
 
156
+// Draw a point
157
+//  width: point width   0x01-0x0F
158
+//  height: point height 0x01-0x0F
159
+//  x,y: upper left point
160
+void DWIN_Draw_Point(uint8_t width, uint8_t height, uint16_t x, uint16_t y) {
161
+  size_t i = 0;
162
+  DWIN_Byte(i, 0x02);
163
+  DWIN_Byte(i, width);
164
+  DWIN_Byte(i, height);
165
+  DWIN_Word(i, x);
166
+  DWIN_Word(i, y);
167
+  DWIN_Send(i);
168
+}
169
+
156 170
 // Draw a line
157 171
 //  color: Line segment color
158 172
 //  xStart/yStart: Start point
@@ -221,6 +235,10 @@ void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size,
221 235
                       uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, char *string) {
222 236
   size_t i = 0;
223 237
   DWIN_Byte(i, 0x11);
238
+  // Bit 7: widthAdjust
239
+  // Bit 6: bShow
240
+  // Bit 5-4: Unused (0)
241
+  // Bit 3-0: size
224 242
   DWIN_Byte(i, (widthAdjust * 0x80) | (bShow * 0x40) | size);
225 243
   DWIN_Word(i, color);
226 244
   DWIN_Word(i, bColor);
@@ -244,6 +262,11 @@ void DWIN_Draw_IntValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t
244 262
                           uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, uint16_t value) {
245 263
   size_t i = 0;
246 264
   DWIN_Byte(i, 0x14);
265
+  // Bit 7: bshow
266
+  // Bit 6: 1 = signed; 0 = unsigned number;
267
+  // Bit 5: zeroFill
268
+  // Bit 4: zeroMode
269
+  // Bit 3-0: size
247 270
   DWIN_Byte(i, (bShow * 0x80) | (zeroFill * 0x20) | (zeroMode * 0x10) | size);
248 271
   DWIN_Word(i, color);
249 272
   DWIN_Word(i, bColor);
@@ -360,4 +383,73 @@ void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart,
360 383
   DWIN_Send(i);
361 384
 }
362 385
 
386
+// Animate a series of icons
387
+//  animID: Animation ID; 0x00-0x0F
388
+//  animate: true on; false off;
389
+//  libID: Icon library ID
390
+//  picIDs: Icon starting ID
391
+//  picIDe: Icon ending ID
392
+//  x/y: Upper-left point
393
+//  interval: Display time interval, unit 10mS
394
+void DWIN_ICON_Animation(uint8_t animID, bool animate, uint8_t libID, uint8_t picIDs, uint8_t picIDe, uint16_t x, uint16_t y, uint16_t interval) {
395
+  NOMORE(x, DWIN_WIDTH - 1);
396
+  NOMORE(y, DWIN_HEIGHT - 1); // -- ozy -- srl
397
+  size_t i = 0;
398
+  DWIN_Byte(i, 0x28);
399
+  DWIN_Word(i, x);
400
+  DWIN_Word(i, y);
401
+  // Bit 7: animation on or off
402
+  // Bit 6: start from begin or end
403
+  // Bit 5-4: unused (0)
404
+  // Bit 3-0: animID
405
+  DWIN_Byte(i, (animate * 0x80) | 0x40 | animID);
406
+  DWIN_Byte(i, libID);
407
+  DWIN_Byte(i, picIDs);
408
+  DWIN_Byte(i, picIDe);
409
+  DWIN_Byte(i, interval);
410
+  DWIN_Send(i);
411
+}
412
+
413
+// Animation Control
414
+//  state: 16 bits, each bit is the state of an animation id
415
+void DWIN_ICON_AnimationControl(uint16_t state) {
416
+  size_t i = 0;
417
+  DWIN_Byte(i, 0x28);
418
+  DWIN_Word(i, state);
419
+  DWIN_Send(i);
420
+}
421
+
422
+/*---------------------------------------- Memory functions ----------------------------------------*/
423
+// The LCD has an additional 32KB SRAM and 16KB Flash
424
+
425
+// Data can be written to the sram and save to one of the jpeg page files
426
+
427
+// Write Data Memory
428
+//  command 0x31
429
+//  Type: Write memory selection; 0x5A=SRAM; 0xA5=Flash
430
+//  Address: Write data memory address; 0x000-0x7FFF for SRAM; 0x000-0x3FFF for Flash
431
+//  Data: data
432
+//
433
+//  Flash writing returns 0xA5 0x4F 0x4B
434
+
435
+// Read Data Memory
436
+//  command 0x32
437
+//  Type: Read memory selection; 0x5A=SRAM; 0xA5=Flash
438
+//  Address: Read data memory address; 0x000-0x7FFF for SRAM; 0x000-0x3FFF for Flash
439
+//  Length: leangth of data to read; 0x01-0xF0
440
+//
441
+//  Response:
442
+//    Type, Address, Length, Data
443
+
444
+// Write Picture Memory
445
+//  Write the contents of the 32KB SRAM data memory into the designated image memory space
446
+//  Issued: 0x5A, 0xA5, PIC_ID
447
+//  Response: 0xA5 0x4F 0x4B
448
+//
449
+//  command 0x33
450
+//  0x5A, 0xA5
451
+//  PicId: Picture Memory location, 0x00-0x0F
452
+//
453
+//  Flash writing returns 0xA5 0x4F 0x4B
454
+
363 455
 #endif // DWIN_CREALITY_LCD

+ 21
- 0
Marlin/src/lcd/dwin/dwin_lcd.h Vedi File

@@ -67,6 +67,12 @@ void DWIN_UpdateLCD(void);
67 67
 //  color: Clear screen color
68 68
 void DWIN_Frame_Clear(const uint16_t color);
69 69
 
70
+// Draw a point
71
+//  width: point width   0x01-0x0F
72
+//  height: point height 0x01-0x0F
73
+//  x,y: upper left point
74
+void DWIN_Draw_Point(uint8_t width, uint8_t height, uint16_t x, uint16_t y);
75
+
70 76
 // Draw a line
71 77
 //  color: Line segment color
72 78
 //  xStart/yStart: Start point
@@ -190,3 +196,18 @@ inline void DWIN_JPG_CacheTo1(uint8_t id) { DWIN_JPG_CacheToN(1, id); }
190 196
 //  x/y: Screen paste point
191 197
 void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart,
192 198
                          uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y);
199
+
200
+// Animate a series of icons
201
+//  animID: Animation ID  up to 16
202
+//  animate: animation on or off
203
+//  libID: Icon library ID
204
+//  picIDs: Icon starting ID
205
+//  picIDe: Icon ending ID
206
+//  x/y: Upper-left point
207
+//  interval: Display time interval, unit 10mS
208
+void DWIN_ICON_Animation(uint8_t animID, bool animate, uint8_t libID, uint8_t picIDs, 
209
+                         uint8_t picIDe, uint16_t x, uint16_t y, uint16_t interval);
210
+
211
+// Animation Control
212
+//  state: 16 bits, each bit is the state of an animation id
213
+void DWIN_ICON_AnimationControl(uint16_t state);

Loading…
Annulla
Salva