2020-06-16 02:05:33 +00:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
|
|
|
* Copyright (c) 2020 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
|
2020-07-23 03:20:14 +00:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2020-06-16 02:05:33 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2021-05-06 09:17:59 +00:00
|
|
|
#include "../../../inc/MarlinConfig.h"
|
2020-07-25 05:52:07 +00:00
|
|
|
|
2021-05-06 09:17:59 +00:00
|
|
|
#include "../../../libs/W25Qxx.h"
|
2020-08-09 00:24:31 +00:00
|
|
|
|
2020-07-25 05:52:07 +00:00
|
|
|
#include <lvgl.h>
|
|
|
|
|
2020-06-16 02:05:33 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2020-07-01 06:30:24 +00:00
|
|
|
#ifndef HAS_SPI_FLASH_FONT
|
2020-07-25 05:52:07 +00:00
|
|
|
#define HAS_SPI_FLASH_FONT 1 // Disabled until fix the font load code
|
2020-07-01 06:30:24 +00:00
|
|
|
#endif
|
|
|
|
#ifndef HAS_GCODE_PREVIEW
|
|
|
|
#define HAS_GCODE_PREVIEW 1
|
|
|
|
#endif
|
|
|
|
#ifndef HAS_LANG_SELECT_SCREEN
|
2020-07-25 05:52:07 +00:00
|
|
|
#define HAS_LANG_SELECT_SCREEN 1
|
2020-07-01 06:30:24 +00:00
|
|
|
#endif
|
|
|
|
#ifndef HAS_BAK_VIEW_IN_FLASH
|
2020-07-25 05:52:07 +00:00
|
|
|
#define HAS_BAK_VIEW_IN_FLASH 1
|
2020-07-01 06:30:24 +00:00
|
|
|
#endif
|
|
|
|
#ifndef HAS_GCODE_DEFAULT_VIEW_IN_FLASH
|
2020-07-25 05:52:07 +00:00
|
|
|
#define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 1
|
|
|
|
#endif
|
|
|
|
#ifndef HAS_LOGO_IN_FLASH
|
|
|
|
#define HAS_LOGO_IN_FLASH 1
|
2020-07-01 06:30:24 +00:00
|
|
|
#endif
|
|
|
|
#ifndef SPI_FLASH_SIZE
|
2020-07-25 05:52:07 +00:00
|
|
|
#define SPI_FLASH_SIZE 0x1000000 // 16MB
|
2020-07-01 06:30:24 +00:00
|
|
|
#endif
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-07-01 06:30:24 +00:00
|
|
|
#define PIC_MAX_CN 100 // Maximum number of pictures
|
|
|
|
#define PIC_NAME_MAX_LEN 50 // Picture name maximum length
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-07-01 06:30:24 +00:00
|
|
|
#define LOGO_MAX_SIZE_TFT35 (300*1024)
|
|
|
|
#define LOGO_MAX_SIZE_TFT32 (150*1024)
|
|
|
|
#define TITLELOGO_MAX_SIZE (150*1024) // Little logo maximum
|
|
|
|
#define DEFAULT_VIEW_MAX_SIZE (200*200*2)
|
|
|
|
#define FLASH_VIEW_MAX_SIZE (200*200*2)
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-08-04 09:50:05 +00:00
|
|
|
#define PER_PIC_MAX_SPACE_TFT35 (9*1024)
|
2020-07-01 06:30:24 +00:00
|
|
|
#define PER_PIC_MAX_SPACE_TFT32 (16*1024)
|
|
|
|
#define PER_FONT_MAX_SPACE (16*1024)
|
|
|
|
|
|
|
|
#if SPI_FLASH_SIZE == 0x200000
|
|
|
|
//pic
|
|
|
|
//Robin_pro pic addr
|
2020-07-25 05:52:07 +00:00
|
|
|
#define PIC_NAME_ADDR 0x001000 // Pic information addr
|
|
|
|
#define PIC_SIZE_ADDR 0x001800 // Pic size information addr
|
|
|
|
#define PIC_COUNTER_ADDR 0x002000 // Pic total number
|
|
|
|
#define PER_PIC_SAVE_ADDR 0x000000 // Storage address of each picture
|
|
|
|
#define PIC_LOGO_ADDR 0x000000 // Logo addr
|
|
|
|
#define PIC_DATA_ADDR 0x003000 //
|
2020-07-01 06:30:24 +00:00
|
|
|
|
|
|
|
// TFT35
|
2020-10-09 21:50:17 +00:00
|
|
|
#define DEFAULT_VIEW_ADDR_TFT35 0x1EA070
|
2020-07-25 05:52:07 +00:00
|
|
|
#define BAK_VIEW_ADDR_TFT35 (DEFAULT_VIEW_ADDR_TFT35+90*1024)
|
|
|
|
#define PIC_ICON_LOGO_ADDR_TFT35 (BAK_VIEW_ADDR_TFT35+80*1024)
|
|
|
|
#define PIC_DATA_ADDR_TFT35 0x003000 // (PIC_ICON_LOGO_ADDR_TFT35+350*1024) //0xC5800
|
2020-07-01 06:30:24 +00:00
|
|
|
|
2020-07-25 05:52:07 +00:00
|
|
|
#define PIC_DATA_ADDR_TFT32 0x00F000
|
|
|
|
#define PIC_ICON_LOGO_ADDR_TFT32 0x5D8000
|
|
|
|
#define PIC_OTHER_SIZE_ADDR_TFT32 0x5EE000
|
|
|
|
|
|
|
|
// font
|
2020-08-04 09:50:05 +00:00
|
|
|
#define FONTINFOADDR 0x150000 // 6M -- font addr
|
2020-07-25 05:52:07 +00:00
|
|
|
#define UNIGBK_FLASH_ADDR (FONTINFOADDR+4096) // 4*1024
|
2020-07-01 06:30:24 +00:00
|
|
|
|
|
|
|
#else
|
2020-06-16 02:05:33 +00:00
|
|
|
//pic
|
|
|
|
//Robin_pro pic addr
|
2020-07-25 05:52:07 +00:00
|
|
|
#define PIC_NAME_ADDR 0x003000 // Pic information addr
|
|
|
|
#define PIC_SIZE_ADDR 0x007000 // Pic size information addr
|
|
|
|
#define PIC_COUNTER_ADDR 0x008000 // Pic total number
|
|
|
|
#define PIC_LOGO_ADDR 0x009000 // Logo addr
|
2020-06-16 02:05:33 +00:00
|
|
|
|
|
|
|
// TFT35
|
2020-07-25 05:52:07 +00:00
|
|
|
#define DEFAULT_VIEW_ADDR_TFT35 0xC5800
|
|
|
|
#define BAK_VIEW_ADDR_TFT35 (DEFAULT_VIEW_ADDR_TFT35+90*1024)
|
|
|
|
#define PIC_ICON_LOGO_ADDR_TFT35 (BAK_VIEW_ADDR_TFT35+80*1024)
|
|
|
|
#define PIC_DATA_ADDR_TFT35 (PIC_ICON_LOGO_ADDR_TFT35+350*1024) //0xC5800
|
2020-06-16 02:05:33 +00:00
|
|
|
|
|
|
|
// TFT32
|
2020-07-25 05:52:07 +00:00
|
|
|
#define PIC_DATA_ADDR_TFT32 0x02F000
|
|
|
|
#define PIC_ICON_LOGO_ADDR_TFT32 0x5D8000
|
|
|
|
#define PIC_OTHER_SIZE_ADDR_TFT32 0x5EE000
|
2020-06-16 02:05:33 +00:00
|
|
|
|
|
|
|
// font
|
2020-07-25 05:52:07 +00:00
|
|
|
#define FONTINFOADDR 0x600000 // 6M -- font addr
|
|
|
|
#define UNIGBK_FLASH_ADDR (FONTINFOADDR+4096) // 4*1024
|
|
|
|
#define GBK_FLASH_ADDR (UNIGBK_FLASH_ADDR+180224) // 176*1024
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-07-01 06:30:24 +00:00
|
|
|
#endif
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-07-01 06:30:24 +00:00
|
|
|
// Flash flag
|
2021-02-27 23:35:32 +00:00
|
|
|
#define REFLSHE_FLGA_ADD (0x800000-32)
|
2020-09-21 01:55:02 +00:00
|
|
|
|
2020-07-01 06:30:24 +00:00
|
|
|
// SD card information first addr
|
|
|
|
#define VAR_INF_ADDR 0x000000
|
2021-01-14 04:41:09 +00:00
|
|
|
#define FLASH_INF_VALID_FLAG 0x20201118
|
2020-09-21 01:55:02 +00:00
|
|
|
|
|
|
|
//Store some gcode commands, such as auto leveling commands
|
|
|
|
#define GCODE_COMMAND_ADDR VAR_INF_ADDR + 3*1024
|
|
|
|
#define AUTO_LEVELING_COMMAND_ADDR GCODE_COMMAND_ADDR
|
|
|
|
#define OTHERS_COMMAND_ADDR_1 AUTO_LEVELING_COMMAND_ADDR + 100
|
|
|
|
#define OTHERS_COMMAND_ADDR_2 OTHERS_COMMAND_ADDR_1 + 100
|
|
|
|
#define OTHERS_COMMAND_ADDR_3 OTHERS_COMMAND_ADDR_2 + 100
|
|
|
|
#define OTHERS_COMMAND_ADDR_4 OTHERS_COMMAND_ADDR_3 + 100
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-08-07 06:53:43 +00:00
|
|
|
#ifdef __cplusplus
|
2020-09-21 00:07:59 +00:00
|
|
|
extern "C" { /* C-declarations for C++ */
|
2020-08-07 06:53:43 +00:00
|
|
|
#endif
|
|
|
|
|
2020-07-01 06:30:24 +00:00
|
|
|
union union32 {
|
|
|
|
uint8_t bytes[4];
|
|
|
|
uint32_t dwords;
|
|
|
|
};
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-07-01 06:30:24 +00:00
|
|
|
// pic information
|
|
|
|
struct pic_msg {
|
|
|
|
uint8_t name[PIC_NAME_MAX_LEN];
|
|
|
|
union union32 size;
|
|
|
|
};
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-07-01 06:30:24 +00:00
|
|
|
typedef struct pic_msg PIC_MSG;
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-07-01 06:30:24 +00:00
|
|
|
#define BMP_WRITE_BUF_LEN 512
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-07-26 04:08:30 +00:00
|
|
|
#define PICINFOADDR 0x1000
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-07-01 06:30:24 +00:00
|
|
|
#define PIC_SIZE_xM 6
|
|
|
|
#define FONT_SIZE_xM 2
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2021-04-02 19:22:43 +00:00
|
|
|
void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff);
|
|
|
|
void Pic_Logo_Read(uint8_t *LogoName,uint8_t *Logo_Rbuff,uint32_t LogoReadsize);
|
|
|
|
void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size);
|
|
|
|
uint32_t lv_get_pic_addr(uint8_t *Pname);
|
|
|
|
void get_spi_flash_data(const char *rec_buf, int offset, int size);
|
|
|
|
void spi_flash_read_test();
|
|
|
|
void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsize);
|
|
|
|
void flash_view_Read(uint8_t *flash_view_Rbuff, uint32_t flash_view_Readsize);
|
2020-06-16 02:05:33 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2020-09-21 00:07:59 +00:00
|
|
|
} /* C-declarations for C++ */
|
2020-06-16 02:05:33 +00:00
|
|
|
#endif
|