From 1a899101417b3eeea092285f31ca3f6afcc6344a Mon Sep 17 00:00:00 2001 From: mark9064 <30447455+mark9064@users.noreply.github.com> Date: Thu, 2 May 2024 22:24:41 +0100 Subject: [PATCH] Fixes for PR 2046 (SPI transaction hooks) --- sim/drivers/SpiMaster.cpp | 2 +- sim/drivers/SpiMaster.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sim/drivers/SpiMaster.cpp b/sim/drivers/SpiMaster.cpp index 92e7ab2..e9d9473 100644 --- a/sim/drivers/SpiMaster.cpp +++ b/sim/drivers/SpiMaster.cpp @@ -176,7 +176,7 @@ void SpiMaster::OnStartedEvent() { // spiBaseAddress->EVENTS_END = 0; //} -bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size) { +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); diff --git a/sim/drivers/SpiMaster.h b/sim/drivers/SpiMaster.h index 14ba2d2..4e53492 100644 --- a/sim/drivers/SpiMaster.h +++ b/sim/drivers/SpiMaster.h @@ -1,6 +1,7 @@ #pragma once #include #include +#include #include //#include @@ -30,7 +31,7 @@ namespace Pinetime { SpiMaster& operator=(SpiMaster&&) = delete; bool Init(); - bool Write(uint8_t pinCsn, const uint8_t* data, size_t size); + 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);