Browse Source

W25QXX SPI Flash support (#18897)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Victor Oliveira 5 years ago
parent
commit
0a1b865987
No account linked to committer's email address

+ 92
- 0
Marlin/src/gcode/control/M993_M994.cpp View File

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
+#include "../../inc/MarlinConfig.h"
24
+
25
+#if ALL(HAS_SPI_FLASH, SDSUPPORT, MARLIN_DEV_MODE)
26
+
27
+#include "../gcode.h"
28
+#include "../../sd/cardreader.h"
29
+#include "../../libs/W25Qxx.h"
30
+
31
+/**
32
+ * M993: Backup SPI Flash to SD
33
+ */
34
+void GcodeSuite::M993() {
35
+  if (!card.isMounted()) card.mount();
36
+
37
+  char fname[] = "spiflash.bin";
38
+  card.openFileWrite(fname);
39
+  if (!card.isFileOpen()) {
40
+    SERIAL_ECHOLNPAIR("Failed to open ", fname, " to write.");
41
+    return;
42
+  }
43
+
44
+  W25QXXFlash W25QXX;
45
+
46
+  uint8_t buf[1024];
47
+  uint32_t addr = 0;
48
+  W25QXX.init(SPI_QUARTER_SPEED);
49
+  SERIAL_ECHOPGM("Save SPI Flash");
50
+  while (addr < SPI_FLASH_SIZE) {
51
+    W25QXX.SPI_FLASH_BufferRead(buf, addr, COUNT(buf));
52
+    addr += COUNT(buf);
53
+    card.write(buf, COUNT(buf));
54
+    if (addr % (COUNT(buf) * 10) == 0) SERIAL_CHAR('.');
55
+  }
56
+  SERIAL_ECHOLNPGM(" done");
57
+
58
+  card.closefile();
59
+}
60
+
61
+/**
62
+ * M994: Load a backup from SD to SPI Flash
63
+ */
64
+void GcodeSuite::M994() {
65
+  if (!card.isMounted()) card.mount();
66
+
67
+  char fname[] = "spiflash.bin";
68
+  card.openFileRead(fname);
69
+  if (!card.isFileOpen()) {
70
+    SERIAL_ECHOLNPAIR("Failed to open ", fname, " to read.");
71
+    return;
72
+  }
73
+
74
+  W25QXXFlash W25QXX;
75
+
76
+  uint8_t buf[1024];
77
+  uint32_t addr = 0;
78
+  W25QXX.init(SPI_QUARTER_SPEED);
79
+  W25QXX.SPI_FLASH_BulkErase();
80
+  SERIAL_ECHOPGM("Load SPI Flash");
81
+  while(addr < SPI_FLASH_SIZE) {
82
+    card.read(buf, COUNT(buf));
83
+    W25QXX.SPI_FLASH_BufferWrite(buf, addr, COUNT(buf));
84
+    addr += COUNT(buf);
85
+    if (addr % (COUNT(buf) * 10) == 0) SERIAL_CHAR('.');
86
+  }
87
+  SERIAL_ECHOLNPGM(" done");
88
+
89
+  card.closefile();
90
+}
91
+
92
+#endif // HAS_SPI_FLASH && SDSUPPORT && MARLIN_DEV_MODE

+ 5
- 0
Marlin/src/gcode/gcode.cpp View File

871
         case 422: M422(); break;                                  // M422: Set Z Stepper automatic alignment position using probe
871
         case 422: M422(); break;                                  // M422: Set Z Stepper automatic alignment position using probe
872
       #endif
872
       #endif
873
 
873
 
874
+      #if BOTH(HAS_SPI_FLASH, SDSUPPORT)
875
+        case 993: M993(); break;                                  // M993: Backup SPI Flash to SD
876
+        case 994: M994(); break;                                  // M994: Load a Backup from SD to SPI Flash
877
+      #endif
878
+
874
       #if ENABLED(TOUCH_SCREEN_CALIBRATION)
879
       #if ENABLED(TOUCH_SCREEN_CALIBRATION)
875
         case 995: M995(); break;                                  // M995: Touch screen calibration for TFT display
880
         case 995: M995(); break;                                  // M995: Touch screen calibration for TFT display
876
       #endif
881
       #endif

+ 7
- 0
Marlin/src/gcode/gcode.h View File

276
  * ************ Custom codes - This can change to suit future G-code regulations
276
  * ************ Custom codes - This can change to suit future G-code regulations
277
  * G425 - Calibrate using a conductive object. (Requires CALIBRATION_GCODE)
277
  * G425 - Calibrate using a conductive object. (Requires CALIBRATION_GCODE)
278
  * M928 - Start SD logging: "M928 filename.gco". Stop with M29. (Requires SDSUPPORT)
278
  * M928 - Start SD logging: "M928 filename.gco". Stop with M29. (Requires SDSUPPORT)
279
+ * M993 - Backup SPI Flash to SD
280
+ * M994 - Load a Backup from SD to SPI Flash
279
  * M995 - Touch screen calibration for TFT display
281
  * M995 - Touch screen calibration for TFT display
280
  * M997 - Perform in-application firmware update
282
  * M997 - Perform in-application firmware update
281
  * M999 - Restart after being stopped by error
283
  * M999 - Restart after being stopped by error
846
 
848
 
847
   TERN_(TOUCH_SCREEN_CALIBRATION, static void M995());
849
   TERN_(TOUCH_SCREEN_CALIBRATION, static void M995());
848
 
850
 
851
+  #if BOTH(HAS_SPI_FLASH, SDSUPPORT)
852
+    static void M993();
853
+    static void M994();
854
+  #endif
855
+
849
   TERN_(PLATFORM_M997_SUPPORT, static void M997());
856
   TERN_(PLATFORM_M997_SUPPORT, static void M997());
850
 
857
 
851
   static void M999();
858
   static void M999();

+ 2
- 0
Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp View File

27
 #include "../../../../inc/MarlinConfig.h"
27
 #include "../../../../inc/MarlinConfig.h"
28
 #include "SPIFlashStorage.h"
28
 #include "SPIFlashStorage.h"
29
 
29
 
30
+extern W25QXXFlash W25QXX;
31
+
30
 uint8_t SPIFlashStorage::m_pageData[SPI_FLASH_PageSize];
32
 uint8_t SPIFlashStorage::m_pageData[SPI_FLASH_PageSize];
31
 uint32_t SPIFlashStorage::m_currentPage;
33
 uint32_t SPIFlashStorage::m_currentPage;
32
 uint16_t SPIFlashStorage::m_pageDataUsed;
34
 uint16_t SPIFlashStorage::m_pageDataUsed;

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.h View File

21
  */
21
  */
22
 #pragma once
22
 #pragma once
23
 
23
 
24
-#include "W25Qxx.h"
24
+#include "../../../../libs/W25Qxx.h"
25
 
25
 
26
 #define HAS_SPI_FLASH_COMPRESSION 1
26
 #define HAS_SPI_FLASH_COMPRESSION 1
27
 
27
 

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp View File

27
   #include "SPI_TFT.h"
27
   #include "SPI_TFT.h"
28
 #endif
28
 #endif
29
 
29
 
30
-#include "W25Qxx.h"
31
 #include "tft_lvgl_configuration.h"
30
 #include "tft_lvgl_configuration.h"
32
 
31
 
33
 #include "pic_manager.h"
32
 #include "pic_manager.h"
50
   #include "../../../../feature/pause.h"
49
   #include "../../../../feature/pause.h"
51
 #endif
50
 #endif
52
 
51
 
52
+W25QXXFlash W25QXX;
53
 CFG_ITMES gCfgItems;
53
 CFG_ITMES gCfgItems;
54
 UI_CFG uiCfg;
54
 UI_CFG uiCfg;
55
 DISP_STATE_STACK disp_state_stack;
55
 DISP_STATE_STACK disp_state_stack;

+ 0
- 1
Marlin/src/lcd/extui/lib/mks_ui/mks_hardware_test.cpp View File

29
 
29
 
30
 #include "tft_lvgl_configuration.h"
30
 #include "tft_lvgl_configuration.h"
31
 #include "draw_ready_print.h"
31
 #include "draw_ready_print.h"
32
-#include "W25Qxx.h"
33
 #include "mks_hardware_test.h"
32
 #include "mks_hardware_test.h"
34
 #include "draw_ui.h"
33
 #include "draw_ui.h"
35
 #include "pic_manager.h"
34
 #include "pic_manager.h"

+ 2
- 2
Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp View File

29
 #include "mks_hardware_test.h"
29
 #include "mks_hardware_test.h"
30
 
30
 
31
 #include "SPIFlashStorage.h"
31
 #include "SPIFlashStorage.h"
32
-#include "W25Qxx.h"
32
+#include "../../../../libs/W25Qxx.h"
33
 
33
 
34
-#include "../../../../MarlinCore.h"
35
 #include "../../../../sd/cardreader.h"
34
 #include "../../../../sd/cardreader.h"
35
+#include "../../../../MarlinCore.h"
36
 
36
 
37
 extern uint16_t DeviceCode;
37
 extern uint16_t DeviceCode;
38
 extern unsigned char bmp_public_buf[17 * 1024];
38
 extern unsigned char bmp_public_buf[17 * 1024];

+ 4
- 0
Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h View File

23
 
23
 
24
 #include "../../../../inc/MarlinConfig.h"
24
 #include "../../../../inc/MarlinConfig.h"
25
 
25
 
26
+#include "../../../../libs/W25Qxx.h"
27
+
26
 #include <lvgl.h>
28
 #include <lvgl.h>
27
 
29
 
28
 #include <stdint.h>
30
 #include <stdint.h>
154
 extern void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsize);
