simple test task working
This commit is contained in:
parent
877f3d2f66
commit
a71d8e6270
@ -1,6 +1,21 @@
|
||||
#include "SpiTest.h"
|
||||
#include "fsfw_hal/stm32h7/spi/stm32h743zi.h"
|
||||
|
||||
SpiTest::SpiTest(SpiComIF &spiComIF): spiCookie(TEST_ADDRESS, spi::SpiBus::SPI_1,
|
||||
SpiTest::SpiTest(SpiComIF &spiComIF):
|
||||
spiComIF(spiComIF), spiCookie(TEST_ADDRESS, spi::SpiBus::SPI_1,
|
||||
spi::TransferModes::POLLING, &mspCfg, 1000000, spi::SpiModes::MODE_0, 32) {
|
||||
stm32h7::h743zi::standardPollingCfg(mspCfg);
|
||||
spiComIF.initializeInterface(&spiCookie);
|
||||
}
|
||||
|
||||
ReturnValue_t SpiTest::performOperation(uint8_t opCode) {
|
||||
std::array<uint8_t, 3> dummyData = {0x01, 0x02, 0x03};
|
||||
ReturnValue_t result = spiComIF.sendMessage(&spiCookie, dummyData.data(), dummyData.size());
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
std::array<uint8_t, 3> recBuf;
|
||||
uint8_t* recPtr = recBuf.data();
|
||||
size_t readLen = 0;
|
||||
return spiComIF.readReceivedMessage(&spiCookie, &recPtr, &readLen);
|
||||
}
|
||||
|
@ -8,9 +8,12 @@
|
||||
class SpiTest {
|
||||
public:
|
||||
SpiTest(SpiComIF& spiComIF);
|
||||
|
||||
ReturnValue_t performOperation(uint8_t opCode = 0);
|
||||
private:
|
||||
static constexpr address_t TEST_ADDRESS = 0x00;
|
||||
spi::MspPollingConfigStruct mspCfg;
|
||||
SpiComIF& spiComIF;
|
||||
SpiCookie spiCookie;
|
||||
};
|
||||
|
||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit 56327833e631c747bbc701d7dbe44a8536e21942
|
||||
Subproject commit 02468a838f42ba157f622e54e7bd314cf8b73a2a
|
Loading…
Reference in New Issue
Block a user