Skip to content

Commit

Permalink
Merge branch 'bugfix-2.1.x' into MARLIN-E3S1PROFORK-BYTT-RELEASE-CODE
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasToka committed Jun 16, 2023
2 parents a958692 + eca80db commit 8f4674c
Show file tree
Hide file tree
Showing 90 changed files with 4,153 additions and 4,081 deletions.
2 changes: 1 addition & 1 deletion Marlin/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
//#define STRING_DISTRIBUTION_DATE "2023-06-13"
//#define STRING_DISTRIBUTION_DATE "2023-06-16"

/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
Expand Down
40 changes: 20 additions & 20 deletions Marlin/src/HAL/LPC1768/tft/tft_spi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

SPIClass TFT_SPI::SPIx(TFT_SPI_DEVICE);

void TFT_SPI::Init() {
void TFT_SPI::init() {
#if PIN_EXISTS(TFT_RESET)
OUT_WRITE(TFT_RESET_PIN, HIGH);
delay(100);
Expand All @@ -49,21 +49,21 @@ void TFT_SPI::Init() {
SPIx.setDataMode(SPI_MODE0);
}

void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
SPIx.setDataSize(DataSize);
void TFT_SPI::dataTransferBegin(uint16_t dataSize) {
SPIx.setDataSize(dataSize);
SPIx.begin();
WRITE(TFT_CS_PIN, LOW);
}

uint32_t TFT_SPI::GetID() {
uint32_t TFT_SPI::getID() {
uint32_t id;
id = ReadID(LCD_READ_ID);
id = readID(LCD_READ_ID);
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
id = ReadID(LCD_READ_ID4);
id = readID(LCD_READ_ID4);
return id;
}

uint32_t TFT_SPI::ReadID(uint16_t Reg) {
uint32_t TFT_SPI::readID(uint16_t reg) {
uint32_t data = 0;

#if PIN_EXISTS(TFT_MISO)
Expand All @@ -72,14 +72,14 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) {
SPIx.setClock(SPI_CLOCK_DIV64);
SPIx.begin();
WRITE(TFT_CS_PIN, LOW);
WriteReg(Reg);
writeReg(reg);

for (uint8_t i = 0; i < 4; ++i) {
SPIx.read((uint8_t*)&d, 1);
data = (data << 8) | d;
}

DataTransferEnd();
dataTransferEnd();
SPIx.setClock(SPI_CLOCK_MAX_TFT);
#endif

Expand All @@ -103,11 +103,11 @@ bool TFT_SPI::isBusy() {
if ((SSP_GetStatus(LPC_SSPx, SSP_STAT_TXFIFO_EMPTY) == RESET) || (SSP_GetStatus(LPC_SSPx, SSP_STAT_BUSY) == SET)) return true;
}

Abort();
abort();
return false;
}

void TFT_SPI::Abort() {
void TFT_SPI::abort() {
// DMA Channel 0 is hardcoded in dmaSendAsync() and dmaSend()

// Disable DMA
Expand All @@ -126,20 +126,20 @@ void TFT_SPI::Abort() {
LPC_GPDMACH0->DMACCSrcAddr = 0U;
LPC_GPDMACH0->DMACCDestAddr = 0U;

DataTransferEnd();
dataTransferEnd();
}

void TFT_SPI::Transmit(uint16_t Data) { SPIx.transfer(Data); }
void TFT_SPI::transmit(uint16_t data) { SPIx.transfer(data); }

void TFT_SPI::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
DataTransferBegin(DATASIZE_16BIT);
SPIx.dmaSend(Data, Count, MemoryIncrease);
Abort();
void TFT_SPI::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
dataTransferBegin(DATASIZE_16BIT);
SPIx.dmaSend(data, count, memoryIncrease);
abort();
}

void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
DataTransferBegin(DATASIZE_16BIT);
SPIx.dmaSendAsync(Data, Count, MemoryIncrease);
void TFT_SPI::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
dataTransferBegin(DATASIZE_16BIT);
SPIx.dmaSendAsync(data, count, memoryIncrease);

TERN_(TFT_SHARED_IO, while (isBusy()));
}
Expand Down
38 changes: 19 additions & 19 deletions Marlin/src/HAL/LPC1768/tft/tft_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,34 +56,34 @@

class TFT_SPI {
private:
static uint32_t ReadID(uint16_t Reg);
static void Transmit(uint16_t Data);
static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
static uint32_t readID(uint16_t reg);
static void transmit(uint16_t data);
static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count);

public:
static SPIClass SPIx;

static void Init();
static uint32_t GetID();
static void init();
static uint32_t getID();
static bool isBusy();
static void Abort();
static void abort();

static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT);
static void DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SSP_Cmd(LPC_SSPx, DISABLE); };
static void DataTransferAbort();
static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT);
static void dataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SSP_Cmd(LPC_SSPx, DISABLE); };
static void dataTransferAbort();