156
 extern void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsize);
155
 extern void flash_view_Read(uint8_t *flash_view_Rbuff, uint32_t flash_view_Readsize);
157
 extern void flash_view_Read(uint8_t *flash_view_Rbuff, uint32_t flash_view_Readsize);
156
 
158
 
159
+extern W25QXXFlash W25QXX;
160
+
157
 #ifdef __cplusplus
161
 #ifdef __cplusplus
158
 } /* C-declarations for C++ */
162
 } /* C-declarations for C++ */
159
 #endif
163
 #endif

+ 0
- 1
Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp View File

35
 
35
 
36
 #include "tft_lvgl_configuration.h"
36
 #include "tft_lvgl_configuration.h"
37
 #include "draw_ready_print.h"
37
 #include "draw_ready_print.h"
38
-#include "W25Qxx.h"
39
 #include "pic_manager.h"
38
 #include "pic_manager.h"
40
 #include "mks_hardware_test.h"
39
 #include "mks_hardware_test.h"
41
 #include "draw_ui.h"
40
 #include "draw_ui.h"

Marlin/src/lcd/extui/lib/mks_ui/W25Qxx.cpp → Marlin/src/libs/W25Qxx.cpp View File

19
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
  *
20
  *
21
  */
21
  */
22
-#include "../../../../inc/MarlinConfigPre.h"
23
 
