reaction wheels testing
This commit is contained in:
@ -103,6 +103,7 @@ ReturnValue_t rwSpiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *s
|
||||
}
|
||||
return RwHandler::SPI_WRITE_FAILURE;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
/** Sending frame start sign */
|
||||
@ -125,6 +126,14 @@ ReturnValue_t rwSpiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *s
|
||||
uint8_t* rxBuf = nullptr;
|
||||
result = comIf->getReadBuffer(cookie->getSpiAddress(), &rxBuf);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if(gpioId != gpio::NO_GPIO) {
|
||||
if (gpioIF->pullHigh(gpioId) != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "rwSpiCallback: Failed to pull chip select high" << std::endl;
|
||||
}
|
||||
}
|
||||
if(mutex->unlockMutex() != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "rwSpiCallback: Failed to unlock mutex";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -133,6 +142,14 @@ ReturnValue_t rwSpiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *s
|
||||
uint8_t byteRead = 0;
|
||||
/** Reading the reply frame */
|
||||
if(read(fileDescriptor, &byteRead, 1) != 1) {
|
||||
if(gpioId != gpio::NO_GPIO) {
|
||||
if (gpioIF->pullHigh(gpioId) != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "rwSpiCallback: Failed to pull chip select high" << std::endl;
|
||||
}
|
||||
}
|
||||
if(mutex->unlockMutex() != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "rwSpiCallback: Failed to unlock mutex";
|
||||
}
|
||||
sif::error << "rwSpiCallback: Failed to read first byte of reply frame" << std::endl;
|
||||
return RwHandler::SPI_READ_FAILURE;
|
||||
}
|
||||
@ -140,6 +157,14 @@ ReturnValue_t rwSpiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *s
|
||||
/** First byte must be the start sign 0x7E */
|
||||
if (byteRead != 0x7E) {
|
||||
sif::error << "rwSpiCallback: First byte of reply is not 0x7E" << std::endl;
|
||||
if(gpioId != gpio::NO_GPIO) {
|
||||
if (gpioIF->pullHigh(gpioId) != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "rwSpiCallback: Failed to pull chip select high" << std::endl;
|
||||
}
|
||||
}
|
||||
if(mutex->unlockMutex() != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "rwSpiCallback: Failed to unlock mutex";
|
||||
}
|
||||
return RwHandler::MISSING_START_SIGN;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user