diff --git a/Sts1CobcSw/Periphery/Rf.cpp b/Sts1CobcSw/Periphery/Rf.cpp index c65db994..4ed56099 100644 --- a/Sts1CobcSw/Periphery/Rf.cpp +++ b/Sts1CobcSw/Periphery/Rf.cpp @@ -3,11 +3,13 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -63,7 +65,10 @@ constexpr auto cmdPowerUp = 0x02_b; constexpr auto cmdSetProperty = 0x11_b; constexpr auto cmdReadCmdBuff = 0x44_b; -// Command response lengths +// Command answer lengths +// TODO: We should do it similarly to SimpleInstruction and SendInstruction() in Flash.cpp. Unless +// this remains the only command with an answer. Then we should probably get rid of SendCommand<>() +// instead. constexpr auto partInfoAnswerLength = 8U; // Max. number of properties that can be set in a single command @@ -102,6 +107,7 @@ constexpr auto watchDogResetPinPause = 1 * MILLISECONDS; // Pause time for the sequence reset -> pause -> set -> pause -> reset in // initialization + // --- Private function declarations --- auto InitializeGpioAndSpi() -> void; @@ -639,12 +645,8 @@ auto Initialize(TxType txType) -> void auto ReadPartNumber() -> std::uint16_t { - auto sendBuffer = std::to_array({cmdPartInfo}); - auto responseBuffer = SendCommandWithResponse(Span(sendBuffer)); - - // NOLINTNEXTLINE(hicpp-signed-bitwise) - return static_cast(static_cast(responseBuffer[1]) << CHAR_BIT - | static_cast(responseBuffer[2])); + auto answer = SendCommand(Span(cmdPartInfo)); + return Deserialize(Span(answer).subspan<1, 2>()); }