22
 
24
-#if 1 // ENABLED(SPI_FLASH)
25
-#if HAS_TFT_LVGL_UI
23
+#include "../inc/MarlinConfig.h"
24
+
25
+#if HAS_SPI_FLASH
26
 
26
 
27
 #include <SPI.h>
27
 #include <SPI.h>
28
-#include "../../../../inc/MarlinConfig.h"
29
 
28
 
30
 #include "W25Qxx.h"
29
 #include "W25Qxx.h"
31
 
30
 
45
 #define W25QXX_CS_H OUT_WRITE(SPI_FLASH_CS_PIN, HIGH)
44
 #define W25QXX_CS_H OUT_WRITE(SPI_FLASH_CS_PIN, HIGH)
46
 #define W25QXX_CS_L OUT_WRITE(SPI_FLASH_CS_PIN, LOW)
45
 #define W25QXX_CS_L OUT_WRITE(SPI_FLASH_CS_PIN, LOW)
47
 
46
 
48
-ext_FLASH W25QXX;
49
-
50
-void ext_FLASH::init(uint8_t spiRate) {
47
+void W25QXXFlash::init(uint8_t spiRate) {
51
 
48
 
52
   OUT_WRITE(SPI_FLASH_CS_PIN, HIGH);
49
   OUT_WRITE(SPI_FLASH_CS_PIN, HIGH);
53
 
50
 
85
  *
82
  *
86
  * @details
83
  * @details
87
  */
84
  */
88
-uint8_t ext_FLASH::spi_flash_Rec() {
85
+uint8_t W25QXXFlash::spi_flash_Rec() {
89
   uint8_t returnByte = SPI.transfer(ff);
86
   uint8_t returnByte = SPI.transfer(ff);
90
   return returnByte;
87
   return returnByte;
91
 }
88
 }
92
 
89
 
93
-uint8_t ext_FLASH::spi_flash_read_write_byte(uint8_t data) {
90
+uint8_t W25QXXFlash::spi_flash_read_write_byte(uint8_t data) {
94
   uint8_t returnByte = SPI.transfer(data);
91
   uint8_t returnByte = SPI.transfer(data);
95
   return returnByte;
92
   return returnByte;
96
 }
93
 }
104
  *
101
  *
105
  * @details Uses DMA
102
  * @details Uses DMA
106
  */
103
  */
107
-void ext_FLASH::spi_flash_Read(uint8_t* buf, uint16_t nbyte) { SPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte); }
104
+void W25QXXFlash::spi_flash_Read(uint8_t* buf, uint16_t nbyte) { SPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte); }
108
 
