Merge pull request 'meier/master' (#13) from meier/master into master

Reviewed-on: #13
This commit is contained in:
Robin Müller 2021-06-24 17:31:52 +02:00
commit 8ff09c95a6
5 changed files with 15 additions and 3 deletions

View File

@ -155,6 +155,7 @@ ReturnValue_t LinuxLibgpioIF::pullHigh(gpioId_t gpioId) {
} }
gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::WRITE, gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::WRITE,
1, gpioCallback->callbackArgs); 1, gpioCallback->callbackArgs);
return RETURN_OK;
} }
return GPIO_TYPE_FAILURE; return GPIO_TYPE_FAILURE;
} }
@ -176,6 +177,7 @@ ReturnValue_t LinuxLibgpioIF::pullLow(gpioId_t gpioId) {
} }
gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::WRITE, gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::WRITE,
0, gpioCallback->callbackArgs); 0, gpioCallback->callbackArgs);
return RETURN_OK;
} }
return GPIO_TYPE_FAILURE; return GPIO_TYPE_FAILURE;
} }

View File

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

View File

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

View File

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

View File

@ -75,6 +75,12 @@ public:
*/ */
void setCallbackMode(spi::send_callback_function_t callback, void* args); 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 * True if SPI transfers should be performed in full duplex mode
* @return * @return