adaptions for spi callback

This commit is contained in:
Martin Zietz 2021-06-21 14:49:20 +02:00
parent 457afca582
commit e3ddb8b3ba
4 changed files with 17 additions and 2 deletions

View File

@ -147,9 +147,13 @@ ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF *cookie,
uint8_t* replyBuffer = i2cDeviceMapIter->second.replyBuffer.data();
int readLen = read(fd, replyBuffer, requestLen);
<<<<<<< Updated upstream
if (readLen != static_cast<int>(requestLen)) {
#if FSFW_VERBOSE_LEVEL >= 1 and FSFW_CPP_OSTREAM_ENABLED == 1
=======
if (readLen != static_cast<int>(requestLen)) {
>>>>>>> Stashed changes
sif::error << "I2cComIF::requestReceiveMessage: Reading from I2C "
<< "device failed with error code " << errno <<". Description"
<< " of error: " << strerror(errno) << std::endl;
@ -157,6 +161,7 @@ ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF *cookie,
<< requestLen << " bytes" << std::endl;
#endif
i2cDeviceMapIter->second.replyLen = 0;
sif::debug << "I2cComIF::requestReceiveMessage: Read " << readLen << " of " << requestLen << " bytes" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}

View File

@ -64,6 +64,8 @@ public:
void setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed);
void performSpiWiretapping(SpiCookie* spiCookie);
ReturnValue_t getReadBuffer(address_t spiAddress, uint8_t** buffer);
private:
struct SpiInstance {
@ -83,8 +85,6 @@ private:
SpiDeviceMap spiDeviceMap;
ReturnValue_t performHalfDuplexReception(SpiCookie* spiCookie);
ReturnValue_t getReadBuffer(address_t spiAddress, uint8_t** buffer);
};
#endif /* LINUX_SPI_SPICOMIF_H_ */

View File

@ -105,6 +105,10 @@ void SpiCookie::setCallbackMode(spi::send_callback_function_t callback,
this->callbackArgs = args;
}
void SpiCookie::setCallbackArgs(void *args) {
this->callbackArgs = args;
}
spi_ioc_transfer* SpiCookie::getTransferStructHandle() {
return &spiTransferStruct;
}

View File

@ -75,6 +75,12 @@ public:
*/
void setCallbackMode(spi::send_callback_function_t callback, void* args);
/**
* Can be used to set the callback arguments and a later point than initialization.
* @param args
*/
void setCallbackArgs(void* args);
/**
* True if SPI transfers should be performed in full duplex mode
* @return