105
 
109
 /**
106
 /**
110
  * @brief  Send a single byte on SPI port
107
  * @brief  Send a single byte on SPI port
113
  *
110
  *
114
  * @details
111
  * @details
115
  */
112
  */
116
-void ext_FLASH::spi_flash_Send(uint8_t b) { SPI.send(b); }
113
+void W25QXXFlash::spi_flash_Send(uint8_t b) { SPI.send(b); }
117
 
114
 
118
 /**
115
 /**
119
  * @brief  Write token and then write from 512 byte buffer to SPI (for SD card)
116
  * @brief  Write token and then write from 512 byte buffer to SPI (for SD card)
123
  *
120
  *
124
  * @details Use DMA
121
  * @details Use DMA
125
  */
122
  */
126
-void ext_FLASH::spi_flash_SendBlock(uint8_t token, const uint8_t* buf) {
123
+void W25QXXFlash::spi_flash_SendBlock(uint8_t token, const uint8_t* buf) {
127
   SPI.send(token);
124
   SPI.send(token);
128
   SPI.dmaSend(const_cast<uint8_t*>(buf), 512);
125
   SPI.dmaSend(const_cast<uint8_t*>(buf), 512);
129
 }
126
 }
130
 
127
 
131
-uint16_t ext_FLASH::W25QXX_ReadID(void) {
128
+uint16_t W25QXXFlash::W25QXX_ReadID(void) {
132
   uint16_t Temp = 0;
129
   uint16_t Temp = 0;
133
   W25QXX_CS_L;
130
   W25QXX_CS_L;
134
   spi_flash_Send(0x90);
131
   spi_flash_Send(0x90);
141
   return Temp;
138
   return Temp;
142
 }
139
 }
143
 
140
 
