Skip to content

Commit

Permalink
Fixed ILE register and the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Pluzhnikov committed May 11, 2023
1 parent f104f60 commit da5ebc5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/modm/platform/can/stm32-fdcan/can.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ modm::platform::Fdcan{{ id }}::getMessage(can::Message& message, uint8_t *filter
(*timestamp) = rxMessage.timestamp;
}
rxQueue.pop();
{{ reg }}->ILE = FDCAN_ILE_EINT1 && FDCAN_ILE_EINT0; // reenable ISR, in case it was disabled due to rxQueue full
{{ reg }}->ILE = FDCAN_ILE_EINT1 | FDCAN_ILE_EINT0; // reenable ISR, in case it was disabled due to rxQueue full
return true;
}
%% else
Expand Down
10 changes: 6 additions & 4 deletions test/modm/platform/fdcan/fdcan_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ FdcanTest::testBuffers()

modm::can::Message message{0x4711, 0};
for (uint_fast16_t i = 0; i <= numberOfMsgs; ++i) {
message.setLength(i % 8);
for (uint_fast8_t dataIndex = 0; dataIndex < i; ++dataIndex) {
message.setLength(length);
for (uint_fast8_t dataIndex = 0; dataIndex < length; ++dataIndex) {
message.data[dataIndex] = i;
}
Fdcan1::sendMessage(message);
Expand All @@ -101,9 +101,11 @@ FdcanTest::testBuffers()
TEST_ASSERT_TRUE(Fdcan1::getMessage(receivedMessage));

TEST_ASSERT_EQUALS(receivedMessage.getIdentifier(), 0x4711u);
TEST_ASSERT_EQUALS(receivedMessage.getLength(), (i % 8));

uint_fast8_t length = i % 8;
TEST_ASSERT_EQUALS(receivedMessage.getLength(), length);

for (uint_fast8_t dataIndex = 0; dataIndex < i; ++dataIndex) {
for (uint_fast8_t dataIndex = 0; dataIndex < length; ++dataIndex) {
TEST_ASSERT_EQUALS(receivedMessage.data[dataIndex], i);
}
}
Expand Down

0 comments on commit da5ebc5

Please sign in to comment.