diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-06-19 17:53:12 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-06-19 17:53:12 +0300 |
commit | 70b08e2840700419fdbc9ec5316846f749bf2a70 (patch) | |
tree | 44ac005486d7042a82867b57a4825c153ad9ac07 /src/CAN | |
parent | b40d46a7da67f663184014fb71f4bd9b3116aac7 (diff) | |
parent | 4f010bb15b0ed8a17632230b65c1549fd27c8333 (diff) |
Merge branch '3.4-dev' into 3.4-input-shaping
Diffstat (limited to 'src/CAN')
-rw-r--r-- | src/CAN/CanInterface.cpp | 14 | ||||
-rw-r--r-- | src/CAN/CanInterface.h | 2 |
2 files changed, 6 insertions, 10 deletions
diff --git a/src/CAN/CanInterface.cpp b/src/CAN/CanInterface.cpp index 758a08ce..23026850 100644 --- a/src/CAN/CanInterface.cpp +++ b/src/CAN/CanInterface.cpp @@ -251,12 +251,11 @@ void CanInterface::Init() noexcept transactionMutex.Create("CanTrans"); #if SAME70 -# ifdef USE_CAN0 - SetPinFunction(APIN_CAN0_TX, CAN0PinPeriphMode); - SetPinFunction(APIN_CAN0_RX, CAN0PinPeriphMode); -# else SetPinFunction(APIN_CAN1_TX, CAN1TXPinPeriphMode); SetPinFunction(APIN_CAN1_RX, CAN1RXPinPeriphMode); +# if DUAL_CAN + SetPinFunction(APIN_CAN0_TX, CAN0PinPeriphMode); + SetPinFunction(APIN_CAN0_RX, CAN0PinPeriphMode); # endif pmc_enable_upll_clock(); // configure_mcan sets up PCLK5 to be the UPLL divided by something, so make sure the UPLL is running #elif SAME5x @@ -799,12 +798,9 @@ void CanInterface::SendMessageNoReplyNoFree(CanMessageBuffer *buf) noexcept #if DUAL_CAN -void CanInterface::SendPlainMessageNoFree(CanMessageBuffer *buf, uint32_t timeout) noexcept +uint32_t CanInterface::SendPlainMessageNoFree(CanMessageBuffer *buf, uint32_t timeout) noexcept { - if (can1dev != nullptr) - { - can1dev->SendMessage(CanDevice::TxBufferNumber::fifo, timeout, buf); - } + return (can1dev != nullptr) ? can1dev->SendMessage(CanDevice::TxBufferNumber::fifo, timeout, buf) : 0; } bool CanInterface::ReceivePlainMessage(CanMessageBuffer *buf, uint32_t timeout) noexcept diff --git a/src/CAN/CanInterface.h b/src/CAN/CanInterface.h index 9293ad09..f397b729 100644 --- a/src/CAN/CanInterface.h +++ b/src/CAN/CanInterface.h @@ -85,7 +85,7 @@ namespace CanInterface uint16_t GetTimeStampCounter() noexcept; #if DUAL_CAN - void SendPlainMessageNoFree(CanMessageBuffer *buf, uint32_t timeout) noexcept; + uint32_t SendPlainMessageNoFree(CanMessageBuffer *buf, uint32_t timeout) noexcept; bool ReceivePlainMessage(CanMessageBuffer *buf, uint32_t timeout) noexcept; #endif |