144
-void ext_FLASH::SPI_FLASH_WriteEnable(void) {
141
+void W25QXXFlash::SPI_FLASH_WriteEnable(void) {
145
   /* Select the FLASH: Chip Select low */
142
   /* Select the FLASH: Chip Select low */
146
   W25QXX_CS_L;
143
   W25QXX_CS_L;
147
   /* Send "Write Enable" instruction */
144
   /* Send "Write Enable" instruction */
159
 * Output         : None
156
 * Output         : None
160
 * Return         : None
157
 * Return         : None
161
 *******************************************************************************/
158
 *******************************************************************************/
162
-void ext_FLASH::SPI_FLASH_WaitForWriteEnd(void) {
159
+void W25QXXFlash::SPI_FLASH_WaitForWriteEnd(void) {
163
   uint8_t FLASH_Status = 0;
160
   uint8_t FLASH_Status = 0;
164
 
161
 
165
   /* Select the FLASH: Chip Select low */
162
   /* Select the FLASH: Chip Select low */
178
   W25QXX_CS_H;
175
   W25QXX_CS_H;
179
 }
176
 }
180
 
177
 
181
-void ext_FLASH::SPI_FLASH_SectorErase(uint32_t SectorAddr) {
178
+void W25QXXFlash::SPI_FLASH_SectorErase(uint32_t SectorAddr) {
182
   /* Send write enable instruction */
179
   /* Send write enable instruction */
183
   SPI_FLASH_WriteEnable();
180
   SPI_FLASH_WriteEnable();
184
 
181
 
200
   SPI_FLASH_WaitForWriteEnd();
197
   SPI_FLASH_WaitForWriteEnd();
201
 }
198
 }
202
 
199
 
203
-void ext_FLASH::SPI_FLASH_BlockErase(uint32_t BlockAddr) {
200
+void W25QXXFlash::SPI_FLASH_BlockErase(uint32_t BlockAddr) {
204
   SPI_FLASH_WriteEnable();
201
   SPI_FLASH_WriteEnable();
205
   W25QXX_CS_L;
202
   W25QXX_CS_L;
206
   /* Send Sector Erase instruction */
203
   /* Send Sector Erase instruction */
224
 * Output         : None
221
 * Output         : None
225
 * Return         : None
222
 * Return         : None
226
 *******************************************************************************/
223
 *******************************************************************************/
227
-void ext_FLASH::SPI_FLASH_BulkErase(void) {
224
+void W25QXXFlash::SPI_FLASH_BulkErase(void) {
228
   /* Send write enable instruction */
225
   /* Send write enable instruction */
229
   SPI_FLASH_WriteEnable();
226
   SPI_FLASH_WriteEnable();
230
 
227
 
253
 * Output         : None
250
 * Output         : None
254
 * Return         : None
251
 * Return         : None
255
 *******************************************************************************/
252
 *******************************************************************************/
256
-void ext_FLASH::SPI_FLASH_PageWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite) {
253
+void W25QXXFlash::SPI_FLASH_PageWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite) {
257
   /* Enable the write access to the FLASH */
254
   /* Enable the write access to the FLASH */
258
   SPI_FLASH_WriteEnable();
255
   SPI_FLASH_WriteEnable();
259
 
256
 
296
 * Output         : None
293
 * Output         : None
297
 * Return         : None
294
 * Return         : None
298
 *******************************************************************************/
295
 *******************************************************************************/
299
-void ext_FLASH::SPI_FLASH_BufferWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite) {
296
+void W25QXXFlash::SPI_FLASH_BufferWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite) {
300
   uint8_t NumOfPage = 0, NumOfSingle = 0, Addr = 0, count = 0, temp = 0;
297
   uint8_t NumOfPage = 0, NumOfSingle = 0, Addr = 0, count = 0, temp = 0;
301
 
298
 
302
   Addr = WriteAddr % SPI_FLASH_PageSize;
299
   Addr = WriteAddr % SPI_FLASH_PageSize;
361
 * Output         : None
358
 * Output         : None
362
 * Return         : None
359
 * Return         : None
363
 *******************************************************************************/
360
 *******************************************************************************/
364
-void ext_FLASH::SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead) {
361
+void W25QXXFlash::SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead) {
365
   /* Select the FLASH: Chip Select low */
362
   /* Select the FLASH: Chip Select low */
366
   W25QXX_CS_L;
363
   W25QXX_CS_L;
367
 
364
 
389
   W25QXX_CS_H;
386
   W25QXX_CS_H;
390
 }
387
 }
391
 
388
 
392
-void ext_FLASH::lv_pic_read(uint8_t *P_Rbuff, uint32_t addr, uint32_t size) {SPI_FLASH_BufferRead((uint8_t *)P_Rbuff, addr, size);}
393
-
394
-#endif // HAS_TFT_LVGL_UI
395
-#endif // 1 ... SPI_FLASH
389
+#endif // HAS_SPI_FLASH

Marlin/src/lcd/extui/lib/mks_ui/W25Qxx.h → Marlin/src/libs/W25Qxx.h View File

52
 #define SPI_FLASH_PageSize           256
52
 #define SPI_FLASH_PageSize           256
53
 #define SPI_FLASH_PerWritePageSize   256
53
 #define SPI_FLASH_PerWritePageSize   256
54
 
54
 
55
-#if 0
56
-
57
-  #define PIC_NAME_MAX_LEN        50
58
-
59
-  #define LOGO_MAX_SIZE           (300*1024)
60
-  #define TITLELOGO_MAX_SIZE      (150*1024)
61
-  #define DEFAULT_VIEW_MAX_SIZE   (200*200*2)
62
-  #define FLASH_VIEW_MAX_SIZE     (200*200*2)
63
-
64
-  //Robin 2
65
-  #define PIC_NAME_ADDR           0x003000
66
-  #define PIC_SIZE_ADDR           0x007000
67
-  #define PIC_COUNTER_ADDR        0x008000
68
-  #define PIC_LOGO_ADDR           0x009000
69
-  //#define PIC_DATA_ADDR         0x02f000
70
-
71
-  #define DEFAULT_VIEW_ADDR       0XC5800
72
-  #define BAK_VIEW_ADDR           (DEFAULT_VIEW_ADDR+90*1024)
73
-  #define PIC_ICON_LOGO_ADDR      (BAK_VIEW_ADDR+80*1024)
74
-
75
-  #define PIC_DATA_ADDR           (PIC_ICON_LOGO_ADDR+350*1024)
76
-
77
-  #define FONTINFOADDR            0x600000
78
-  #define UNIGBK_FLASH_ADDR       (FONTINFOADDR+4096) // 4*1024
79
-  #define GBK_FLASH_ADDR          (UNIGBK_FLASH_ADDR+180224) // 176*1024
80
-
81
-  #define PER_PIC_MAX_SPACE       (32*1024)
82
-
83
-  union union32 {
84
-    uint8_t bytes[4];
85
-    uint32_t dwords;
86
-  };
87
-
88
-  struct pic_msg {
89
-    uint8_t name[PIC_NAME_MAX_LEN];
90
-    union union32 size;
91
-  };
92
-
93
-  typedef struct pic_msg PIC_MSG;
94
-
95
-#endif // if 0
96
-
97
-class ext_FLASH {
55
+class W25QXXFlash {
98
 public:
56
 public:
99
   void init(uint8_t spiRate);
57
   void init(uint8_t spiRate);
100
   static uint8_t spi_flash_Rec();
58
   static uint8_t spi_flash_Rec();
111
   static void SPI_FLASH_PageWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite);
69
   static void SPI_FLASH_PageWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite);
112
   static void SPI_FLASH_BufferWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite);
70
   static void SPI_FLASH_BufferWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite);
113
   static void SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead);
71
   static void SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead);
