Refactor display WriteToRam

This commit is contained in:
mark9064 2024-02-09 00:11:22 +00:00 committed by JF
parent ee925200c3
commit 869bec8f88
2 changed files with 4 additions and 5 deletions

View File

@ -131,12 +131,11 @@ void St7789::SetAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) {
WriteData(y0 & 0xff); WriteData(y0 & 0xff);
WriteData(y1 >> 8); WriteData(y1 >> 8);
WriteData(y1 & 0xff); WriteData(y1 & 0xff);
WriteToRam();
} }
void St7789::WriteToRam() { void St7789::WriteToRam(const uint8_t* data, size_t size) {
WriteCommand(static_cast<uint8_t>(Commands::WriteToRam)); WriteCommand(static_cast<uint8_t>(Commands::WriteToRam));
WriteSpi(data, size, EnableDataMode);
} }
void St7789::SetVdv() { 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) { 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); SetAddrWindow(x, y, x + width - 1, y + height - 1);
WriteSpi(data, size, EnableDataMode); WriteToRam(data, size);
} }
void St7789::HardwareReset() { void St7789::HardwareReset() {

View File

@ -36,7 +36,7 @@ namespace Pinetime {
void MemoryDataAccessControl(); void MemoryDataAccessControl();
void DisplayInversionOn(); void DisplayInversionOn();
void NormalModeOn(); void NormalModeOn();
void WriteToRam(); void WriteToRam(const uint8_t* data, size_t size);
void DisplayOn(); void DisplayOn();
void DisplayOff(); void DisplayOff();