static void WriteData(uint16_t Data) { Transmit(Data); }
static void WriteReg(uint16_t Reg) { WRITE(TFT_DC_PIN, LOW); Transmit(Reg); WRITE(TFT_DC_PIN, HIGH); }
static void writeData(uint16_t data) { transmit(data); }
static void writeReg(uint16_t reg) { WRITE(TFT_DC_PIN, LOW); transmit(reg); WRITE(TFT_DC_PIN, HIGH); }

static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_MINC_ENABLE, Data, Count); }
static void WriteMultiple_DMA(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_MINC_DISABLE, &Data, Count); }
static void writeSequence_DMA(uint16_t *data, uint16_t count) { transmitDMA(DMA_MINC_ENABLE, data, count); }
static void writeMultiple_DMA(uint16_t color, uint16_t count) { static uint16_t data; data = color; transmitDMA(DMA_MINC_DISABLE, &data, count); }

static void WriteSequence(uint16_t *Data, uint16_t Count) { Transmit(DMA_MINC_ENABLE, Data, Count); }
static void WriteMultiple(uint16_t Color, uint32_t Count) {
while (Count > 0) {
Transmit(DMA_MINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count);
Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0;
static void writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_MINC_ENABLE, data, count); }
static void writeMultiple(uint16_t color, uint32_t count) {
while (count > 0) {
transmit(DMA_MINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count);
count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0;
}
}
};
12 changes: 6 additions & 6 deletions Marlin/src/HAL/LPC1768/tft/xpt2046.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ uint16_t delta(uint16_t a, uint16_t b) { return a > b ? a - b : b - a; }
}
#endif

void XPT2046::Init() {
void XPT2046::init() {
#if DISABLED(TOUCH_BUTTONS_HW_SPI)
SET_INPUT(TOUCH_MISO_PIN);
SET_OUTPUT(TOUCH_MOSI_PIN);
Expand Down Expand Up @@ -85,7 +85,7 @@ bool XPT2046::getRawPoint(int16_t *x, int16_t *y) {
uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) {
uint16_t data[3];

DataTransferBegin();
dataTransferBegin();
TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.begin());

for (uint16_t i = 0; i < 3 ; i++) {
Expand All @@ -94,7 +94,7 @@ uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) {
}

TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.end());
DataTransferEnd();
dataTransferEnd();

uint16_t delta01 = delta(data[0], data[1]),
delta02 = delta(data[0], data[2]),
Expand All @@ -107,18 +107,18 @@ uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) {
}

uint16_t XPT2046::IO(uint16_t data) {
return TERN(TOUCH_BUTTONS_HW_SPI, HardwareIO, SoftwareIO)(data);
return TERN(TOUCH_BUTTONS_HW_SPI, hardwareIO, softwareIO)(data);
}

extern uint8_t spiTransfer(uint8_t b);

