Go back to plain arduino, this had fucking broke my mind and i have no clue why

This commit is contained in:
2026-01-17 23:20:00 +01:00
parent 7a9f9f868c
commit 35d5e6ecb5
9 changed files with 24 additions and 135 deletions

View File

@@ -191,7 +191,7 @@ bool TFT_eSPI::initDMA(bool ctrl_cs)
.command_bits = 0,
.address_bits = 0,
.dummy_bits = 0,
.mode = TFT_SPI_MODE,
.mode = SPI_MODE0,
.duty_cycle_pos = 0,
.cs_ena_pretrans = 0,
.cs_ena_posttrans = 0,
@@ -238,7 +238,7 @@ bool TFT_eSPI::initDMA(bool ctrl_cs)
inline void TFT_eSPI::begin_tft_write() {
if (locked) {
locked = false; // Flag to show SPI access now unlocked
spi.beginTransaction(SPISettings(spi_write_speed * 1000000, MSBFIRST, TFT_SPI_MODE));
spi.beginTransaction(SPISettings(spi_write_speed * 1000000, MSBFIRST, SPI_MODE0));
CS_L;
SET_BUS_WRITE_MODE;
}
@@ -247,7 +247,7 @@ inline void TFT_eSPI::begin_tft_write() {
void TFT_eSPI::begin_nin_write() {
if (locked) {
locked = false; // Flag to show SPI access now unlocked
spi.beginTransaction(SPISettings(spi_write_speed * 1000000, MSBFIRST, TFT_SPI_MODE));
spi.beginTransaction(SPISettings(spi_write_speed * 1000000, MSBFIRST, SPI_MODE0));
CS_L;
SET_BUS_WRITE_MODE;
}
@@ -281,7 +281,7 @@ inline void TFT_eSPI::begin_tft_read() {
dmaWait();
if (locked) {
locked = false;
spi.beginTransaction(SPISettings(SPI_READ_FREQUENCY, MSBFIRST, TFT_SPI_MODE));
spi.beginTransaction(SPISettings(SPI_READ_FREQUENCY, MSBFIRST, SPI_MODE0));
CS_L;
}
SET_BUS_READ_MODE;

View File

@@ -1,7 +1,5 @@
#pragma once
#define TFT_ESPI_VERSION "2.5.43"
#include <Arduino.h>
#include <SPI.h>
@@ -9,7 +7,6 @@
#include <pgmspace.h>
#define PROCESSOR_ID 0x32
#define SPI_PORT VSPI
#include "soc/spi_reg.h"
#include "driver/spi_master.h"
@@ -22,7 +19,7 @@
#define FS_NO_GLOBALS
#include <FS.h>
#include "SPIFFS.h" // ESP32 only
#include "SPIFFS.h"
#define DC_C GPIO.out_w1tc = (1 << TFT_DC)//;GPIO.out_w1tc = (1 << TFT_DC)
#define DC_D GPIO.out_w1ts = (1 << TFT_DC)//;GPIO.out_w1ts = (1 << TFT_DC)
@@ -33,17 +30,13 @@
#define WR_L
#define WR_H
#ifndef TFT_MISO
#define TFT_MISO -1
#endif
#ifndef TFT_MOSI
#define TFT_MOSI 23
#endif
#ifndef TFT_SCLK
#define TFT_SCLK 18
#endif
#define TFT_MISO -1
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS 5
#define TFT_DC 17
#define TFT_RST 16
#define TOUCH_CS 32
#define TFT_WRITE_BITS(D, B) *_spi_mosi_dlen = B-1; \
*_spi_w = D; \
@@ -73,19 +66,10 @@
// Write same value twice
#define tft_Write_32D(C) TFT_WRITE_BITS((uint16_t)((C)<<8 | (C)>>8)<<16 | (uint16_t)((C)<<8 | (C)>>8), 32)
////////////////////////////////////////////////////////////////////////////////////////
// Macros to read from display using SPI or software SPI
////////////////////////////////////////////////////////////////////////////////////////
#if !defined (TFT_PARALLEL_8_BIT)
#define tft_Read_8() spi.transfer(0)
#endif
#define tft_Read_8() spi.transfer(0)
#define DAT8TO32(P) ( (uint32_t)P[0]<<8 | P[1] | P[2]<<24 | P[3]<<16 )
#ifndef TFT_SPI_MODE
#define TFT_SPI_MODE SPI_MODE0
#endif
//These enumerate the text plotting alignment (reference datum point)
#define TL_DATUM 0 // Top left (default)
#define TC_DATUM 1 // Top centre

View File

@@ -1,10 +1,5 @@
#pragma once
#define TFT_CS 5
#define TFT_DC 17
#define TFT_RST 16
#define TOUCH_CS 32
#define SPI_FREQUENCY 7500000
#define SPI_READ_FREQUENCY 20000000
#define SPI_TOUCH_FREQUENCY 2500000