114
-  //uint32_t lv_get_pic_addr(uint8_t *Pname);
115
-  void lv_pic_read(uint8_t *P_Rbuff, uint32_t addr, uint32_t size);
116
 };
72
 };
117
 
73
 
118
-extern ext_FLASH W25QXX;
119
-
120
-//extern uint32_t lv_get_pic_addr(uint8_t *Pname);
121
-
122
 //#ifdef __cplusplus
74
 //#ifdef __cplusplus
123
 //} /* C-declarations for C++ */
75
 //} /* C-declarations for C++ */
124
 //#endif
76
 //#endif

+ 3
- 2
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h View File

240
   #define ILI9488_ORIENTATION               ILI9488_MADCTL_MX | ILI9488_MADCTL_MV
240
   #define ILI9488_ORIENTATION               ILI9488_MADCTL_MX | ILI9488_MADCTL_MV
241
 #endif
241
 #endif
242
 
242
 
243
-#define SPI_FLASH
244
-#if ENABLED(SPI_FLASH)
243
+#define HAS_SPI_FLASH                       1
244
+#define SPI_FLASH_SIZE                      0x1000000 // 16MB
245
+#if HAS_SPI_FLASH
245
   #define W25QXX_CS_PIN                     PB12
246
   #define W25QXX_CS_PIN                     PB12
246
   #define W25QXX_MOSI_PIN                   PB15
247
   #define W25QXX_MOSI_PIN                   PB15
247
   #define W25QXX_MISO_PIN                   PB14
248
   #define W25QXX_MISO_PIN                   PB14

+ 3
- 2
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h View File

398
 
398
 
399
 #endif // HAS_SPI_LCD
399
 #endif // HAS_SPI_LCD
400
 
400
 
401
-#define SPI_FLASH
402
-#if ENABLED(SPI_FLASH)
401
+#define HAS_SPI_FLASH                       1
402
+#define SPI_FLASH_SIZE                      0x1000000 // 16MB
403
+#if HAS_SPI_FLASH
403
   #define W25QXX_CS_PIN                     PB12
404
   #define W25QXX_CS_PIN                     PB12
404
   #define W25QXX_MOSI_PIN                   PB15
405
   #define W25QXX_MOSI_PIN                   PB15
405
   #define W25QXX_MISO_PIN                   PB14
406
   #define W25QXX_MISO_PIN                   PB14

Loading…
Cancel
Save