Author: mark9064 <30447455+mark9064@users.noreply.github.com>
Refactor display WriteToRam
src/drivers/St7789.cpp | 7 +++---- src/drivers/St7789.h | 2 +-
diff --git a/src/drivers/St7789.cpp b/src/drivers/St7789.cpp index 6824acd88946e3909cd5e9866a372333fbb76957..78ad3a66bb6c8234a60549f6710bd83e094be1b6 100644 --- a/src/drivers/St7789.cpp +++ b/src/drivers/St7789.cpp @@ -131,12 +131,11 @@ WriteData(y0 >> 8); WriteData(y0 & 0xff); WriteData(y1 >> 8); WriteData(y1 & 0xff); - - WriteToRam(); } -void St7789::WriteToRam() { +void St7789::WriteToRam(const uint8_t* data, size_t size) { WriteCommand(static_cast<uint8_t>(Commands::WriteToRam)); + WriteSpi(data, size, EnableDataMode); } void St7789::SetVdv() { @@ -163,7 +162,7 @@ } void St7789::DrawBuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t* data, size_t size) { SetAddrWindow(x, y, x + width - 1, y + height - 1); - WriteSpi(data, size, EnableDataMode); + WriteToRam(data, size); } void St7789::HardwareReset() { diff --git a/src/drivers/St7789.h b/src/drivers/St7789.h index 185c44a079dc9dcca1317d67d1b93906db171b22..339776aee6d4bd14d8a80f26770e00894efe60ce 100644 --- a/src/drivers/St7789.h +++ b/src/drivers/St7789.h @@ -36,7 +36,7 @@ void ColMod(); void MemoryDataAccessControl(); void DisplayInversionOn(); void NormalModeOn(); - void WriteToRam(); + void WriteToRam(const uint8_t* data, size_t size); void DisplayOn(); void DisplayOff();