From 869bec8f88f72560847ea780ee8342eeb0bc215c Mon Sep 17 00:00:00 2001 From: mark9064 <30447455+mark9064@users.noreply.github.com> Date: Fri, 9 Feb 2024 00:11:22 +0000 Subject: [PATCH] Refactor display WriteToRam --- src/drivers/St7789.cpp | 7 +++---- src/drivers/St7789.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/drivers/St7789.cpp b/src/drivers/St7789.cpp index 6824acd8..78ad3a66 100644 --- a/src/drivers/St7789.cpp +++ b/src/drivers/St7789.cpp @@ -131,12 +131,11 @@ void St7789::SetAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) { 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(Commands::WriteToRam)); + WriteSpi(data, size, EnableDataMode); } void St7789::SetVdv() { @@ -163,7 +162,7 @@ void St7789::Uninit() { 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 185c44a0..339776ae 100644 --- a/src/drivers/St7789.h +++ b/src/drivers/St7789.h @@ -36,7 +36,7 @@ namespace Pinetime { void MemoryDataAccessControl(); void DisplayInversionOn(); void NormalModeOn(); - void WriteToRam(); + void WriteToRam(const uint8_t* data, size_t size); void DisplayOn(); void DisplayOff();