InfiniTime.git

commit 7a9211587aa17b23b9ff5121abc4f4eca63996d8

Author: mark9064 <30447455+mark9064@users.noreply.github.com>

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 +-


diff --git a/src/drivers/Spi.cpp b/src/drivers/Spi.cpp
index a03ea3c043ba82e07f393b26b496bd64696fee99..a95a7eaee185e61d9b20c3c01905f6c67a3a08b3 100644
--- a/src/drivers/Spi.cpp
+++ b/src/drivers/Spi.cpp
@@ -9,8 +9,8 @@   nrf_gpio_cfg_output(pinCsn);
   nrf_gpio_pin_set(pinCsn);
 }
 
-bool Spi::Write(const uint8_t* data, size_t size, const std::function<void()>& transactionHook) {
-  return spiMaster.Write(pinCsn, data, size, transactionHook);
+bool Spi::Write(const uint8_t* data, size_t size, const std::function<void()>& 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 e30620cc9849a09d37fdd08776eaa279d097503f..0c5edf0870db633672b749ec227cf64647e89b08 100644
--- a/src/drivers/Spi.h
+++ b/src/drivers/Spi.h
@@ -15,7 +15,7 @@       Spi(Spi&&) = delete;
       Spi& operator=(Spi&&) = delete;
 
       bool Init();
-      bool Write(const uint8_t* data, size_t size, const std::function<void()>& transactionHook);
+      bool Write(const uint8_t* data, size_t size, const std::function<void()>& 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 eec62cb77918de9c48ab19f0fef43f79bd9b839b..690a322602c097f7bc3a43c7a0b3faf23a15b99c 100644
--- a/src/drivers/SpiMaster.cpp
+++ b/src/drivers/SpiMaster.cpp
@@ -167,7 +167,7 @@   spiBaseAddress->RXD.LIST = 0;
   spiBaseAddress->EVENTS_END = 0;
 }
 
-bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size, const std::function<void()>& transactionHook) {
+bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size, const std::function<void()>& preTransactionHook) {
   if (data == nullptr)
     return false;
   auto ok = xSemaphoreTake(mutex, portMAX_DELAY);
@@ -181,8 +181,8 @@   } else {
     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 2f39a1b2b0ad8508ae23415a3c985ceb11524dee..af38e87b7e71f2d7b799c0a217ca35d3e78819db 100644
--- a/src/drivers/SpiMaster.h
+++ b/src/drivers/SpiMaster.h
@@ -32,7 +32,7 @@       SpiMaster(SpiMaster&&) = delete;
       SpiMaster& operator=(SpiMaster&&) = delete;
 
       bool Init();
-      bool Write(uint8_t pinCsn, const uint8_t* data, size_t size, const std::function<void()>& transactionHook);
+      bool Write(uint8_t pinCsn, const uint8_t* data, size_t size, const std::function<void()>& 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 e933c3740c8d8e0b8c1873fb24a7756e80aacd24..d1747c2392153fe524cd34ff1a3d461814e8417f 100644
--- a/src/drivers/St7789.cpp
+++ b/src/drivers/St7789.cpp
@@ -49,8 +49,8 @@     nrf_gpio_pin_clear(pinDataCommand);
   });
 }
 
-void St7789::WriteSpi(const uint8_t* data, size_t size, const std::function<void()>& transactionHook) {
-  spi.Write(data, size, transactionHook);
+void St7789::WriteSpi(const uint8_t* data, size_t size, const std::function<void()>& preTransactionHook) {
+  spi.Write(data, size, preTransactionHook);
 }
 
 void St7789::SoftwareReset() {




diff --git a/src/drivers/St7789.h b/src/drivers/St7789.h
index f49ed511de0d38b803366300f7bd4d045b2b94c5..715bd1bd7294bc253adee31aba6f224e557e06d0 100644
--- a/src/drivers/St7789.h
+++ b/src/drivers/St7789.h
@@ -47,7 +47,7 @@       void SetAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
       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<void()>& transactionHook);
+      void WriteSpi(const uint8_t* data, size_t size, const std::function<void()>& preTransactionHook);
 
       enum class Commands : uint8_t {
         SoftwareReset = 0x01,