com if passed to callback as well

This commit is contained in:
Robin Müller 2021-05-24 19:11:01 +02:00
parent d801319c12
commit f363d0fbd5
2 changed files with 7 additions and 5 deletions

View File

@ -165,13 +165,14 @@ ReturnValue_t SpiComIF::sendMessage(CookieIF *cookie, const uint8_t *sendData, s
void* funcArgs = nullptr; void* funcArgs = nullptr;
spiCookie->getCallback(&sendFunc, &funcArgs); spiCookie->getCallback(&sendFunc, &funcArgs);
if(sendFunc != nullptr) { if(sendFunc != nullptr) {
result = sendFunc(spiCookie, sendData, sendLen, funcArgs); result = sendFunc(this, spiCookie, sendData, sendLen, funcArgs);
} }
} }
return result; return result;
} }
ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie *spiCookie, const uint8_t *sendData, size_t sendLen) { ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie *spiCookie, const uint8_t *sendData,
size_t sendLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
int retval = 0; int retval = 0;
/* Prepare transfer */ /* Prepare transfer */
@ -265,8 +266,7 @@ ReturnValue_t SpiComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLe
return NULLPOINTER; return NULLPOINTER;
} }
bool fullDuplex = spiCookie->isFullDuplex(); if(spiCookie->isFullDuplex()) {
if(fullDuplex) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }

View File

@ -9,6 +9,7 @@
#include <cstdint> #include <cstdint>
class SpiCookie; class SpiCookie;
class SpiComIF;
namespace spi { namespace spi {
@ -25,7 +26,8 @@ enum SpiComIfModes {
}; };
using send_callback_function_t = ReturnValue_t (*) (SpiCookie *cookie, const uint8_t *sendData, size_t sendLen, void* args); using send_callback_function_t = ReturnValue_t (*) (SpiComIF* comIf, SpiCookie *cookie,
const uint8_t *sendData, size_t sendLen, void* args);
} }