added some testcode, zero init spi struct

This commit is contained in:
2021-02-24 10:36:23 +01:00
parent 6b982ce5cd
commit 2cc22b2233
6 changed files with 85 additions and 29 deletions

View File

@ -71,6 +71,7 @@ ReturnValue_t SpiComIF::initializeInterface(CookieIF *cookie) {
return HasReturnvaluesIF::RETURN_FAILED;
}
/* Pull CS high in any case to be sure that device is inactive */
gpioId_t gpioId = spiCookie->getChipSelectPin();
if(gpioId != gpio::NO_GPIO) {
gpioComIF->pullHigh(gpioId);
@ -171,23 +172,6 @@ ReturnValue_t SpiComIF::sendMessage(CookieIF *cookie, const uint8_t *sendData, s
}
bool fullDuplex = spiCookie->isFullDuplex();
if(fullDuplex) {
uint8_t* readBuf = nullptr;
ReturnValue_t result = getReadBuffer(spiCookie->getSpiAddress(), &readBuf);
if (result != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "SpiComIF::sendMessage: Could not get read buffer!" <<
std::endl;
#else
sif::printWarning("SpiComIF::sendMessage: Could not get read buffer!\n");
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
return result;
}
spiCookie->assignReadBuffer(readBuf);
}
int retval = 0;
gpioId_t gpioId = spiCookie->getChipSelectPin();