Fix MKS Nano v1.2 FSMC display (#18901)

This commit is contained in:
Victor Oliveira
2020-08-04 01:41:23 -03:00
committed by GitHub
parent 5823ebb446
commit 04c10eda92
3 changed files with 66 additions and 87 deletions

View File

@ -165,28 +165,7 @@
* to let the bootloader init the screen.
*/
#if ENABLED(TFT_LVGL_UI_SPI)
#define SPI_TFT_CS_PIN PD11
#define SPI_TFT_SCK_PIN PA5
#define SPI_TFT_MISO_PIN PA6
#define SPI_TFT_MOSI_PIN PA7
#define SPI_TFT_DC_PIN PD10
#define SPI_TFT_RST_PIN PC6
#define LCD_BACKLIGHT_PIN PD13
#define TOUCH_CS_PIN PE14 // SPI1_NSS
#define TOUCH_SCK_PIN PA5 // SPI1_SCK
#define TOUCH_MISO_PIN PA6 // SPI1_MISO
#define TOUCH_MOSI_PIN PA7 // SPI1_MOSI
#define BTN_EN1 PE8
#define BTN_EN2 PE11
#define BEEPER_PIN PC5
#define BTN_ENC PE13
#elif ENABLED(TFT_LVGL_UI_FSMC)
#if ENABLED(TFT_LVGL_UI_FSMC)
#define FSMC_CS_PIN PD7 // NE4
#define FSMC_RS_PIN PD11 // A0
@ -198,15 +177,34 @@
#define LCD_BACKLIGHT_PIN PD13
#endif
#elif ENABLED(FSMC_GRAPHICAL_TFT)
#if ENABLED(FSMC_GRAPHICAL_TFT)
//#define DOGLCD_MOSI -1 // prevent redefine Conditionals_post.h
//#define DOGLCD_SCK -1
#define DOGLCD_MOSI -1 // prevent redefine Conditionals_post.h
#define DOGLCD_SCK -1
#ifndef FSMC_UPSCALE
#define FSMC_UPSCALE 3
#endif
#ifndef LCD_FULL_PIXEL_WIDTH
#define LCD_FULL_PIXEL_WIDTH 480
#endif
#ifndef LCD_PIXEL_OFFSET_X
#define LCD_PIXEL_OFFSET_X 48
#endif
#ifndef LCD_FULL_PIXEL_HEIGHT
#define LCD_FULL_PIXEL_HEIGHT 320
#endif
#ifndef LCD_PIXEL_OFFSET_Y
#define LCD_PIXEL_OFFSET_Y 32
#endif
#define FSMC_CS_PIN PD7 // NE4
#define FSMC_RS_PIN PD11 // A0
#define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT
#define FSMC_DMA_DEV DMA2
#define FSMC_DMA_CHANNEL DMA_CH5
#define LCD_RESET_PIN PC6 // FSMC_RST
#define LCD_BACKLIGHT_PIN PD13
@ -216,54 +214,9 @@
#define TOUCH_MISO_PIN PB14 // SPI2_MISO
#define TOUCH_MOSI_PIN PB15 // SPI2_MOSI
#endif
#endif
#if HAS_SPI_LCD
#define BEEPER_PIN PC5
#define BTN_ENC PE13
#define LCD_PINS_ENABLE PD13
#define LCD_PINS_RS PC6
#define BTN_EN1 PE8
#define BTN_EN2 PE11
#define LCD_BACKLIGHT_PIN -1
// MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
#if ENABLED(MKS_MINI_12864)
#define LCD_BACKLIGHT_PIN -1
#define LCD_RESET_PIN -1
#define DOGLCD_A0 PD11
#define DOGLCD_CS PE15
#define DOGLCD_SCK PA5
#define DOGLCD_MOSI PA7
// Required for MKS_MINI_12864 with this board
#define MKS_LCD12864B
#undef SHOW_BOOTSCREEN
#else // !MKS_MINI_12864
#define LCD_PINS_D4 PE14
#if ENABLED(ULTIPANEL)
#define LCD_PINS_D5 PE15
#define LCD_PINS_D6 PD11
#define LCD_PINS_D7 PD10
#endif
#ifndef BOARD_ST7920_DELAY_1
#define BOARD_ST7920_DELAY_1 DELAY_NS(125)
#endif
#ifndef BOARD_ST7920_DELAY_2
#define BOARD_ST7920_DELAY_2 DELAY_NS(125)
#endif
#ifndef BOARD_ST7920_DELAY_3
#define BOARD_ST7920_DELAY_3 DELAY_NS(125)
#endif
#endif // !MKS_MINI_12864
#endif // HAS_SPI_LCD
#define SPI_FLASH
#if ENABLED(SPI_FLASH)
#define W25QXX_CS_PIN PB12