From 7a9211587aa17b23b9ff5121abc4f4eca63996d8 Mon Sep 17 00:00:00 2001 From: mark9064 <30447455+mark9064@users.noreply.github.com> Date: Thu, 18 Apr 2024 18:54:07 +0100 Subject: [PATCH] Rename to pre-transaction hook --- src/drivers/Spi.cpp | 4 ++-- src/drivers/Spi.h | 2 +- src/drivers/SpiMaster.cpp | 6 +++--- src/drivers/SpiMaster.h | 2 +- src/drivers/St7789.cpp | 4 ++-- src/drivers/St7789.h | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/drivers/Spi.cpp b/src/drivers/Spi.cpp index a03ea3c0..a95a7eae 100644 --- a/src/drivers/Spi.cpp +++ b/src/drivers/Spi.cpp @@ -9,8 +9,8 @@ Spi::Spi(SpiMaster& spiMaster, uint8_t pinCsn) : spiMaster {spiMaster}, pinCsn { nrf_gpio_pin_set(pinCsn); } -bool Spi::Write(const uint8_t* data, size_t size, const std::function& transactionHook) { - return spiMaster.Write(pinCsn, data, size, transactionHook); +bool Spi::Write(const uint8_t* data, size_t size, const std::function& preTransactionHook) { + return spiMaster.Write(pinCsn, data, size, preTransactionHook); } bool Spi::Read(uint8_t* cmd, size_t cmdSize, uint8_t* data, size_t dataSize) { diff --git a/src/drivers/Spi.h b/src/drivers/Spi.h index e30620cc..0c5edf08 100644 --- a/src/drivers/Spi.h +++ b/src/drivers/Spi.h @@ -15,7 +15,7 @@ namespace Pinetime { Spi& operator=(Spi&&) = delete; bool Init(); - bool Write(const uint8_t* data, size_t size, const std::function& transactionHook); + bool Write(const uint8_t* data, size_t size, const std::function& preTransactionHook); bool Read(uint8_t* cmd, size_t cmdSize, uint8_t* data, size_t dataSize); bool WriteCmdAndBuffer(const uint8_t* cmd, size_t cmdSize, const uint8_t* data, size_t dataSize); void Sleep(); diff --git a/src/drivers/SpiMaster.cpp b/src/drivers/SpiMaster.cpp index eec62cb7..690a3226 100644 --- a/src/drivers/SpiMaster.cpp +++ b/src/drivers/SpiMaster.cpp @@ -167,7 +167,7 @@ void SpiMaster::PrepareRx(const uint32_t bufferAddress, const size_t size) { spiBaseAddress->EVENTS_END = 0; } -bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size, const std::function& transactionHook) { +bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size, const std::function& preTransactionHook) { if (data == nullptr) return false; auto ok = xSemaphoreTake(mutex, portMAX_DELAY); @@ -181,8 +181,8 @@ bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size, const st DisableWorkaroundForFtpan58(spiBaseAddress, 0, 0); } - if (transactionHook != nullptr) { - transactionHook(); + if (preTransactionHook != nullptr) { + preTransactionHook(); } nrf_gpio_pin_clear(this->pinCsn); diff --git a/src/drivers/SpiMaster.h b/src/drivers/SpiMaster.h index 2f39a1b2..af38e87b 100644 --- a/src/drivers/SpiMaster.h +++ b/src/drivers/SpiMaster.h @@ -32,7 +32,7 @@ namespace Pinetime { SpiMaster& operator=(SpiMaster&&) = delete; bool Init(); - bool Write(uint8_t pinCsn, const uint8_t* data, size_t size, const std::function& transactionHook); + bool Write(uint8_t pinCsn, const uint8_t* data, size_t size, const std::function& preTransactionHook); bool Read(uint8_t pinCsn, uint8_t* cmd, size_t cmdSize, uint8_t* data, size_t dataSize); bool WriteCmdAndBuffer(uint8_t pinCsn, const uint8_t* cmd, size_t cmdSize, const uint8_t* data, size_t dataSize); diff --git a/src/drivers/St7789.cpp b/src/drivers/St7789.cpp index e933c374..d1747c23 100644 --- a/src/drivers/St7789.cpp +++ b/src/drivers/St7789.cpp @@ -49,8 +49,8 @@ void St7789::WriteCommand(const uint8_t* data, size_t size) { }); } -void St7789::WriteSpi(const uint8_t* data, size_t size, const std::function& transactionHook) { - spi.Write(data, size, transactionHook); +void St7789::WriteSpi(const uint8_t* data, size_t size, const std::function& preTransactionHook) { + spi.Write(data, size, preTransactionHook); } void St7789::SoftwareReset() { diff --git a/src/drivers/St7789.h b/src/drivers/St7789.h index f49ed511..715bd1bd 100644 --- a/src/drivers/St7789.h +++ b/src/drivers/St7789.h @@ -47,7 +47,7 @@ namespace Pinetime { void SetVdv(); void WriteCommand(uint8_t cmd); void WriteCommand(const uint8_t* data, size_t size); - void WriteSpi(const uint8_t* data, size_t size, const std::function& transactionHook); + void WriteSpi(const uint8_t* data, size_t size, const std::function& preTransactionHook); enum class Commands : uint8_t { SoftwareReset = 0x01,