#if ENABLED(TOUCH_BUTTONS_HW_SPI)
uint16_t XPT2046::HardwareIO(uint16_t data) {
uint16_t XPT2046::hardwareIO(uint16_t data) {
return SPIx.transfer(data & 0xFF);
}
#endif

uint16_t XPT2046::SoftwareIO(uint16_t data) {
uint16_t XPT2046::softwareIO(uint16_t data) {
uint16_t result = 0;

for (uint8_t j = 0x80; j; j >>= 1) {
Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/HAL/LPC1768/tft/xpt2046.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ class XPT2046 {
static uint16_t getRawData(const XPTCoordinate coordinate);
static bool isTouched();

static void DataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
static void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
static void dataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
static void dataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
static uint16_t HardwareIO(uint16_t data);
static uint16_t hardwareIO(uint16_t data);
#endif
static uint16_t SoftwareIO(uint16_t data);
static uint16_t softwareIO(uint16_t data);
static uint16_t IO(uint16_t data = 0);

public:
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
static SPIClass SPIx;
#endif

static void Init();
static void init();
static bool getRawPoint(int16_t *x, int16_t *y);
};
30 changes: 15 additions & 15 deletions Marlin/src/HAL/NATIVE_SIM/tft/tft_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,28 @@

class TFT_SPI {
private:
static uint32_t ReadID(uint16_t Reg);
static void Transmit(uint16_t Data);
static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
static uint32_t readID(uint16_t reg);
static void transmit(uint16_t data);
static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count);

public:
// static SPIClass SPIx;

static void Init();
static uint32_t GetID();
static void init();
static uint32_t getID();
static bool isBusy();
static void Abort();
static void abort();

static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT);
static void DataTransferEnd();
static void DataTransferAbort();
static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT);
static void dataTransferEnd();
static void dataTransferAbort();

static void WriteData(uint16_t Data);
static void WriteReg(uint16_t Reg);
static void writeData(uint16_t data);
static void writeReg(uint16_t reg);

static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { WriteSequence(Data, Count); }
static void WriteMultiple_DMA(uint16_t Color, uint16_t Count) { WriteMultiple(Color, Count); }
static void writeSequence_DMA(uint16_t *data, uint16_t count) { writeSequence(data, count); }
static void writeMultiple_DMA(uint16_t color, uint16_t count) { writeMultiple(color, count); }

static void WriteSequence(uint16_t *Data, uint16_t Count);
static void WriteMultiple(uint16_t Color, uint32_t Count);
static void writeSequence(uint16_t *data, uint16_t count);
static void writeMultiple(uint16_t color, uint32_t count);
};
10 changes: 5 additions & 5 deletions Marlin/src/HAL/NATIVE_SIM/tft/xpt2046.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@ class XPT2046 {
static uint16_t getRawData(const XPTCoordinate coordinate);
static bool isTouched();

static void DataTransferBegin();
static void DataTransferEnd();
static void dataTransferBegin();
static void dataTransferEnd();
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
static uint16_t HardwareIO(uint16_t data);
static uint16_t hardwareIO(uint16_t data);
#endif
static uint16_t SoftwareIO(uint16_t data);
static uint16_t softwareIO(uint16_t data);
static uint16_t IO(uint16_t data = 0);

public:
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
static SPIClass SPIx;
#endif

static void Init();
static void init();
static bool getRawPoint(int16_t *x, int16_t *y);
};
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32/tft/gt911.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void GT911::read_reg(uint16_t reg, uint8_t reg_len, uint8_t* r_data, uint8_t r_l
sw_iic.stop();
}

void GT911::Init() {
void GT911::init() {
OUT_WRITE(GT911_RST_PIN, LOW);
OUT_WRITE(GT911_INT_PIN, LOW);
delay(11);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/STM32/tft/gt911.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class GT911 {
static void read_reg(uint16_t reg, uint8_t reg_len, uint8_t* r_data, uint8_t r_len);

public:
static void Init();
static void init();
static bool getFirstTouchPoint(int16_t *x, int16_t *y);
static bool getPoint(int16_t *x, int16_t *y);
};
Loading

0 comments on commit 8f4674c

Please sign in to comment.