Emulated DOGM via HAL TFT, XPT IO (#19017)
This commit is contained in:
@ -22,7 +22,7 @@
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_FSMC_TFT || ENABLED(TFT_LVGL_UI_FSMC)
|
||||
#if HAS_FSMC_TFT
|
||||
|
||||
#include "tft_fsmc.h"
|
||||
#include <libmaple/fsmc.h>
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_SPI_TFT || ENABLED(TFT_LVGL_UI_SPI)
|
||||
#if HAS_SPI_TFT
|
||||
|
||||
#include "tft_spi.h"
|
||||
|
||||
@ -30,32 +30,32 @@
|
||||
|
||||
SPIClass TFT_SPI::SPIx(1);
|
||||
|
||||
#define SPI_TFT_CS_H OUT_WRITE(TFT_CS_PIN, HIGH)
|
||||
#define SPI_TFT_CS_L OUT_WRITE(TFT_CS_PIN, LOW)
|
||||
#define TFT_CS_H OUT_WRITE(TFT_CS_PIN, HIGH)
|
||||
#define TFT_CS_L OUT_WRITE(TFT_CS_PIN, LOW)
|
||||
|
||||
#define SPI_TFT_DC_H OUT_WRITE(TFT_DC_PIN, HIGH)
|
||||
#define SPI_TFT_DC_L OUT_WRITE(TFT_DC_PIN, LOW)
|
||||
#define TFT_DC_H OUT_WRITE(TFT_DC_PIN, HIGH)
|
||||
#define TFT_DC_L OUT_WRITE(TFT_DC_PIN, LOW)
|
||||
|
||||
#define SPI_TFT_RST_H OUT_WRITE(TFT_RST_PIN, HIGH)
|
||||
#define SPI_TFT_RST_L OUT_WRITE(TFT_RST_PIN, LOW)
|
||||
#define TFT_RST_H OUT_WRITE(TFT_RST_PIN, HIGH)
|
||||
#define TFT_RST_L OUT_WRITE(TFT_RST_PIN, LOW)
|
||||
|
||||
#define SPI_TFT_BLK_H OUT_WRITE(TFT_BACKLIGHT_PIN, HIGH)
|
||||
#define SPI_TFT_BLK_L OUT_WRITE(TFT_BACKLIGHT_PIN, LOW)
|
||||
#define TFT_BLK_H OUT_WRITE(TFT_BACKLIGHT_PIN, HIGH)
|
||||
#define TFT_BLK_L OUT_WRITE(TFT_BACKLIGHT_PIN, LOW)
|
||||
|
||||
void TFT_SPI::Init() {
|
||||
#if PIN_EXISTS(TFT_RESET)
|
||||
// OUT_WRITE(TFT_RESET_PIN, HIGH);
|
||||
SPI_TFT_RST_H;
|
||||
TFT_RST_H;
|
||||
delay(100);
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(TFT_BACKLIGHT)
|
||||
// OUT_WRITE(TFT_BACKLIGHT_PIN, HIGH);
|
||||
SPI_TFT_BLK_H;
|
||||
TFT_BLK_H;
|
||||
#endif
|
||||
|
||||
SPI_TFT_DC_H;
|
||||
SPI_TFT_CS_H;
|
||||
TFT_DC_H;
|
||||
TFT_CS_H;
|
||||
|
||||
/**
|
||||
* STM32F1 APB2 = 72MHz, APB1 = 36MHz, max SPI speed of this MCU if 18Mhz
|
||||
@ -87,7 +87,7 @@ void TFT_SPI::Init() {
|
||||
void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
|
||||
SPIx.setDataSize(DataSize);
|
||||
SPIx.begin();
|
||||
SPI_TFT_CS_L;
|
||||
TFT_CS_L;
|
||||
}
|
||||
|
||||
uint32_t TFT_SPI::GetID() {
|
||||
@ -135,7 +135,7 @@ void TFT_SPI::Transmit(uint16_t Data) {
|
||||
|
||||
void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
|
||||
DataTransferBegin();
|
||||
SPI_TFT_DC_H;
|
||||
TFT_DC_H;
|
||||
if (MemoryIncrease == DMA_MINC_ENABLE) {
|
||||
SPIx.dmaSend(Data, Count, true);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_TFT_XPT2046
|
||||
#if HAS_TFT_XPT2046 || HAS_TOUCH_XPT2046
|
||||
|
||||
#include "xpt2046.h"
|
||||
#include <SPI.h>
|
||||
|
@ -24,16 +24,18 @@
|
||||
#include <SPI.h>
|
||||
#endif
|
||||
|
||||
#if !PIN_EXISTS(TOUCH_MISO)
|
||||
#error "TOUCH_MISO_PIN is not defined."
|
||||
#elif !PIN_EXISTS(TOUCH_MOSI)
|
||||
#error "TOUCH_MOSI_PIN is not defined."
|
||||
#elif !PIN_EXISTS(TOUCH_SCK)
|
||||
#error "TOUCH_SCK_PIN is not defined."
|
||||
#elif !PIN_EXISTS(TOUCH_CS)
|
||||
#error "TOUCH_CS_PIN is not defined."
|
||||
#ifndef TOUCH_MISO_PIN
|
||||
#define TOUCH_MISO_PIN MISO_PIN
|
||||
#endif
|
||||
#ifndef TOUCH_MOSI_PIN
|
||||
#define TOUCH_MOSI_PIN MOSI_PIN
|
||||
#endif
|
||||
#ifndef TOUCH_SCK_PIN
|
||||
#define TOUCH_SCK_PIN SCK_PIN
|
||||
#endif
|
||||
#ifndef TOUCH_CS_PIN
|
||||
#define TOUCH_CS_PIN CS_PIN
|
||||
#endif
|
||||
|
||||
#ifndef TOUCH_INT_PIN
|
||||
#define TOUCH_INT_PIN -1
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user